SLSessionLens

Documentation

Install the tracking snippet, then explore recordings, heatmaps, and the developer API.

1 · Install the snippet

Copy your tracking snippet from Settings → Sites & Tracking Tokens and paste it just before the closing </body> tag of every page you want to track. It looks like this:

<script src="https://YOUR-APP-URL/v1/t.js"
        data-token="YOUR_SITE_TOKEN"
        data-api="https://YOUR-APP-URL" async></script>

The data-token is unique per site and ties incoming data to your workspace. The snippet is < 8 KB and loads the recorder asynchronously, so it never blocks your page.

Marking internal traffic

To exclude your own visits, open your site once with ?sl_internal=1 appended to the URL. That browser is then flagged and its sessions are labeled internal. Use ?sl_internal=0 to undo it.

2 · Key concepts

3 · Privacy & consent (optional)

By default the snippet starts recording immediately. To gate it behind cookie consent (e.g. for GDPR), add data-require-consent="1" to the script tag. Events are then buffered and nothing is sent until you call:

// after the visitor accepts your cookie banner
window._sl.grantConsent();

Consent is remembered in a first-party _sl_consent cookie. The banner UI itself is yours to design; SessionLens just respects the gate.

4 · Developer API

Available on the Scale plan. Generate a key in Settings → Developer API Key and pass it as a Bearer token. All endpoints are read-only and scoped to your workspace.

curl https://YOUR-APP-URL/v1/api/sessions \
  -H "Authorization: Bearer sl_live_xxxxxxxx"

GET /v1/api/sessions

List recent sessions. Query params: limit (1–500, default 100), days (1–365, default 30).

GET /v1/api/sessions/:id

Fetch a single session with its pageviews.

GET /v1/api/analytics/overview

Aggregate totals (sessions, visitors, avg duration, rage clicks) and top pages. Query param: days (1–365, default 30).

Need help? Check the status page or your dashboard.