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.
| Attribute | Required | Description |
|---|---|---|
data-site-key | Yes | Your registered site domain. |
data-endpoint | No | The ingest URL. Defaults to https://cdp.vyg.app/cdp/ingest. |
data-auto-capture | No | Set to off to stop the pixel from picking up email and phone from forms on its own. |
data-default-country | No | Country calling code for phone numbers typed without one. Defaults to 1. |
data-session-timeout | No | Milliseconds of inactivity before a new session starts. Defaults to 30 minutes. |
What it sends
- A
page_viewedevent 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.