TrueMetriks documentation: Cross-domain tracking with Shopify
https://docs.truemetriks.com/platform-installs/shopify-cross-domain/
Generated from the TrueMetriks documentation. Paste the whole of this
file into ChatGPT, Claude, Gemini, Cursor or any other AI.
I use TrueMetriks, a server-side tracking and conversion attribution platform.
It tracks my website visitors, ties every sale back to the ad that produced it,
and sends those conversions back to my ad platforms.
Help me with this specific task: Cross-domain tracking with Shopify.
Add the small theme snippet Shopify needs for cross-domain tracking. Your Custom Pixel keeps sending events; this snippet only does the handoff between domains.
HOW TO GUIDE ME
- This file has three parts: THE GUIDE is today's task, BACKGROUND is a
prerequisite to confirm with me before you start THE GUIDE, not optional
reading, and LINK MAP is the only place a real link comes from.
- Ask me ONE thing at a time and wait for my answer before moving on.
- At the start of every step, ask me: "do you want the written steps, or the
video?" If I pick the video, give me the exact link from the LINK MAP at the
bottom and wait until I tell you I have watched it. If I pick the written
steps, give them to me from this file.
- Only ever give me links that appear in the LINK MAP below. Never invent a
URL, never guess an anchor, and if I ask for something that has no link
here, say so and point me at https://docs.truemetriks.com/ instead.
- Never ask me for my password, my API key, my MCP key, or any card details.
You are reading me the steps; I am the one clicking in my own account.
- Confirm each step worked before starting the next one.
- Keep it short. I am doing this while looking at my screen, not reading an
essay.
- Everything you need is in this file. You do not need to browse the web.
===============================================================================
THE GUIDE: Cross-domain tracking with Shopify
https://docs.truemetriks.com/platform-installs/shopify-cross-domain/
===============================================================================
If your funnel uses Shopify together with a second, separate domain, for example an advertorial or landing page domain that sends visitors on to your Shopify store, Shopify needs one small extra step beyond the [Custom Pixel install](https://docs.truemetriks.com/platform-installs/shopify/). This page covers only that extra step; read [Cross-domain tracking](https://docs.truemetriks.com/features/cross-domain-tracking/) first for what the feature does and how to turn it on.
**Every Shopify store in a cross-domain funnel should have this snippet.** It is one line, it covers both directions, and it does not depend on anything else being up to date.
## Why Shopify is the one special case
A Shopify Custom Pixel runs inside a locked sandbox. It has no `document.cookie` access and no DOM access, so it cannot add anything to a link a visitor is about to click, and it cannot write a cookie on the store's own domain. That is a restriction Shopify puts on every Custom Pixel, not something TrueMetriks chose. It means the pixel can report events, but it can never be the thing that hands a visitor off between two domains.
So Shopify needs a second, small snippet, pasted into your theme, that does only the handoff. Your existing Custom Pixel does not change at all, and keeps sending pageview, checkout, and order events exactly as it does today.
## Get the snippet
1. Make sure [Cross-domain tracking](https://docs.truemetriks.com/features/cross-domain-tracking/) is turned on for the site, in **Settings > Websites > your site > Tracking**, with your other domain listed and saved.
2. Staying on the **Tracking** tab, pick the **Shopify** card.
3. Below the Custom Pixel code you will see a section titled **"Click here if you're doing cross-domain tracking with Shopify"**. It only appears once cross-domain tracking is switched on for the site; if you do not see it, go back and turn the toggle on first.
4. Open it and click **Copy** on the one-line snippet inside. It looks like this:
```html
```
Your own snippet will have your site's actual tracking host in place of `t.yourdomain.com`.
## Install it in your theme
1. In Shopify Admin, go to **Online Store > Themes**.
2. On your **live** theme, click **Edit code**. A draft theme is the single most common reason this ends up doing nothing.
3. Open **`theme.liquid`**.
4. Paste the script tag on its own line, just before the closing `` tag.
5. Click **Save**.
That is the whole install. It runs on every storefront page the theme renders. Shopify's own checkout pages cannot be edited and do not need this snippet; your Custom Pixel's events already pick up the visitor id the theme snippet sets once the visitor is on your storefront.
## Turn password protection off
**A password-protected Shopify store breaks cross-domain tracking**, snippet or no snippet. Shopify redirects the visitor to `/password` and drops the query string on the way, which takes the handoff with it.
Check it in Shopify Admin under **Online Store > Preferences**. This catches people out on development stores in particular, where password protection is locked on until the store is on a paid plan. If you are testing a cross-domain funnel against a development store, that is the first thing to rule out.
## What it does, and does not, do
- It adopts an incoming handoff from another listed domain, so the visitor keeps the same identity when they land on your Shopify store.
- It tags outgoing links to your other listed domain or domains, so a visitor leaving your Shopify store for another domain in your funnel carries the handoff with them.
- It fires no events of its own. Your Custom Pixel is the only thing sending events; this snippet only sets up the identity that the pixel then reports.
### If your store is only ever the destination
There is one case where the theme snippet is not strictly required, and it is worth knowing about even though the advice does not change.
The current Custom Pixel reports the page a visitor came from. So when someone lands on **another** domain first and then clicks through **into** your Shopify store, the store can pick the handoff up from that alone, with no theme snippet. Your store as the **destination** works either way.
The other direction does not, and never will. When a visitor starts **on** your Shopify store and clicks **out** to another domain in your funnel, something has to tag that outgoing link, and only unsandboxed code can do that. That is the theme snippet's whole job.
**Two reasons to install it anyway, which is why this is a note and not a recommendation.**
1. **It only applies once you have re-copied your pixel.** The Custom Pixel is code you pasted into Shopify, not a hosted script we can update for you. If you pasted yours before this behaviour shipped, your store is still running the old version and does not report the referring page at all. Re-copy your Custom Pixel from the **Tracking** tab's Shopify card and paste it over the old one in Shopify Admin to pick it up.
2. **It is one line and it covers both directions**, so it keeps working the day you add a second step that leaves the store, and it does not depend on when anybody last re-pasted anything.
## Check it worked
There is no status badge for this, on purpose. Run the two-minute Sessions test from the main guide: [Test it yourself](https://docs.truemetriks.com/features/cross-domain-tracking/#test-it-yourself). One session containing pages from both your Shopify store and your other domain means it is working.
If it still shows as two sessions, in order: confirm the script tag is saved in `theme.liquid` on the **live** theme, confirm password protection is off, then work through [Cross-domain tracking troubleshooting](https://docs.truemetriks.com/features/cross-domain-tracking/#troubleshooting).
===============================================================================
BACKGROUND: Cross-domain tracking
https://docs.truemetriks.com/features/cross-domain-tracking/
===============================================================================
Read this first: this is not a way to get a second domain for free
TrueMetriks is priced per domain. Cross-domain tracking exists to join domains that are all part of one funnel, so a single customer's journey across them stays one journey. It is not a way to track a second, unrelated website without paying for it.
What it is for. A funnel that genuinely has to span two domains. The common case is an advertorial or review page on its own domain that sends readers to your store on another domain, kept separate on purpose so the recommendation does not read as you recommending yourself. Same offer, same customer, one journey, two domains.
What it is not for. Tracking a different business, brand or offer that happens to be yours. That is a second site, and it needs its own subscription like any other domain you track.
We do enforce this. Accounts found using cross-domain tracking to avoid paying for a domain are banned, with no refund. If you are unsure which side of the line you are on, ask us before you set it up, not after. See why extra domains are charged separately.
If you run an ad to one domain and that page sends the visitor to a second domain you own, those used to be two separate visitors. Cross-domain tracking keeps them as one person.
## The problem this solves
The browser scopes the cookie that identifies a visitor to a single domain, and JavaScript cannot get around that. So without this, someone who clicks a Facebook ad to `advertorial.com` and buys at `store.com` looks like two different people:
- The purchase is credited to a stranger, not to the visitor who clicked the ad.
- The journey becomes two sessions, and the second is attributed to `advertorial.com` as a referral.
- The conversion sent back to Facebook, Google or TikTok carries no click id, so the ad platform gets no credit either.
Turn it on and you get one session across both domains, credit to the ad that started the journey, and the click id delivered with the sale.
## When you need this (and when you do not)
Only for two **separate domains** you own, like `advertorial.com` and `store.com`.
It is **not** for subdomains or paths of your own domain. `shop.example.com` and `example.com/checkout` are already one site and already one visitor. The dashboard refuses those anyway: "This is already part of this site, so it is already tracked."
## Plan requirement
**Growth and Unlimited.** On Starter the section is locked, with "Available on the Growth and Unlimited plans." in place of the toggle.
The extra domain is not a separate allowance: its pageviews count against your normal limit.
**Each extra domain in the funnel is a paid add-on.** Growth includes none and Unlimited includes one; every domain after that is $150 a month or $800 a year, added as a line on the subscription you already have. For what that covers and how it lands on your bill, see [why extra domains are charged separately](https://docs.truemetriks.com/billing/why-extra-domains-are-charged-separately/).
## Where to find it
Open **Settings**, pick your site under **Websites**, then the **Tracking** tab. The **Cross-domain tracking** section sits between **Site platform** and **Ad integrations**.
Older notes that say Site Settings are out of date; it moved to the Tracking tab. There is deliberately **no status pill** here, because the proof is the Sessions view, not a badge.
## Turn it on
It is off by default.
1. Turn on **Track visitors across my other domains**. The **Domains in this funnel** panel appears.
2. Your own domain is already there, greyed and marked **Primary**.
3. Click **+ Add another domain** and type it **bare**: `store.com`, not `https://store.com/`. A leading `www.` is stripped for you.
4. Add a row per domain your funnel uses. Order does not matter and you do not need a row per direction.
5. Click **Save changes**.
Past three extra domains the list pages three rows at a time, with **Previous** / **Next**; the **Primary** row stays visible on every page.
A domain someone else owns is accepted without complaint. Listing a domain does nothing until your snippet is running on it.
## The one hard requirement: your snippet on every domain
**The same snippet from the Tracking tab has to be on every domain you list.** This is by far the most common reason it "does not work".
Nothing new to install, no second site, no second CNAME: the exact snippet you already have, whatever each domain is built on. If you are unsure, open each domain and view source. The [tracking code install guide](https://docs.truemetriks.com/getting-started/install-first-tracker/) covers where it goes.
Shopify is the one exception, because a Custom Pixel cannot tag an outgoing link. See [Cross-domain tracking with Shopify](https://docs.truemetriks.com/platform-installs/shopify-cross-domain/) for the extra line it needs.
## Both directions work
There is no "from" and "to". List the domains in any order and a visitor can travel either way, or back and forth, and stay one person.
## Test it yourself
Two minutes, and worth doing once.
1. Open your first domain with a fake click id, for example `https://advertorial.com/?fbclid=my_test_1`.
2. Click a real link on the page through to your second domain, not a bookmark or a typed URL.
3. Browse a page there, and buy something if you can.
4. Open [Sessions](https://docs.truemetriks.com/dashboard/sessions/).
**One session containing pages from both domains, still carrying the source it started with** means it works.
It is not working if you see **two separate sessions**, or **one session whose source is a Referral from your own other domain**. Both send you back to the snippet check or the saved domain list.
## The `_tmid` parameter
Clicking from one listed domain to another flashes a `?_tmid=...` parameter in the address bar for a split second. That is the handoff, and it is stripped as soon as the second domain reads it. It never reaches your reports and needs excluding nowhere.
If it **stays** in the address bar, the second domain did not accept it: the snippet is missing there, or that domain is not in the saved list.
## Limits worth knowing
- Ordinary links and form submissions carry the handoff. `window.open`, meta refreshes and server-side redirects do not.
- A redirector or shortener that drops the query string loses the handoff.
- **A password-protected Shopify store breaks it.** Shopify redirects to `/password` and drops the query string. Easy to hit on a development store, where the password is locked on until the store is on a paid plan.
- Journeys already split before you turned it on are not repaired retroactively.
- Use one address form per domain, either `www.` or not, rather than mixing them.
- Internationalised domains have to be entered in punycode (`xn--`) form.
## Troubleshooting
**I still see two sessions.** The snippet is missing from the second domain, or that domain is not in the saved list. Check both, in that order.
**The source shows as a Referral from my own other domain.** That domain is not in the saved list, so the visit was treated as ordinary referral traffic. Add it and save.
**The `_tmid` parameter stays in my address bar.** Same two causes: no snippet on the destination domain, or it is not in the saved list.
**My Shopify store is password protected.** Turn the password off; Shopify drops the query string on its redirect to `/password`. See [Cross-domain tracking with Shopify](https://docs.truemetriks.com/platform-installs/shopify-cross-domain/).
**I turned it off. Did I lose anything?** No. Your domains are kept and come back when you turn it on again.
If none of that is it, [Common issues](https://docs.truemetriks.com/troubleshooting/common-issues/) has the general tracking-not-firing checklist.
===============================================================================
BACKGROUND: Test your integration
https://docs.truemetriks.com/platform-installs/test-your-integration/
===============================================================================
## Video walkthrough
VIDEO: How to test your TrueMetriks integration -> https://docs.truemetriks.com/platform-installs/test-your-integration/#video-walkthrough
## Quick checklist
1. **Open your live site in an incognito window.** This skips any admin-tracking exclusions and looks like a real visitor.
2. **Browse a few pages.** Click around two or three product or landing pages.
3. **Submit a test form** if you have one (Contact Form 7, WPForms, Gravity Forms, [Typeform](https://docs.truemetriks.com/form-integrations/typeform/), [Calendly](https://docs.truemetriks.com/form-integrations/calendly/), etc).
4. **Place a test order** if you run a store. Most platforms support a sandbox / test mode for this. Use a discount code if you want the order total to be small.
## Where to look in your dashboard
Open your TrueMetriks dashboard and click the **green live counter** in the top right of the page header. It opens a tray of every visitor active in the past five minutes. If your incognito browse appears there in real time, the tracker is firing correctly.
## Still not working?
Most issues are listed on the [Troubleshooting](https://docs.truemetriks.com/troubleshooting/common-issues/) page - check there first for common causes (CNAME not propagated, tracker blocked by an ad blocker, webhook URL stale, etc.).
If Troubleshooting does not solve it, [contact us](https://truemetriks.com/contact) and we will help you debug it.
===============================================================================
LINK MAP
Use these exact URLs. Anything ending in a # anchor opens on that section
or that video. Nothing else is a valid link. Never invent a URL and never
guess an anchor.
Cross-domain tracking with Shopify
The guide ................................... https://docs.truemetriks.com/platform-installs/shopify-cross-domain/
Why Shopify is the one special case ......... https://docs.truemetriks.com/platform-installs/shopify-cross-domain/#why-shopify-is-the-one-special-case
Get the snippet ............................. https://docs.truemetriks.com/platform-installs/shopify-cross-domain/#get-the-snippet
Install it in your theme .................... https://docs.truemetriks.com/platform-installs/shopify-cross-domain/#install-it-in-your-theme
Turn password protection off ................ https://docs.truemetriks.com/platform-installs/shopify-cross-domain/#turn-password-protection-off
What it does, and does not, do .............. https://docs.truemetriks.com/platform-installs/shopify-cross-domain/#what-it-does-and-does-not-do
If your store is only ever the destination .. https://docs.truemetriks.com/platform-installs/shopify-cross-domain/#if-your-store-is-only-ever-the-destination
Check it worked ............................. https://docs.truemetriks.com/platform-installs/shopify-cross-domain/#check-it-worked
Cross-domain tracking
The guide ................................... https://docs.truemetriks.com/features/cross-domain-tracking/
The problem this solves ..................... https://docs.truemetriks.com/features/cross-domain-tracking/#the-problem-this-solves
When you need this (and when you do not) .... https://docs.truemetriks.com/features/cross-domain-tracking/#when-you-need-this-and-when-you-do-not
Plan requirement ............................ https://docs.truemetriks.com/features/cross-domain-tracking/#plan-requirement
Where to find it ............................ https://docs.truemetriks.com/features/cross-domain-tracking/#where-to-find-it
Turn it on .................................. https://docs.truemetriks.com/features/cross-domain-tracking/#turn-it-on
The one hard requirement: your snippet on every domain
https://docs.truemetriks.com/features/cross-domain-tracking/#the-one-hard-requirement-your-snippet-on-every-domain
Both directions work ........................ https://docs.truemetriks.com/features/cross-domain-tracking/#both-directions-work
Test it yourself ............................ https://docs.truemetriks.com/features/cross-domain-tracking/#test-it-yourself
The _tmid parameter ......................... https://docs.truemetriks.com/features/cross-domain-tracking/#the-_tmid-parameter
Limits worth knowing ........................ https://docs.truemetriks.com/features/cross-domain-tracking/#limits-worth-knowing
Troubleshooting ............................. https://docs.truemetriks.com/features/cross-domain-tracking/#troubleshooting
Test your integration
The guide ................................... https://docs.truemetriks.com/platform-installs/test-your-integration/
Video walkthrough ........................... https://docs.truemetriks.com/platform-installs/test-your-integration/#video-walkthrough
Quick checklist ............................. https://docs.truemetriks.com/platform-installs/test-your-integration/#quick-checklist
Where to look in your dashboard ............. https://docs.truemetriks.com/platform-installs/test-your-integration/#where-to-look-in-your-dashboard
Still not working? .......................... https://docs.truemetriks.com/platform-installs/test-your-integration/#still-not-working
VIDEO, How to test your TrueMetriks integration
https://docs.truemetriks.com/platform-installs/test-your-integration/#video-walkthrough