Skip to main content
Web Analytics

First-party tracking

Recognise returning visitors and, optionally, collect analytics through your own domain.

Written By David

Last updated 9 days ago

What's in it for you

Cromojo shows you which ads, posts and searches bring you sales. To do that, it needs to recognise a visitor who comes back.

Here's an example. A shopper clicks your Instagram ad on Monday, looks around, and leaves. On Friday, the same shopper comes back by typing your address and buys.

  • With first-party tracking, Cromojo knows it's the same person. The Friday sale is credited to your Instagram ad, so you can see the ad paid off.

  • Without it, Monday's visitor and Friday's buyer look like two strangers. The sale is credited to "Direct", and your ad looks like it sold nothing.

First-party tracking is included on Pro plans and above. You'll find it in Settings > Analytics, under Install Analytics Tracking script, and on the Install the Cromojo script step when you add a website. It has two settings:

  1. Tracking method: should Cromojo recognise visitors who come back? This takes a minute. Most websites keep the recommended option.

  2. Custom tracking domain (optional): helps Cromojo recognise returning visitors for longer. This takes about 10 minutes.

Choose these before you copy your script. Both are written into it. If you change them later, copy the new script and replace the old one on your website.

New websites start on Returning visitor tracking (opt-out). Websites added earlier stay on Cookie-free only until you change it.

First-party tracking in Site Settings, Analytics: the three Returning visitor tracking options and the optional Custom tracking domain

How it works, in plain words

The Cromojo script on your website counts each visit. To recognise someone who comes back, it gives their browser a random number, a bit like a cloakroom ticket. The ticket holds no name and no email. When the visitor returns, their browser shows the ticket, and Cromojo knows it's the same visitor.

Browsers decide how long to keep that ticket. They trust tickets from the website you're visiting more than tickets from another company. That's where the custom tracking domain comes in:

  • Without a custom tracking domain, the ticket comes from Cromojo's address, app.cromojo.com. To the browser, that's another company. Some browsers throw such tickets away quickly, so returning visitors look new.

  • With a custom tracking domain, the ticket comes from an address on your own website, such as stats.yourshop.com. To the browser, it's part of your website, so it keeps the ticket for longer.

For the technical reader: the script stores a random ID in the browser's storage on your site, and our server sets a cookie with the same ID. A custom tracking domain makes that a first-party cookie set by the server, instead of a third-party one.

Pick your tracking method

Not sure which to choose?

  • You use a cookie banner and want Cromojo to follow it: pick opt-in.

  • You don't want a cookie banner for your analytics: pick Cookie-free only.

  • Otherwise: keep the recommended opt-out, after checking it's allowed where your visitors live.

Returning visitor tracking (opt-out). (Recommended)

  • What happens: every visitor is recognised when they come back, unless they opt out.

  • Good for: the most accurate view of which ads and sources bring sales.

  • Keep in mind: whether this is allowed depends on where your visitors live. You are responsible for having a lawful basis for it.

Returning visitor tracking (opt-in)

  • What happens: visitors are recognised only after they click Accept on your cookie banner.

  • Good for: websites that ask for consent before any tracking.

  • Keep in mind: you need a cookie banner, or this option does nothing. Visitors who ignore or decline the banner are counted cookie-free.

Cookie-free only

  • What happens: every visit is counted, but nothing is stored on the visitor's device, and the visit is forgotten at the end of the day.

  • Good for: no cookie banner needed for your analytics.

  • Keep in mind: a shopper who comes back on another day looks like a new person, so sales after a second visit are credited to "Direct".

What "counted cookie-free" means: the visit still shows in your numbers, with its pages, source and country. Cromojo just can't tell it's the same person on another day.

With every option, visitors whose browser asks websites not to track them aren't counted.

Click More info on any option to see how it works.

Connecting your cookie banner (opt-in)

Cromojo reads consent automatically from Google Consent Mode (analytics_storage) and from IAB TCF banners. With another banner, tell Cromojo when the visitor decides:

  • When the visitor accepts: window.CRMJ.setConsent('granted')

  • When the visitor declines: window.CRMJ.setConsent('denied')

