Skip to content

Verifying an install

Turn the sample rate up and debug logging on, temporarily:

init({ projectKey: 'P-ABC123', sampleRate: 1, debug: true });

Then:

  1. Load the page and wait a few seconds. The send happens after the page settles, so clicking straight through can outrun it.

  2. Check the console for [ritim] measurement sent and the payload.

  3. Check the network panel for a POST to the collector returning 202.

  4. Put the sample rate back and turn debug off when you are done.

Nothing is logged at all. init() never ran. The usual causes:

  • It is running on the server. init() needs window — in Next.js it must be in a 'use client' component’s effect, and in Nuxt the plugin file has to be named *.client.ts. See Next.js and Nuxt.
  • The component or plugin holding it is never mounted.
  • It is tree-shaken away. init() has a side effect but no return value; if you wrapped it in something the bundler proved unused, it can go.

It logs, then nothing sends. Almost always the sample rate — the default is 0.25, so most page views do nothing by design. That is what step 1 rules out.

If you run a CSP you need both directives:

script-src https://cdn.ritim.io;
connect-src https://collect.ritim.io;

connect-src is the one people miss — and on the npm path it is the only one that matters, since the SDK is in your own bundle and never loads from the CDN. The script loads fine, and then every sendBeacon is silently refused.

Status Meaning
400 The payload did not validate. Usually a hand-rolled request, not the SDK.
403 The key is unknown, or the page’s hostname is not one of the project’s.
429 The project is over its monthly event allowance. See limits.

Give it traffic. The dashboard reports p75, and a 75th percentile over four page views is arithmetic rather than information.

It is also worth checking you are looking at the right release — if you just deployed, yesterday’s measurements are under yesterday’s release.

When you want to prove the path end to end without your app in the way:

import { init } from '@ritim/browser-sdk';
init({
projectKey: 'P-ABC123',
sampleRate: 1,
debug: true,
});
document.body.innerHTML = '<button id="add-to-cart">Click me</button>';

Click the button before the send fires and the INP event will name #add-to-cart — a quick way to confirm interaction attribution is reaching you.