Track sales and UTM campaigns when checkout is on another domain
Ads and links bring people to one domain, but the payment often finishes somewhere else. Three small steps make sure every sale still counts for the campaign that brought it.
When you need this
- Your landing page is on
example.comand the checkout is on another domain, such asexample-shop.comor a platform that shows its thank-you page on your domain. - Your marketing site and your web app live on different domains and people pay inside the app.
- One brand sends buyers to another brand's website to finish the purchase.
Subdomains already count: if example.com is in your website's domains, shop.example.com and app.example.com are included. You only need this guide when the payment finishes on a different domain.
Why the campaign can get lost
FastAnalytics does not use cookies. It recognises a visitor for one day with an anonymous identifier made from the connection and the browser. Each purchase is attributed to how that visitor arrived that same day: channel, source, UTM campaign and entry page.
When the payment finishes on another domain, the visitor may switch from Wi-Fi to mobile data, log in from another browser or pay after midnight (UTC). Then we no longer recognise them: the sale still counts, but as if they had arrived with no campaign.
The 3 steps
- Add the payment domain to your website's domains.
- Carry the campaign from the landing page to the thank-you page.
- Send the purchase with its campaign from the thank-you page.
Step 1: add the payment domain
In the dashboard, open My websites › Manage › Name and domains and add the domain where the thank-you page lives, separated by a comma. For example: example.com, example-shop.com. Save. The install code does not change.
This step is required. For your security we only accept data from the domains on that list: a purchase sent from a domain that is not listed is discarded.
Step 2: carry the campaign to the thank-you page
The campaign is in the address of the page where the visitor lands (?utm_source=meta&utm_medium=paid_social&utm_campaign=summer). Keep those three values and take them to the thank-you page. Use whatever fits your checkout:
- In the link of the buy button. Add the UTM parameters to the checkout link (example below). Simple and works with most checkouts that keep the URL parameters.
- In the order. Most payment platforms let you save extra data with the order (metadata, custom fields or note attributes). Save the three values there and print them on the thank-you page.
- On your server. If the visitor logs in or goes through several screens, save them in the session or in a first-party cookie of your own checkout (your cookie, under your own cookie policy; FastAnalytics never sets one).
Example: copy the visit's UTM parameters into every link to your checkout domain.
document.querySelectorAll('a[href^="https://example-shop.com"]').forEach(function (a) {
var from = new URLSearchParams(location.search), url = new URL(a.href);
['utm_source', 'utm_medium', 'utm_campaign'].forEach(function (k) {
if (from.get(k)) url.searchParams.set(k, from.get(k));
});
a.href = url.toString();
});Step 3: send the purchase with its campaign
On the thank-you page, with the FastAnalytics script installed, send the purchase as usual and add the campaign:
hm('purchase', {
revenue: 49.90,
order: 'A1234',
utm_source: 'meta',
utm_medium: 'paid_social',
utm_campaign: 'summer'
});Or without JavaScript, with a tag anywhere on the page:
<div data-hm-purchase="49.90" data-hm-order="A1234"
data-hm-utm-source="meta" data-hm-utm-medium="paid_social" data-hm-utm-campaign="summer"
hidden></div>| In hm() | In the tag | What it is | Required |
|---|---|---|---|
revenue | data-hm-purchase | Sale amount. 49.90, 49,90 € and €1,234.56 all work. | Yes |
order | data-hm-order | Order number, so a reload does not count the sale twice. Up to 64 characters. | Recommended |
utm_source | data-hm-utm-source | Where the visitor came from: meta, google, newsletter. | No |
utm_medium | data-hm-utm-medium | Type of traffic: paid_social, cpc, email. | No |
utm_campaign | data-hm-utm-campaign | Campaign name, as in the ad link. | No |
site | data-hm-site | Code of the website that should receive the sale. Only when the page already has the script of another of your websites (see below). | No |
Remember that the install code loads the script with defer. If you call hm() inline before it loads, keep the one-line queue that the dashboard's install code already includes. The tag needs nothing else.
When the thank-you page measures another website
A page loads one FastAnalytics script with one website code. If the thank-you page belongs to another of your websites (it already has data-site or data-id of that one), add site with the code of the website where the visitor landed. Only that event goes there; the page keeps measuring its own website. You find the code in My websites › Manage, in the install code.
hm('purchase', { revenue: 49.90, order: 'A1234', utm_source: 'meta', utm_campaign: 'summer', site: 'FA-XXXXXXXXXX' });The domain of the thank-you page must be in the domains of the website in site (step 1).
What happens when the purchase arrives
- We recognise the visitor (same connection and browser that day): the sale goes to their real visit, as always. The campaign you sent does not replace it.
- We don't recognise them: before the sale we record their entry with the campaign you sent and the channel that goes with it. From there everything reads it as a normal visit.
- No campaign sent: nothing changes, it works exactly as before.
Where you see it:
- Revenue: by channel, source, UTM campaign and entry page.
- UTM campaigns › Spend and return: the sale adds to that campaign's revenue, CPA and ROAS.
- Goals and Funnels: if the purchase event is a goal or a funnel step, it counts for that campaign.
- Journeys: the visitor's path shows the entry with the campaign and then the purchase.
When we have to record the entry, that visitor adds one visit to the website's statistics. It is correct: it is a real person who arrived and bought.
Your sales funnel across two domains
A funnel like product page → checkout → purchase works across domains when the steps are measured by the same FastAnalytics website. If you also own the checkout pages, install the same website code there (and keep both domains in the list): their pages and the purchase join the same funnel. If you can only touch the thank-you page, use the purchase event as the last step: Funnels and Goals accept events as steps.
How to test it
- Add the payment domain to the website (step 1).
- Open your landing page with
?utm_source=test&utm_medium=test&utm_campaign=fa_test. - On a page of the payment domain, from another connection (for example, your phone with mobile data), run in the console:
hm('purchase', { revenue: 1, order: 'TEST-1', utm_source: 'test', utm_campaign: 'fa_test' }). - In Revenue, today, the 1 € sale appears under the campaign
fa_test. Run it again with the sameorder: it does not count twice.
Privacy
- FastAnalytics sets no cookies and stores nothing in the browser. Carrying the campaign between domains is done by your site, with the method you choose in step 2.
- UTM values describe a campaign, not a person. Never put emails, names or IDs in them: our script and our server remove emails and long numbers anyway.
- The order number is never stored: only an encrypted fingerprint for 30 days, to detect repeats.
Technical summary (for developers and AI assistants)
- Script:
https://e.fastanalytics.site/e.jsversion 2.4 or later. Callhm(eventName, { revenue, order, utm_source, utm_medium, utm_campaign, site }); every field is optional exceptrevenuefor a sale. - Tag:
data-hm-purchase(amount) withdata-hm-order,data-hm-utm-source,data-hm-utm-medium,data-hm-utm-campaign,data-hm-siteanddata-hm-name(event name, defaultpurchase). Sent once on page load. The samedata-hm-utm-*anddata-hm-siteattributes work on clickable elements withdata-hm. revenue: greater than 0 and less than 10,000,000.order: up to 64 characters, deduplicated per website for 30 days.- UTM values are stored lowercase, up to 64 characters for source and medium and 96 for campaign. Values with an email are dropped and runs of 6 or more digits become
#.utm_contentandutm_termare not used. site: the website's short code or its public codeFA-XXXXXXXXXX. The page's domain (from its Origin or Referer) must be in that website's domains, or the event is discarded.- Attribution: if that day's anonymous visitor ID already has a page view on that website, the sale is attributed to it. Otherwise an entry page view is recorded with the event's path and UTM values, followed by the event.
- Send it from the visitor's browser (the thank-you page). The visitor is recognised by their connection and browser, so a request from your server would never match them and is discarded.
FAQ
Does it work with Stripe Checkout or other hosted payment pages?
Yes, if after paying the visitor comes back to a page on your domain (the success or thank-you URL). Put the tag or the hm() call there, with the campaign saved in the order or in the success link. If the last page belongs to the payment provider and you cannot add code to it, it is not possible yet.
Do I need this if the checkout is on a subdomain?
No. Subdomains of a listed domain already count and the same visitor is usually recognised. You can still send the campaign with the purchase as a backup.
What if I send a campaign but the visitor is recognised?
The real visit of that day wins, because it is what we actually measured. The campaign you send is only used when we cannot recognise the visitor.