Cookieless analytics on Shopify: install in 5 minutes
Published November 3, 2026
How to add a cookieless analytics script to a Shopify store: edit theme.liquid, check the install, and know what the script does and does not measure.
You can add cookieless analytics to Shopify by pasting one script tag into the <head> of your theme's theme.liquid file, then checking that data arrives. It takes about five minutes. There is no app or plugin to install from the Shopify store, so the script tag is the way in.
This guide covers where to paste the tag, how to verify it, which Shopify route to avoid for this kind of script, and what you should still decide yourself about consent.
Is there an app to install from the Shopify store?
No. Klickbee Tracking installs with a script tag, or with the npm package on a custom front end. On a standard Shopify theme, the script tag in theme.liquid is the route.
That is a trade-off. An app would be a one-click install, but a script tag means you control exactly where the code sits and you can remove it by deleting one line.
What do you need before you start?
- A Shopify store with a theme you can edit. Shopify's help center says that if you use a trial version of a paid theme, you need to purchase it before you can edit its code. Its edit theme code page states no plan requirement for editing code, as of November 2026.
- A Klickbee Tracking project. The free plan covers 1 site and 1,000 sessions per month.
- Your project's public key, which starts with
pk_and is shown under Settings, then Projects, in your dashboard.
How do you install the script on Shopify?
- In the Klickbee dashboard, open Settings, then Projects, and copy your install snippet. It looks like this, with your own key in place of
pk_xxx:
<script src="https://tracking.klickbee.com/t.js" data-key="pk_xxx" defer></script>- In your Shopify admin, go to Online Store, click the horizontal menu icon next to your theme, and choose Edit code.
- Before changing anything, duplicate the theme to keep a backup copy. Shopify recommends this itself.
- Open
layout/theme.liquid. Shopify's layout documentation describes it as the default general layout that every theme must include, and the page<head>lives there. - Paste the script tag inside the
<head>, for example just above the closing</head>tag. Keep Shopify's owncontent_for_headerline where it is. - Save.
Klickbee's install guide asks for the tag in the <head> of every tracked page. Because theme.liquid wraps your storefront pages, one edit covers them.
One caution from Shopify itself: if your code changes are incompatible with a theme update, all of them are removed. After updating or switching themes, check that the tag is still there.
How do you check that it works?
Open your store in a normal browser window, not a private window with extensions that block scripts, and click through two or three pages. Then go back to Settings, then Projects, in Klickbee. The install status card reads "Waiting for data" until the first event arrives, then "Installed" with a "Last data" line. Use "Check again" if it has not updated.
Also fill in Allowed origins on the same panel with every variant of your store domain, for example your myshopify.com address and your custom domain. Matching is strict on scheme, host and port, and a wrong origin silently stops data. If nothing shows up, the troubleshooting page lists what each response code in the Network tab means.
Why not use a Shopify custom pixel?
Shopify lets you add custom pixels under Settings, then Customer events. They are useful for forwarding Shopify's standard events to a third party, and Shopify documents them as loading in a sandbox. Its pixels overview notes that sandboxes cannot render interface elements or detect data by scraping the page.
Klickbee's script records clicks, scrolls and sessions on the page itself, which is what feeds heatmaps, replay and frustration signals. That is why the script tag in the theme is the route this guide uses. Shopify also says adding and using custom pixels is unsupported by Shopify. If you already have other tracking code in theme.liquid or in a custom pixel, remove duplicates so events are not counted twice.
What gets measured without cookies?
The Klickbee tracker sets no cookie. It keeps a random visitor id in local storage, renewed every 13 months, and a per-tab session id in session storage. The raw IP address is never stored: it is truncated before a coarse lookup of country, region and city.
From there you get page views, sessions, acquisition data, click and scroll heatmaps, funnels, goals and custom events. Session replay masks form inputs by default, and you can mask any element with the data-kb-mask attribute or the kb-mask class, which is worth doing on account and checkout-adjacent areas.
Do you still need a consent banner on Shopify?
Possibly, and the answer depends on your country and your setup. Klickbee's audience measurement is designed with the CNIL audience-measurement exemption in mind, but that exemption is French, covers audience measurement only, and other countries differ. Session replay is not part of the exemption, and in France it generally needs consent. Features that go beyond plain measurement, such as UTM and ad click id capture, also go beyond it.
If you want replay to wait for a visitor's choice, the tag supports data-require-consent="true": nothing is tracked and no ad pixel loads until your own banner calls window.klickbee.grantConsent(). Klickbee also has a free built-in consent banner, off by default, that gates the ad pixels you add in Klickbee. As the store owner, you stay responsible for your consent setup. This is information, not legal advice.
What can you do next?
Once data flows, set up a funnel from product page to order confirmation, watch heatmaps on your best-selling product page, and read how cookieless analytics works in more detail. If you run Google Ads, what a gclid is explains the click id behind your conversions.
You can try all of it on the free plan: create your Klickbee Tracking account. Pro is $9.99 per month per site, with unlimited sessions and 60-day replay.
FAQ
Is there an app or plugin for Shopify?
No. Klickbee Tracking installs with a script tag or the npm package. On Shopify, you paste the tag in the <head> of theme.liquid.
Do I need a paid Shopify plan to add the script?
Shopify's edit theme code page states no plan requirement as of November 2026. It does say a trial version of a paid theme must be purchased before you can edit its code.
Will the script disappear when I update my theme?
It can. Shopify warns that if your code changes are incompatible with a theme update, they are removed. Check the <head> after each update and keep your install snippet handy.
Does cookieless analytics remove the question of consent?
No. It depends on your country and on what you enable. Audience measurement alone may fall under an exemption in France, but session replay and ad pixels generally need consent. This is information, not legal advice.