VYG Docs

Web pixel

Add the VYG web pixel to a website that is not a Shopify store.

The VYG web pixel (vyg.js) collects events on websites that are not Shopify stores. Shopify stores use the pixel installed with the VYG Shopify app instead.

Before you start

Ask your VYG account team to register your website and provide the embed code.

Add the script

Add this tag to every page, for example in the site's <head>:

<script src="https://cdp.vyg.app/cdp/vyg.js" data-site-key="yourstore.com" defer></script>

data-site-key is your registered site domain, without www. or a path. This value is public and requires no API key.

AttributeRequiredDescription
data-site-keyYesYour registered site domain.
data-endpointNoThe ingest URL. Defaults to https://cdp.vyg.app/cdp/ingest.
data-auto-captureNoSet to off to stop the pixel from picking up email and phone from forms on its own.
data-default-countryNoCountry calling code for phone numbers typed without one. Defaults to 1.
data-session-timeoutNoMilliseconds of inactivity before a new session starts. Defaults to 30 minutes.

What it sends

  • A page_viewed event when a page loads, and again on route changes in single-page apps.
  • Email and phone numbers that visitors enter in forms, to connect the visit to a customer, unless data-auto-capture="off" is set.

Events are batched and sent to POST /cdp/ingest. Failures are retried a few times and never raise errors on your page.

Track your own events

The script adds a vyg object to the page:

window.vyg.track('newsletter_signup', { source: 'footer' });
window.vyg.identify({ email: 'jane@example.com', phone: '+15551234567' });

Calls made before the script loads are queued if you add this line before the script tag:

<script>
	window.vyg = window.vyg || [];
</script>

and push commands onto it:

window.vyg.push(['track', 'newsletter_signup', { source: 'footer' }]);

Caching

Updates to the pixel script may take up to an hour to reach returning visitors.

On this page