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

OptionWhat it is
apiKeyYour tracking key, starting cle_. The tracker throws without it.
websiteIdYour site id, starting site_.

What is tracked

All on by default.

OptionDefaultWhat it controls
autoTracktrueEverything below, plus pageviews and session starts. false records only what you send yourself.
trackClickstrueClicks on links and buttons, with the element's tag, id and classes. Never its text.
trackScrolltrueScroll depth, at the thresholds below.
scrollDepthThresholds[25, 50, 75, 100]The depths, in percent, at which a scroll event is recorded.
trackFormstrueForm focus and submit, by form id or name. Never the values.
trackOutboundtrueClicks on links to other sites, with the destination.
trackFileDownloadstrueClicks on links to files such as PDFs and images.
trackPerformancetrueLoad time and Core Web Vitals.
trackErrorstrueJavaScript 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

OptionDefaultWhat it controls
enableBatchingtrueEvents 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.
heartbeatInterval120000Milliseconds between flushes of anything still queued. Two minutes.
sessionTimeout1800000Milliseconds of inactivity after which the next action starts a new session. Thirty minutes.
apiUrlderivedWhere 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.

OptionDefaultWhat it controls
samplingRate1.0The 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.
detailedEventsSamplingRate0.1For visitors who are sampled, the share of clicks, scroll depths and form focuses that are kept. Keeps high-volume events light.
OptionDefaultWhat it controls
requireConsenttrueWhether a recorded refusal stops tracking. With the consent banner, a visitor who clicks Reject is not tracked.
allowWithoutConsenttrueBefore a visitor has chosen, track the session without keeping anything between visits.
consentCookieNameclerion_consentThe cookie the banner writes and the tracker reads.
consentCookieExpiry365Days a choice, and the visitor id that comes with acceptance, are kept.
ignorePrivacySignalsfalseGlobal Privacy Control and Do Not Track stop tracking. Set true only with your own legal basis for it.

Debugging

OptionDefaultWhat it controls
debugfalseLogs each batch of events to the console as it is sent, and any tracker error.
sourceMapUrlnullWhere the tracker can fetch source maps to resolve error stack traces.
enableSourceMapResolutiontrueWhether 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.

Something missing or wrong here? Write to hello@getclerion.com, or ask from inside the app.