Install the tracking snippet
Add the Spectry snippet to your site's <head> so it starts collecting data.
Spectry collects everything from one small async script. Add it to the <head> of every page of your site, ideally as high up as possible.
Copy your snippet
Open the Sites screen, click the ⋯ menu on your site and choose Install. (The same dialog appears automatically right after you create a site.) Copy the snippet — it already contains your Site ID. It looks like this:
<script async>
(function(s, p, e, c, t, r, y) {
y = 'YOUR_SITE_ID';
t = p.createElement(e);
r = p.getElementsByTagName(e)[0];
t.async = 1;
t.src = c;
t.id = 'spectry-script';
t.dataset.siteId = y;
r.parentNode.insertBefore(t, r);
})(window, document, 'script', 'https://cdn.spectry.io/spectry.js?id=YOUR_SITE_ID');
</script>
Replace YOUR_SITE_ID with your site's ID.
Always copy the exact snippet from your dashboard — it already contains the correct Site ID and any write key or consent-provider wrapping you selected, so there's nothing to fill in by hand.
Adding a write key (optional)
A write key signs your tracking requests so only your authorised pages can send data. If you use one, the dashboard adds a single line to the snippet:
t.dataset.siteId = y;
t.dataset.writeKey = 'YOUR_WRITE_KEY'; // optional — request signing
This sends an X-Spectry-Key header with every request. See Allowed domains & write key.
The snippet changes with your consent provider
The install dialog generates a different snippet depending on the consent provider set on the site, so don't reuse a snippet from another site or another provider:
- Spectry or None — the standard loader above. Spectry's own banner handles consent in-script.
- Cookiebot, OneTrust, Usercentrics, Cookie Information — a blocked script tag (
type="text/plain") carrying that provider's marker (data-cookieconsent="statistics",class="optanon-category-C0002",data-usercentrics, ordata-category="cookie_cat_statistic"). The provider rewrites it into a real script once the visitor grants analytics consent, so Spectry doesn't execute at all before that. These variants pass configuration asdata-site-idattributes rather than through the JavaScript loader. - Custom — the standard loader plus a call to
Spectry.setConsent()that you wire to your own banner.
With a blocked-script provider you will see no Spectry requests at all until consent is granted — not even the settings request. That's the provider working correctly, not a broken install.
Platform-specific installation
If you use a CMS or store platform, see Install on WordPress, Shopify & more for step-by-step instructions.
Site settings reference
After installing, review your site settings. Settings has seven tabs:
- Features — toggle error logs, rage clicks and attack detection.
- Consent — choose a consent provider and configure the banner. See Privacy & Consent.
- Replay — enable recording and set the sample rate. See Enable & sample replays.
- Security — view/rotate the write key and set allowed domains. See Allowed domains & write key.
- Error alerts — email digests of new errors. See Alerts.
- Screenshots — strip cookie banners and overlays from the screenshots used by heatmaps. See Screenshot exclusions.
- AI insights — control what the AI analyses and how often. See AI settings.
Next: verify tracking is working.