Script tag (sz.js)
The measurement half of ShiftZero is one script tag — no bundler, no build step. It works on Shopify themes, WordPress headers, and plain HTML alike.
before </body>
<script async src="https://YOUR-DASHBOARD/sz.js"
data-endpoint="https://YOUR-COLLECTOR/events?wk=YOUR_WRITE_KEY"
data-consent-cookie="cookie_consent"
data-consent-values="granted"></script>Attributes
| Attribute | Required | Meaning |
|---|---|---|
data-endpoint | yes | Collector events URL. Include your publishable write key as ?wk= — it authenticates ingestion (safe to expose, like a GA measurement id). |
data-consent-cookie | recommended | Name of your consent cookie. Without a granting value present, nothing is measured. |
data-consent-values | optional | Comma-separated cookie values that mean granted (default: 1, true, granted, yes, allow). |
What it does
The tag wraps dataLayer.push and mirrors every event your site already fires — GTM-style objects ({ event: "purchase", value: 42 }) and gtag-style argument arrays both work. Google Analytics keeps receiving everything exactly as before; ShiftZero just listens on the same stream. Each mirrored conversion is stamped with the visitor’s edge assignments (from window.shiftzero, injected by the edge), which makes attribution exact even with several experiments running.
Using a bundler?
npm install @shiftzero/track and call createDataLayerBridge({ endpoint, consent }) — same behaviour, typed API, custom event→metric mapping.