Get started
Script reference
The Stickybeak analytics tracking code works unchanged on most sites. This reference explains the script and its options for special cases.
The analytics script
<script
defer
data-site="YOUR_SITE_ID"
data-domain="example.com"
src="https://app.usestickybeak.com/_cfw/s.js"
></script>
Keep the attributes on the element that loads the script. Do not use type="module".
Attributes
| Attribute | Value | Effect |
|---|---|---|
src | Script URL | Hosted /_cfw/s.js, an available first-party URL, or cookieless.js. |
defer | None | Recommended. async also works. |
data-site | Site ID | Required. Copy it from Settings. |
data-domain | example.com | Required. Sets cookie scope and identifies internal links. Leading www. is ignored. Details. |
data-privacy | true | Enables privacy mode. |
data-allow-localhost | true | Runs locally for testing; local events are still refused. |
data-debug | true | Runs inside an iframe. It does not log. |
data-endpoint | URL or path | Overrides the event endpoint. Relative paths resolve beside the script. |
referrerpolicy | no-referrer | Optional standard HTML attribute for the script request. |
Privacy-mode alias
/_cfw/cookieless.js always enables privacy mode, even with data-privacy="false". Install either it or s.js, not both; the first Stickybeak tag to run wins.
Queue calls made before load
<script>window.stickybeak = window.stickybeak || function () { (window.stickybeak.q = window.stickybeak.q || []).push(arguments); };</script>
Put this above the tag when your code may call window.stickybeak first. It queues up to 100 calls and remains harmless if the script is blocked.
Goal API
window.stickybeak(name, properties);
| Argument | Rules |
|---|---|
name | Required. Lowercased and trimmed; 1–64 characters using a–z, 0–9, _, : or -. pageview is reserved. |
properties | Optional. Up to 10 string, number or boolean values, each cut to 255 characters. Personal-looking keys are dropped; privacy mode drops all properties. |
The function returns nothing and never throws. Invalid calls are ignored. See Custom goals and Revenue.
Automatic events
| Trigger | Event |
|---|---|
| Page load or supported route change | Pageview |
| Visible, active tab every 20 seconds | Presence ping; not stored as an event |
Element with data-goal | Named goal and allowed data-goal-* properties |
mailto: or tel: link | email_click or phone_click |
| External link | outbound_link with destination origin |
| Marked or navigational internal link | link_click with section and destination path |
Events use fetch to /_cfw/i beside the script, without cookies or a Referer header.
When it does not run
The script stops for missing required attributes, file:// pages, local addresses, iframes, stickybeak:ignore, or when another copy is already running. The localhost and iframe options above override only their matching checks.