Install telemtrie on your site
Privacy-friendly analytics + Web Vitals. No cookies, no consent banner, no personal data. One snippet, any stack.
⚡ Make it first-party (recommended — do this first)
Your loader host should be a subdomain of your own store (e.g. metrics.yourshop.com) so analytics loads first-party and ad blockers don't quietly drop your data. If you control your store's DNS, add one record:
metrics CNAME cname.vercel-dns.comIt's ready when https://metrics.yourshop.com/r.js loads JavaScript in your browser. Works without this too (pointed at the default host) — first-party is just the accuracy upgrade.
1 · Add the snippet
Paste this just before the closing </head> tag, on every page. Keep the queue stub before the loader.
Where it goes
Drop it into your shared <head> (e.g. index.html, layouts/Base.astro, _includes/head.html) so every page includes it.
In app/layout.tsx with next/script:
Same next/script pattern as the app router, placed in pages/_document.tsx inside <Head>.
Open layout/theme.liquid and paste the snippet right before </head>.
New Custom HTML tag with the snippet, trigger All Pages, set to fire as early as possible.
localhost, Vercel previews (*.vercel.app), and preview.* / staging.* hosts — so test traffic never pollutes your numbers. You'll only see data from your real production domain.2 · Track your checkout funnel (optional, recommended)
Call window.metric(...) at three moments. Use these exact names — you'll get a cart → checkout → payment funnel with drop-off:
// product added to cart
window.metric('cart_add', { product: 'dragon-keychain', price: 40 });
// checkout opened
window.metric('checkout_open', { items: 2, subtotal: 72.50 });
// payment completed (fire once, on the thank-you page)
window.metric('payment_success', { total: 72.50, items: 2 });
Rules for event data
- Props must be flat — strings, numbers, or booleans only (no nested objects/arrays).
- No personal data. Keys like
email,phone,name,address,password,token,ssn,credit,cardare rejected automatically.
3 · Check it's working
- Visit your live site (not localhost or a preview URL).
- Open DevTools → Network and reload.
- Look for a request to
…/api/collectreturning 204 — that's a pageview landing. - Run through add-to-cart / checkout and watch for a 204 on each step.