Custom tracking domain (First-party tracking)

A custom tracking domain is an address on your own website, such as stats.yourshop.com, that Cromojo uses instead of its own address, app.cromojo.com.

Without

With

Your script loads from

app.cromojo.com

stats.yourshop.com

Visits are sent to

app.cromojo.com

stats.yourshop.com

How the browser sees it

Another company

Part of your website

Returning visitors recognised for

Often shorter, depending on the browser

Up to 400 days

How long a visitor is recognised is always up to their browser. Safari, for example, may keep the ticket for only 7 days even with a custom tracking domain.

Is it worth it? Yes, if you run ads, or if people often visit a few times before they buy. It's optional, and your tracking works without it. It's available when one of the two Returning visitor tracking options is picked.

What it doesn't do: it doesn't make tracking work without the script, it doesn't get past every ad blocker, and it doesn't change what you need to ask your visitors' consent for.

What you need: access to the place where your domain is managed (such as Cloudflare, GoDaddy or Shopify), and about 10 minutes.

Step 1: Open the setup

Under Custom tracking domain (First-party tracking), click Set it up. Cromojo fills in stats as the first part of the domain. You can change it.

Step 2: Add the DNS record

Go to wherever you manage your domain (your registrar, your DNS provider or Cloudflare) and add the record Cromojo shows you:

Type

CNAME

Name

stats

Points to

custom.cromojo.com

Copy the exact values from Cromojo, not from this example.

Never added a DNS record before? Follow Set up your custom tracking domain, step by step. It shows where to click at Cloudflare, GoDaddy, Namecheap, Hostinger, Squarespace, Shopify and Wix.

  • Some providers want the full name, for example stats.yourdomain.com.

  • On Cloudflare, set the record to DNS only (grey cloud). A proxied record (orange cloud) stops the setup.

The Custom tracking domain setup: the domain field, the CNAME record to add, then verify, save, certificate and snippet

Step 3: Verify, then save

Click Verify. When Cromojo finds the record, you see a green line saying the domain is pointing at us. Then click Save.

DNS changes can take a few hours to show. If Verify cannot see the record yet, try again later. If the record points somewhere else, Cromojo tells you where it points.

The record is verified: the first two steps are ticked and Save the domain is next

Step 4: We issue the security certificate

Nothing to do here. Cromojo confirms the DNS record and issues the security certificate for your domain automatically, usually within a few minutes. You can leave the page.

Your current snippet keeps working in the meantime, so no visits are lost.

The custom tracking domain box: DNS record confirmed, security certificate being issued

Step 5: Replace your snippet

When the domain is live, the box shows Active and we email you a link to your new snippet.

The custom tracking domain box once live: both steps ticked and the badge says Active
The email Cromojo sends when the custom tracking domain is live, with a Get your new snippet button

Copy the snippet from the Analytics script section and replace the old one in the <head> of your website. The new snippet contains your domain twice: in src, where the script loads from, and in data-proxy, where events are sent.

The Analytics script section with the new snippet, including data-proxy set to the custom tracking domain

Until you replace it, events keep going to the Cromojo address. Nothing is lost, but some browsers may forget returning visitors sooner.

Changing or removing the domain

To change the domain, click Remove on the custom tracking domain box, then set up the new one. Choosing Cookie-free only also removes it. Both ask you to confirm first.

If the domain was live, tracking on it stops straight away. Copy the new snippet and replace the old one on your website.

After you change these settings

Cromojo shows "Saved. Your analytics script has changed." Copy the new snippet from the Analytics script section and replace the old one on your website. Until you do, the new setting has no effect.

Troubleshooting

Stuck on "Waiting for DNS". Check that the record name and the Points to value match what Cromojo shows. On Cloudflare, make sure the record is set to DNS only.

Stuck on "Issuing certificate" for more than an hour. Check whether your domain has CAA records. If it does, they must allow letsencrypt.org, pki.goog and ssl.com. If that is fine, contact support@cromojo.com.

"Needs attention". The reason is shown under the badge. Check that the DNS record still exists and still matches. We keep checking automatically.

Related articles