Advanced features
Script configuration
Every supr-* attribute of the tracking script, the HTML attributes for goals and scroll events, the window.supr() API, and what the script tracks on its own.
The script is configured with supr-* attributes on its tag. Only supr-website-id is required.
Script attributes
| Attribute | Default | What it does |
|---|---|---|
supr-website-id | required | Which website the visits belong to (Settings → General). |
supr-domain | the page's host | Sets the visitor cookie on this domain, so all its subdomains share one visitor. See subdomains. |
supr-allowed-hostnames | none | Your other domains, comma-separated. Links to them keep the same visitor. See cross-domain tracking. |
supr-api | <script origin>/api/event | Where events are sent: a full URL or a path on your site. See your own proxy. |
supr-allow-localhost | false | true tracks localhost, 127.0.0.1 and .local hosts, which are ignored otherwise (unless Track localhost is on in Settings → General). |
supr-hash | false | true counts #/route changes as pages. See hashed paths. |
supr-cookieless | false | true sets no cookies at all. See cookieless tracking. |
supr-outbound | true | false stops tracking clicks on links to other websites. |
supr-polar | true | false stops adding reference_id to Polar checkout links. |
supr-dodo | true | false stops adding the visitor id to Dodo Payments payment links. |
supr-paddle | true | false stops adding the visitor id to Paddle checkout buttons. |
HTML element attributes
| Attribute | What it does |
|---|---|
supr-goal | A click on the element completes this goal. See custom goals. |
supr-goal-* | Properties of that goal: supr-goal-plan="pro" sends plan: "pro". |
supr-scroll | The goal is completed when the element scrolls into view. See scroll events. |
supr-scroll-threshold | How much of the element must be visible, 0 to 1 (default 0.5). |
supr-scroll-delay | How long it must stay visible first, in milliseconds. |
supr-scroll-* | Properties of that goal. |
supr-mask | Hides the element's text in session recordings and heatmap snapshots. |
supr-block | Leaves the element out of session recordings and heatmap snapshots entirely. |
JavaScript API
| Call | What it does |
|---|---|
supr("goal_name", props?) | Completes a goal, with up to 10 properties. |
supr("identify", { user_id, email, name }) | Names the visitor. See user identification. |
supr("pageview") | Sends a pageview now (for routers the script can't see). |
supr.visitorId() | The visitor's id, for revenue attribution. |
supr.sessionId() | The current visit's id. |
Installed with older names? They keep working: the data- versions of every attribute above (data-website-id, data-domain, data-supr-goal, data-supr-scroll, data-supr-mask and the rest; when a tag has both, the supr- one wins).
What the script tracks on its own
- A pageview on load, and on every
history.pushState,replaceStateand back/forward navigation. - Clicks on links to other websites (the Exit link report), unless
supr-outbound="false". - A heartbeat every 30 seconds while the tab is visible and in use, for session time and the live view, and a goodbye when the page closes.
- With session recordings or heatmaps turned on for the website, it loads a second script,
/js/recorder.js, from SuprAnalytics on the pages there is something to capture. There's nothing to add to the snippet.
Examples
<script defer supr-website-id="YOUR_WEBSITE_ID" supr-domain="yourdomain.com" src="https://supranalytics.app/js/script.js"></script>
<script defer supr-website-id="YOUR_WEBSITE_ID" supr-allow-localhost="true" src="https://supranalytics.app/js/script.js"></script>
<script defer supr-website-id="YOUR_WEBSITE_ID" supr-cookieless="true" src="https://supranalytics.app/js/script.js"></script>
<script defer supr-website-id="YOUR_WEBSITE_ID" supr-hash="true" src="https://supranalytics.app/js/script.js"></script>
<script defer supr-website-id="YOUR_WEBSITE_ID" supr-domain="yourdomain.com" src="/js/script.js" supr-api="/api/event"></script>
AI agent or LLM? Read this page as Markdown