Skip to main content
Sapt analytics runs first-party: the tracking script and the data it sends are served from a subdomain of your site instead of a shared third-party domain. You point one DNS record at Sapt, drop in one script tag, and your pageviews and events start flowing, measured more accurately and owned by you. Once events are flowing, the rest of this section covers what you do with them: resolve visitors to real people, read first-touch attribution, and push conversions back to ad platforms server-side.

Why first-party

Most analytics load from a shared vendor domain. Browsers and blockers treat that as third-party, so a large share of traffic never gets counted. Serving from your own domain changes that.
First-party makes analytics harder to block, not unblockable. DNS-level blockers and strict anti-CNAME modes can still opt out, which is the privacy-respecting outcome.

How it works

You add one CNAME record so a short subdomain of your site (for example m.yourdomain.com) resolves to Sapt’s ingest. Sapt issues the TLS certificate for it automatically. From then on:
  1. The browser loads the tracking script from your subdomain.
  2. The script sends each event back to that same subdomain, so the whole exchange is first-party.
  3. Sapt enriches each event (source, campaign, location, device) on the server and shows it in your analytics dashboard.

Set it up

1. Choose your tracking address

In the Sapt dashboard, open Project Settings and then Domains. In Connect a domain, enter the Domain you own (for example yourdomain.com) and tick First-party tracking. The Tracking address fills in as m.yourdomain.com; change it if you like. Click Save domain settings.

2. Add the DNS record

Add the record the Domains screen shows you, at your DNS provider:
That CNAME routes your subdomain to Sapt and lets Sapt issue the certificate for it. Sometimes the screen also lists a second CNAME for certificate validation: add every record it shows. If Sapt has access to your DNS (for example through Cloudflare), Apply DNS records adds them for you.
Use the values shown in your dashboard, not ones copied from this page.

3. Wait for it to go live

DNS changes take anywhere from a few minutes to a few hours. The tracking address moves from Waiting for records to Issuing certificate to Live. Click Check connection to check again.

4. Add the tracking script

Open Analytics, go to Setup, and open the Tracking step. Choose Your own domain and paste the snippet into your site’s <head>. It includes your tracking address and Project ID:
That’s it. The script auto-detects single-page-app route changes, so one tag covers most sites. Visit a page and you’ll see it appear in your analytics dashboard within a few seconds.
Not ready for DNS yet? Choose Sapt domain instead. That snippet loads from ingest.sapt.ai and works right away, but it is easier for blockers to catch. You can switch to your own domain later.

Track custom events

Once the script is loaded it exposes a small global API for events that matter to your business:
getVisitorId() returns the value of the first-party _sapt_vid cookie: a random ID with no personal data. Sending it to your backend lets you stitch anonymous visits to CRM records later. Calling identify() (or a tracked form submit) is also what moves a visitor from anonymous to identified. See Visitors & identity resolution.

Captured automatically

You don’t need to instrument these. The script records them out of the box:

Hand it to your coding agent

Let an AI coding assistant do the install. Copy the prompt below, fill in your tracking host and Project ID from the dashboard, and paste it into your assistant.
Setup prompt

Privacy notes

  • One first-party cookie, _sapt_vid, holds a random ID: no names, emails, or cross-site identifiers.
  • Geo and device details are derived on Sapt’s server from the request; nothing extra is collected in the browser.
  • Because there’s no third-party tracker, the script alone doesn’t require a consent banner. Follow the rules for your own region and any other tools on your site.

Keep going

Visitors & identity

Attribution analytics

Server-side conversions

Attribution MCP