Before you start
Create a free Cool Analytics account and add your site. You'll get a site ID — replace YOUR_SITE_ID in the code below with it. The dashboard shows the snippet with your ID already filled in.
Install on Shopify
- 1In Shopify admin, go to Online Store → Themes.
- 2Next to your live theme, click ⋯ → Edit code.
- 3Open layout/theme.liquid, paste the snippet just before </head>, and click Save.
<script defer src="https://coolanalytics.dev/hb.js" data-site="YOUR_SITE_ID"></script>
Check that it works
Open your live site in a new tab, then open your Cool Analytics dashboard. Your visit appears on the live map within seconds — with the page you're on, where you came from and your browser.
Nothing showing up? Make sure you're looking at the published site (not a preview or editor), that an ad blocker isn't blocking the script, and that you're not testing on localhost.
Track signups, purchases and clicks
Pageviews, sources, countries and outbound link clicks are tracked automatically. For the moments that matter to you, send a custom event. Events named like a signup show up as signups, and events with an amount show up as revenue — on the live map and per traffic source.
// anywhere in your Shopify site's browser code
window.hb?.track("signup");
// with an amount, it shows up as revenue
window.hb?.track("purchase", { amount: 49 });Shopify tips
- Shopify's checkout is hosted separately and doesn't load theme code, so checkout pages aren't tracked by the theme snippet. You will see which products and pages lead people to the cart.
- If you switch or update to a new theme, add the snippet to the new theme's theme.liquid again.
- Duplicate the theme before editing if you want a safe backup.
Want to keep your own visits out of the stats? Open your site once with #hb-ignore at the end of the URL. That browser is excluded until you visit with #hb-track.
Shopify analytics FAQ
Do I need a Shopify app?+
No. One line in theme.liquid is enough, and there's no app slowing your store down.
Can I track add-to-cart?+
Yes. If your theme lets you add JavaScript, call hb.track('add_to_cart') when the button is clicked.
Is it GDPR-friendly for EU shoppers?+
It sets no cookies and stores no personal data, so analytics doesn't need consent. Shopify's own cookies are a separate matter.