ignoreSelf
Exclude your own browser with a query parameter.
import { ignoreSelf } from "@spoar/sdk/plugins";import { createAnalytics } from "@spoar/sdk";
import { ignoreSelf } from "@spoar/sdk/plugins";
export const analytics = createAnalytics({
project: "example.com",
key: "pk_...",
endpoint: "/_ra",
plugins: [ignoreSelf()],
});Options
ignoreSelf() takes no options.
Sends
Nothing. It reads the ra query parameter once, when the client starts:
| URL | Does |
|---|---|
?ra=ignore | Calls analytics.optOut(): this browser stops sending |
?ra=track | Calls analytics.optIn(): this browser sends again |
Open any page that loads the client with ?ra=ignore once per browser. The opt-out is kept in localStorage, so it lasts until ?ra=track or until the site data is cleared, and it applies to this site only.
?ra=debug, which logs every event to the console, and ?ra=nodebug, which turns that off again and keeps the visitor id, are handled by the core and work without this plugin.
In reports
Events from an opted-out browser are dropped before they are queued, so they never reach the API. To keep your own traffic but leave it out of reports instead, mark the visitor as internal with PATCH /v2/projects/:project/visitors/:visitor; the default traffic=human filter excludes internal traffic.