Skip to main content
Cross-domain tracking keeps one visitor identity when people move between your domains, for example from your marketing site to your app. The Cometly pixel (the tracking script on your site) gives each visitor a unique identifier called the comet_token, and cross-domain tracking carries that token from one domain to the next. This matters because a sign-up or sale often happens on a different domain from the page the ad sent the visitor to. With the same token on both, Cometly can tie that conversion back to the ad or channel that brought the visitor in, instead of counting a brand new visitor on the second domain.

Start here

The problem. When a visitor moves between different domains (for example from your marketing website to your application), the comet_token may change. This breaks tracking continuity and makes it hard to connect what the visitor did on the marketing site with what they did in the app. The solution. Turn on cross-domain tracking, either automatically or with a manual script. When a visitor clicks a button or link that leads to another of your domains, the comet_token is passed along, so the same token persists for the whole session. How it works. For example:
  • A visitor lands on cometly.com.
  • They click a link that takes them to app.cometly.com.
  • The comet_token from cometly.com is passed to app.cometly.com, so both domains share the same token.
You have two options for setting up cross-domain tracking:

Automatic cross-domain tracking setup

All of these steps happen in Setup > Install the Cometly pixel.
1

Add your domains

Under Add domains, add every domain and subdomain where the pixel is installed.
2

Turn on Automatic Cross Domain Tracking

Under Pixel options, turn on Automatic Cross Domain Tracking. The switch is disabled until you have added at least one domain.
The Pixel options section in Setup with the Automatic Cross Domain Tracking switch turned on and outlined, above the First Party Domain Tracking row.
3

Install the updated pixel

Turning the option on changes your tracking script: the list of your domains is added to it. Copy the script again from Install the pixel and replace the one on your site.Add the pixel to the <head> of every marketing page (including blogs and academies). If you are setting up tracking for a SaaS company, add the pixel to your app’s login and registration pages only, not the entire app. See Pixel setup for SaaS companies.
4

Verify your domains

Under Verify your pixel, click Verify for each domain to confirm the pixel is detected.
Your tracking script also changes whenever you add or delete a domain while this option is on. Cometly shows the message “Your tracking script has changed - please update it on your website.” each time. Update the script on your site when you see it.
What this does
  • Automatic tracking: The comet_token is passed between the domains you added.
  • One visitor journey: A visitor is recognized as the same person across your websites, instead of each domain treating them as a brand new visitor.

Manual cross-domain tracking setup

If you run into issues with the automatic option, or prefer to configure it yourself, install a domain override script on your marketing site. When a visitor clicks a button or link that leads to your app (for example app.cometly.com), the script links the comet_token from the marketing site to the app domain, so the same token is used for the whole session.
  • Only install the override script on your marketing site.
  • Do not install it on the app domain (app.cometly.com) or any other domain.
  • Place it above the Cometly pixel in the <head> section.
  • Replace the example domains and the example pixel with your own. Do not paste the examples as they are.

Single domain example

If you are tracking between your marketing site and a single app domain (for example app.cometly.com), use the following script:
Full example, with the override script above the pixel:

Multiple domain example (optional)

If you are tracking several domains (for example app.cometly.com, academy.cometly.com and go.cometly.com), list them all:
Full example for multiple domains:

Verify cross-domain tracking

1

Check the link for cometly_token_override

  1. On your marketing site, hover over a button or link that leads to one of your other domains (for example app.cometly.com).
  2. Check that the URL includes a parameter like this:
This confirms that the comet_token from the marketing site is being passed to the app domain.
2

Compare the comet_token in developer tools

On the marketing site:
  1. Right-click and select Inspect.
  2. Open the Network tab.
  3. In the search bar, type comet to filter the network requests.
  4. Look for Fetch/XHR requests and click the relevant one.
  5. Open the Payload section and find the comet_token.
  6. Note the last 4 characters of the comet_token.
Then follow the link to your app domain (for example app.cometly.com) and repeat the same steps there. Do the same for any additional domains.

Check it worked

If the last 4 characters of the comet_token match on every domain, cross-domain tracking is working correctly.

Frequently asked questions

What happens if I don’t set up cross-domain tracking?

Each of your domains treats the visitor as a brand new visitor, so what they did on your marketing site is not connected to what they do on your app. For SaaS companies and businesses with several domains, it can also lead to events with no source in your reports. See Understanding No Source in reports.

Will my own domains show up as referral sources?

No. When you add a domain under Add domains, Cometly also adds it to that space’s referrer exclusion list, so clicks from one of your domains to another (for example from cometly.com to app.cometly.com) are left out of your referral reports. To exclude more domains, see Exclude referral domains.

Do I need anything else if my app uses Google or social login?

Yes. If people sign up through Google or another social login (OAuth), you need a small extra setup so Cometly can connect the sign-up back to the ad that brought them in. Follow Track OAuth sign-ups.

Next steps

Still have questions or need a hand? We’re happy to help. Reach our team at support@cometly.com.