Docs Reference
View as MarkdownScript tag
The snippet configures itself from attributes on its own <script> tag. Only the key is required; the copy in your dashboard already carries the key and the site id.
<script
src="https://api.getclerion.com/sdk/clerion-analytics.js"
data-api-key="YOUR_API_KEY"
data-website-id="YOUR_WEBSITE_ID"
></script>
Attributes
| Attribute | Value | What it does |
|---|---|---|
data-api-key | Your tracking key, starting cle_ | Required. Without it the snippet does nothing. |
data-website-id | Your site id, starting site_ | The site the visits belong to. |
data-api-url | A URL | Where events are sent. Defaults to the API on the host the script was loaded from; leave it unset. |
data-auto-track | false | Turns off automatic tracking: no pageviews, clicks, scroll, forms, speed, errors, rage clicks or exit question. Session starts and what you send with the JavaScript API are still recorded. |
data-debug | true | Logs each batch of events to the browser console as it is sent, and any tracker error. See Check your installation. |
data-disabled | true | Turns tracking off entirely, for a staging site that shares the template. |
data-exit-question | Paths, comma-separated | Asks visitors leaving those pages why. /pricing matches one page, /docs/* every page under it, * every page. See Exit question. |
In Next.js
import Script from "next/script";
export default function RootLayout({ children }) {
return (
<html><body>{children}
<Script src="https://api.getclerion.com/sdk/clerion-analytics.js" data-api-key="YOUR_API_KEY" data-website-id="YOUR_WEBSITE_ID" strategy="afterInteractive" />
</body></html>
);
}
Every other option
Sampling, batching, the session timeout, which automatic events to record and the consent settings are not attributes. Start the tracker yourself to set them: see Configuration options.
What the snippet does not need
No cookie and no consent banner: Clerion counts visits without setting cookies. The one cookie it knows is the visitor's choice, and only if you turn on the optional consent banner. No event plan: everything in What is tracked automatically is on by default.
Privacy signals
The snippet honours Global Privacy Control and Do Not Track. A visitor with either turned on is not tracked, and the exit question is never shown to them.