Reference

Script tag

The snippet configures itself from attributes on its own <script> tag. Only the key is required; the copy in Clerion 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

AttributeValueWhat it does
data-api-keyYour tracking key, starting cle_Required. Without it the snippet does nothing.
data-website-idYour site id, starting site_The site the visits belong to.
data-api-urlA URLWhere events are sent. Defaults to the API on the host the script was loaded from; leave it unset.
data-auto-trackfalseTurns 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-debugtrueLogs each batch of events to the browser console as it is sent, and any tracker error. See Check your installation.
data-disabledtrueTurns tracking off entirely, for a staging site that shares the template.
data-exit-questionPaths, comma-separatedAsks 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.

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