Reference
Configuration options
The script tag starts the tracker with its defaults, and those defaults suit almost every site. When you need to change one, load the script with data-disabled="true" so the tag does not start a tracker, then start your own:
<script src="https://api.getclerion.com/sdk/clerion-analytics.js" data-disabled="true"></script>
<script>
window.addEventListener("load", () => {
window.clerion = new ClerionAnalytics({
apiKey: "YOUR_API_KEY",
websiteId: "YOUR_WEBSITE_ID",
trackScroll: false,
exitQuestion: ["/pricing"],
});
});
</script>
Assign it to window.clerion so custom events and the rest of the JavaScript API work as documented. Start exactly one tracker per page.
Required
| Option | What it is |
|---|---|
apiKey | Your tracking key, starting cle_. The tracker throws without it. |
websiteId | Your site id, starting site_. |
What is tracked
All on by default.
| Option | Default | What it controls |
|---|---|---|
autoTrack | true | Everything below, plus pageviews and session starts. false records only what you send yourself. |
trackClicks | true | Clicks on links and buttons, with the element's tag, id and classes. Never its text. |
trackScroll | true | Scroll depth, at the thresholds below. |
scrollDepthThresholds | [25, 50, 75, 100] | The depths, in percent, at which a scroll event is recorded. |
trackForms | true | Form focus and submit, by form id or name. Never the values. |
trackOutbound | true | Clicks on links to other sites, with the destination. |
trackFileDownloads | true | Clicks on links to files such as PDFs and images. |
trackPerformance | true | Load time and Core Web Vitals. |
trackErrors | true | JavaScript errors and console errors, with the visitor's last actions. |
exitQuestion | [] | Paths on which leaving visitors are asked why. See Exit question. |
Rage clicks are recorded whenever autoTrack is on; there is no switch for them alone.
Sending
| Option | Default | What it controls |
|---|---|---|
enableBatching | true | Events are queued and sent together, five seconds after the last one, or at once when the page is hidden or closed. false sends each event as it happens. |
heartbeatInterval | 120000 | Milliseconds between flushes of anything still queued. Two minutes. |
sessionTimeout | 1800000 | Milliseconds of inactivity after which the next action starts a new session. Thirty minutes. |
apiUrl | derived | Where events are sent. Derived from the script's own address; leave it unset. |
Sampling
Leave these at their defaults for anything you count as a conversion.
| Option | Default | What it controls |
|---|---|---|
samplingRate | 1.0 | The share of visitors whose events are recorded. Errors, session starts and ends, and pageviews are always recorded. Custom events and rage clicks are not, so a rate below 1 undercounts them. |
detailedEventsSamplingRate | 0.1 | For visitors who are sampled, the share of clicks, scroll depths and form focuses that are kept. Keeps high-volume events light. |
Consent and privacy
| Option | Default | What it controls |
|---|---|---|
requireConsent | true | Whether a recorded refusal stops tracking. With the consent banner, a visitor who clicks Reject is not tracked. |
allowWithoutConsent | true | Before a visitor has chosen, track the session without keeping anything between visits. |
consentCookieName | clerion_consent | The cookie the banner writes and the tracker reads. |
consentCookieExpiry | 365 | Days a choice, and the visitor id that comes with acceptance, are kept. |
ignorePrivacySignals | false | Global Privacy Control and Do Not Track stop tracking. Set true only with your own legal basis for it. |
Debugging
| Option | Default | What it controls |
|---|---|---|
debug | false | Logs each batch of events to the console as it is sent, and any tracker error. |
sourceMapUrl | null | Where the tracker can fetch source maps to resolve error stack traces. |
enableSourceMapResolution | true | Whether it tries. |
From the script tag
The tag itself reads only data-api-key, data-website-id, data-api-url, data-auto-track, data-debug, data-disabled and data-exit-question. Every other option needs the pattern at the top of this page. See Script tag.