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
In VYG, open Integrations → VYG Web Pixel (or the Connect your store → I only have a website step in guided setup), enter your website address, and copy the embed code it shows. The integration is available to accounts with customer data (CDP) turned on; otherwise ask your VYG account team.
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' }]);Page variants
If you split-test a page, tell the pixel which version the visitor saw. Every event after that, for the rest of the browser session, carries the variant, so website reports can compare variants. Set it on the page:
<html lang="en" data-vyg-variant="furniture-b"></html>or from script:
window.vyg.set('variant', 'furniture-b');
window.vyg.push(['set', 'variant', 'furniture-b']); // before the script loads
window.vyg.set('variant', null); // clear itA variant is 1 to 64 letters, digits, _, ., : or -. Other values are ignored.
Caching
Updates to the pixel script may take up to an hour to reach returning visitors.
Checkout recovery
To send recovery campaigns from this pixel, follow the checkout recovery setup guide. It covers enabling the feature, connecting checkout updates and completion, and testing your campaign. You use the same pixel script. Existing WooCommerce or custom checkout integrations can keep their current setup.