Browse docs
On this page

User Analytics

Analytics for your website and mobile apps. Install one npm package on your site, or point PostHog's mobile SDKs at your workspace, and get visitors, pages and screens, page speed, heatmaps, errors, funnels, user paths, sessions with masked replay, people and retention, stored next to your logs.

User Analytics shows what people do in your website and your mobile apps, stored next to your logs. It is a Google Analytics alternative for the web and an app analytics tool for iOS, Android, React Native and Flutter, with both on the same screens.

  • Websites install one npm package. Every pageview, click, custom event and front-end error lands in your own workspace.
  • Mobile apps use PostHog's open-source mobile SDKs, pointed at your workspace. Every screen view, custom event and crash lands in the same place.

The analytics screens turn it into visitors, top pages and screens, referrers, page speed, heatmaps, funnels, user paths, sessions you can watch back, people and retention. See Connect a website or app to start.

Website and app events are ordinary events. Each one is also a row in the Log Explorer, so you can search it, chart it, put it on a dashboard or alert on it, and line it up against your backend logs and traces on the same time axis. Nothing is stored twice. Session recordings are the one thing kept apart, in storage of their own, because a recording is a replay of the page rather than an event; see Session replay.

Turn it on

A workspace Owner or Admin turns on User Analytics from Add-ons. It is off by default, and it affects only that workspace.

Connect a website or app

Websites send with our SDK. Mobile apps send with PostHog's open-source SDKs, pointed at your workspace. Either way you need an analytics key:

  1. Open User Analytics in the sidebar, choose + Add website or app at the top right, and create an analytics key. The key is shown once, so copy it before leaving the screen. Use a separate key for each site and app, so each is its own entry in the site picker and can be disabled on its own.
  2. Set up your platform below.
  3. Load a page or open the app. The Add a website or app screen confirms when the first event arrives.

Set this up with an AI assistant

Copy this prompt into Claude Code, Cursor, Copilot or another coding assistant, from the root of your website's repository. It asks you for your analytics key, then installs and wires up the SDK.

Show the prompt
Set up ObiStack User Analytics on this website.

Before changing anything, ask me for my analytics key. It starts with obi_ and I create it on the User Analytics Setup screen in ObiStack. Do not guess or invent it.

These values are already known:
- Ingest host: https://ingest.obistack.com

Then:

1. Work out the framework, the package manager (npm, pnpm, yarn or bun, from the lockfile, or none, as on many PHP sites) and where client-side code runs once on startup.

2. Install the SDK with the project's package manager, for example:
   npm install https://api.obistack.com/v1/user-analytics/sdk/obistack-user-analytics-0.11.0.tgz
   Use this exact URL. The package is served by the ObiStack API, not the npm registry. It is imported as "@obistack/user-analytics".

3. Put the key and host in environment variables using this framework's convention for values exposed to the browser (for example NEXT_PUBLIC_LOGS_ANALYTICS_KEY and NEXT_PUBLIC_LOGS_API_HOST in Next.js, VITE_ prefixed in Vite). Add them to the local env file and to the example env file if the project has one. The analytics key is public by design: it is write-only and can only send website events, so it is fine in client code.
   Those prefixed variables are copied into the bundle at build time. If the project builds one Docker image for several environments, or its build or deploy files show the key being supplied only when the container starts, set the values at run time instead: render them as <meta name="obistack-analytics-key"> and <meta name="obistack-host"> tags and have the code that calls init() read them with document.querySelector. If a server renders the page, render the tags from unprefixed server environment variables on each request (in the Next.js App Router, the root layout calls await connection() from "next/server"), or use the framework's own run-time config, such as useRuntimeConfig().public in Nuxt or $env/dynamic/public in SvelteKit. If the site is static files, put ${LOGS_ANALYTICS_KEY} and ${LOGS_API_HOST} placeholders in index.html and fill them with envsubst, naming only those two variables, in the container entrypoint or deploy step. Ask me which I want if it is not clear.

4. Call init() exactly once, as early as possible in client-side code, and keep the returned client in a module so the rest of the app can reuse it:

   import { init } from "@obistack/user-analytics";

   const analytics = init({
     key: <analytics key from env>,
     host: <ingest host from env>,
   });

   For a PHP site: render the key and host as the two <meta> tags from server environment variables (in Laravel, through config/services.php and config(), never env() in a template; in Symfony, through twig.yaml globals using %env()%), and read them with document.querySelector as above. If the site already builds JavaScript (Vite in Laravel, Webpack Encore in Symfony), install the SDK there and import the analytics module from the main entry file. If it has no JavaScript build (plain PHP, a WordPress theme, or Symfony AssetMapper, which cannot fetch this package), make a separate folder with an analytics.js that calls init() with the meta tag values and assigns the client to window.obistack, install the SDK and esbuild there, run npx esbuild analytics.js --bundle --minify --format=iife --outfile=obistack-analytics.js, copy that file into the site, and load it with a deferred <script> tag in the shared page header (wp_enqueue_script in WordPress). Escape the meta values with htmlspecialchars in plain PHP.

   init() is safe during server-side rendering (it returns a client that does nothing when there is no browser), so no typeof window checks are needed.
   For React and Next.js App Router: create a module (for example app/analytics.ts) with a module-level variable and a getAnalytics() function that calls init() the first time it is asked for and returns the same client every time after (analytics ??= init({...}); return analytics;). Then create a "use client" AnalyticsProvider whose useEffect, with an empty dependency array, only calls getAnalytics(), and wrap the root layout's <body> contents in <AnalyticsProvider>. Components get the client by calling getAnalytics() in their effects and event handlers, never by reading a variable the provider sets, because React runs a child's effects before its parent's. Do not call shutdown() from an effect cleanup: React StrictMode runs cleanups on purpose in development. init() is idempotent, so StrictMode running the effect twice sets nothing up twice.

5. Leave the defaults alone. Pageviews (including client-side route changes), clicks, form submits, field changes, time on page, scroll depth, Core Web Vitals and front-end errors (uncaught errors, unhandled promise rejections and console.error calls) are captured automatically. Do not add manual pageview calls or extra error handlers to report errors. If you see console.error calls that log personal data such as emails or tokens, point them out to me.
   Session replay is on by default too. Every input, select and rich text editor is masked in the browser before upload, and images and media are recorded as empty boxes; other page text is recorded as shown. Look for pages that show personal or confidential data as text (account names, addresses, order or message history) and suggest adding the data-logs-mask attribute to those elements, or passing sessionReplay: { maskAllText: true } to mask all text, but ask me before adding either. Do not loosen the sessionReplay masking options unless I ask. If an element must never appear in a recording even as a box, add the data-logs-block attribute to it.

6. If the app has sign-in, call analytics.identify(user.id) after login and analytics.reset() on logout. To give the user's profile a few useful properties, such as their plan, pass them as the second argument: analytics.identify(user.id, { plan: user.plan }). Never pass a name, email, phone number or other personal data.

7. If the site already has a cookie or consent banner, pass optOutByDefault: true to init() and call analytics.optIn() when consent is accepted and analytics.optOut() when it is declined.

8. Optionally, add a few custom events for this product's key actions, for example:
   analytics.capture("signed_up");
   analytics.capture("checkout_completed", { amount: 42, currency: "USD" });
   Use snake_case names that describe what happened. Names starting with $ are reserved and rejected. Keep each event to 50 properties or fewer. Suggest events to me before adding more than a handful.

9. If the site sends a Content-Security-Policy, add the ingest host to connect-src.

When you are done, tell me which files you changed, which env vars I need to set in each environment, and to load a page on the site so the Setup screen can confirm the first event arrived.

Install the SDK. It is served by the API rather than the npm registry:

Shell
npm install https://api.obistack.com/v1/user-analytics/sdk/obistack-user-analytics-0.11.0.tgz

This works with npm, pnpm, yarn and bun. You still import the package as @obistack/user-analytics, and the install URL is saved in your package.json like any other dependency. Each version has its own URL, so to upgrade, install the newer version's URL. The Add a website or app screen always shows the current one.

Before 0.9.0 the package was called @obistack/web-analytics. To upgrade from an older version, uninstall it, install the URL above, and change your imports to @obistack/user-analytics. Nothing else changed: the key, the options and what the SDK sends are the same.

Then initialise it once, as early as possible in code that runs in the browser:

JavaScript
import { init } from "@obistack/user-analytics";

const analytics = init({
  key: "obi_your_website_key",
  host: "https://ingest.obistack.com",
});

Keep the returned client in a module so the rest of your code can send events with it.

What a website sends

From here on, pageviews, clicks, form submits and field changes are captured automatically, including client-side route changes in single-page apps, along with each page's Core Web Vitals. From SDK 0.11.0, events also say whether session replay is on for the site and, only when the browser reports it, that automation software is controlling the browser; see Why a session looks the way it does. init() is safe to call during server-side rendering: with no browser, it returns a client whose methods do nothing, so server-rendering frameworks need no typeof window checks.

The SDK sends what it captures in batches, at most one request for events and one for the recording every 5 seconds (SDK 0.8.0 and later; every 3 seconds before). The first pageview goes straight away, and whatever is still waiting when a visitor leaves the page is sent with the browser's sendBeacon as the page closes, so nothing is lost to batching.

What an app sends

Screens take the place of pages. A screen view counts as a pageview on every screen, and the screen's name is shown where a website would show its path, so Checkout appears in Pages, Paths, Sessions and the overview's top pages, and a funnel's page step matches it. Custom events, identify and errors work as they do on a website, including the user properties the SDKs' identify call takes, which land on the user's profile on the People screen. A crash is recorded with its type, message and stack on the session it happened in.

The SDKs also record Application Opened, Application Backgrounded, Application Installed and Application Updated on their own. They appear as custom events, which makes them useful as funnel steps, but they don't count as interaction, so opening an app, glancing at one screen and putting it away is still a bounce.

Apps have no URL, referrer, campaign parameters, time on page, scroll depth or Core Web Vitals, so those cards stay empty for an app. Each event keeps the app's app_version and app_build, and sdk names the SDK that sent it, such as posthog-ios.

Setting the key when the site starts, not when it builds

The SDK reads the key and host only when you call init(), so they can come from anywhere. Most front-end build tools copy environment variables into the JavaScript they produce, so a variable read that way has to be set when the site is built, and changing it later means building again. Which variables this applies to depends on the tool: NEXT_PUBLIC_ in Next.js, VITE_ in Vite, PUBLIC_ in Astro, REACT_APP_ in Create React App. It is how those tools work, not something the SDK needs.

That suits most sites. If you build one Docker image and run it in several environments, or want to rotate the key without a rebuild, set the values when the site starts instead, and have the page carry them as two <meta> tags:

HTML
<meta name="obistack-analytics-key" content="obi_your_website_key" />
<meta name="obistack-host" content="https://ingest.obistack.com" />

The code that sets up the SDK then reads them from the page, whatever your framework:

TypeScript
// analytics.ts
import { init, type UserAnalytics } from "@obistack/user-analytics";

let analytics: UserAnalytics | undefined;

function meta(name: string): string {
  return document.querySelector(`meta[name="${name}"]`)?.getAttribute("content") ?? "";
}

export function getAnalytics(): UserAnalytics {
  analytics ??= init({ key: meta("obistack-analytics-key"), host: meta("obistack-host") });
  return analytics;
}

Call getAnalytics() only in the browser: from an effect, an event handler, or a script that runs after the page has loaded.

How the tags get into the page depends on whether a server renders it.

A server renders the page. Read ordinary server environment variables, without the build tool's public prefix, and write them into the page's <head> on each request, in your root layout or template. Check that the page really is rendered per request: a page prerendered at build time has its values fixed at build time too. Many frameworks also have run-time config of their own that can feed init() directly, such as useRuntimeConfig().public in Nuxt or $env/dynamic/public in SvelteKit.

The site is static files (a Vite, Create React App, Angular or Vue build served by nginx, a CDN or object storage). Nothing runs per request, so write the tags into index.html when the container starts. Put placeholders in the source index.html:

HTML
<meta name="obistack-analytics-key" content="${LOGS_ANALYTICS_KEY}" />
<meta name="obistack-host" content="${LOGS_API_HOST}" />

and fill them in from the container's entrypoint before the web server starts:

Shell
#!/bin/sh
# docker-entrypoint.sh
envsubst '${LOGS_ANALYTICS_KEY} ${LOGS_API_HOST}' \
  < /usr/share/nginx/html/index.html > /tmp/index.html
mv /tmp/index.html /usr/share/nginx/html/index.html
exec nginx -g 'daemon off;'

Listing the two names keeps envsubst from touching anything else in the file. If the site is not in a container, do the same in your deploy step, after the build and before upload. Fetching a small config.json before calling init() also works, at the cost of one extra request before the first pageview.

With any of these, start the container with the values set, for example docker run -e LOGS_ANALYTICS_KEY=obi_your_website_key -e LOGS_API_HOST=https://ingest.obistack.com your-image, and the same image works in every environment.

The key reaches the visitor's browser whichever way you pass it, which is fine: an analytics key can only send website events to its own workspace, and cannot read anything. Setting it at run time keeps it out of the image and lets you change it with a restart, but it does not make it secret.

init() throws if the key is missing or malformed, on the server as well as in the browser. If your build fails with an analytics key error, something is calling init() while pages are prerendered, with a build-time variable that was not set. Call init() only in the browser, as above, and set the key when the site starts.

Custom events

JavaScript
analytics.capture("checkout_completed", { amount: 42, currency: "USD" });

Name events after what happened in your product, such as signed_up or video_played. Names starting with $ are reserved for the automatic events and are rejected. Each event can carry up to 50 properties.

People

To tell the screens who a signed-in visitor is, call analytics.identify(user.id) after they sign in, and analytics.reset() on logout. From then on their sessions carry the user id, and they get a profile on the People screen. The visits they made before signing in, as an anonymous visitor on the same browser, are linked to the same person, so their profile lists those sessions too.

A profile can hold properties about the user, such as their plan:

JavaScript
// The second argument overwrites; the third is kept only if the
// profile does not have it yet.
analytics.identify(user.id, { plan: "pro" }, { signed_up: "2026-10-02" });

// Later, without identifying again:
analytics.setPersonProperties({ plan: "team" });

Properties need SDK 0.5.0 or later; earlier versions send the user id only. Values are strings, numbers, true or false, or lists of up to 20 of them. A profile keeps at most 100 properties and 16 KB of them in all: once it is full, new properties are ignored, while existing ones can still change. Strings are cut to 1,024 characters. Properties set before identify are ignored, so anonymous visitors never get a profile.

Properties that look like secrets are withheld, not stored: one named like password, api_key or token, or whose value looks like a card number or a secret key. The property's name is kept and the screen shows it as withheld, so you can see it arrived. Contact details such as a user's email, name and phone number are kept, so you can tell who a person is. Web addresses lose their query strings. PostHog's own $ properties are dropped, apart from where the user first came from ($initial_referring_domain, $initial_utm_source and the other campaign fields, $initial_pathname, $initial_browser, $initial_os and $initial_device_type).

The People screen lists everyone identified, most recently updated first, and finds a person by their user id. Opening one shows their properties, every id they have been known by (the user id, the anonymous visitor ids from before they signed in, and any alias set with PostHog's alias), and every session any of those ids took part in during the time range you pick. A user id on the Sessions screen opens that person.

People are shared by every site in the workspace: the same user id on two of your sites is one person. Calling reset() on logout matters on a shared computer: the browser then starts a new anonymous id, so the next person to sign in there does not inherit the last one's visits.

Seeing people needs a role that can see all of the workspace's data, since a profile is built from every site's events. A workspace Owner or Admin can delete a person's profile from their screen, for example to answer an erasure request. That removes their properties and the links between their ids for good. The events they sent stay until your retention removes them, and if they sign in again, a new, empty profile starts.

Options

OptionDefaultWhat it does
keyrequiredThe analytics key from Add a website or app. Starts with obi_.
hostrequiredYour API address. No path needed; the SDK adds its own.
autocapturetrueCapture clicks, form submits and field changes.
capturePageviewstrueCapture pageviews, including client-side route changes. Turn off to call analytics.pageview() yourself.
capturePageleavetrueRecord time on page and scroll depth when a visitor leaves a page.
heatmapstrueRecord where on each page visitors click, for the Heatmaps screen. Sends positions only. Needs SDK 0.4.0 or later.
webVitalstrueMeasure each page's Core Web Vitals (LCP, INP, CLS and FCP) for the Performance screen. Needs SDK 0.2.0 or later.
captureErrorstrueSend uncaught errors, unhandled promise rejections and console.error calls, with their stack, to the session they happened in. Pass { uncaught, rejections, console } to choose which, or false to turn it off.
respectDoNotTrackfalseCapture nothing from browsers that send Do Not Track. By default they are captured like any other. Before 0.10.0 this defaulted to true.
optOutByDefaultfalseStart opted out, for a consent banner. Call optIn() once consent is given.
persistence"localStorage+cookie"Where visitor and session ids are kept: localStorage, cookie, sessionStorage or memory.
maskAllTextfalseLeave element text out of click events, for pages with sensitive copy. Session replay masks text on its own; see Session replay.
sessionReplaytrueRecord each visit so you can watch it back, with every input masked in the browser. Pass an object to change what is masked or the share of sessions recorded, or false to turn recording off. Needs SDK 0.6.0 or later.
sessionIdleTimeoutSeconds1800Inactivity after which a new session starts.
superProperties{}Properties added to every event.
beforeSendnoneEdit or drop an event just before it is sent. Return null to drop it.

Errors and finding sessions

The Errors screen lists every error the SDK captured in the time range, newest first: console.error calls, uncaught errors and unhandled promise rejections, each with its message, where it was raised, its stack trace, the page, the user and the session. The filter button narrows the list to one kind of error, one session or one user. Select a user id or a session id in a row to see only theirs, or press View session to open the session at the moment the error happened. If the Obi AI Assistant add-on is on and your role can use it, Explain asks Obi for the likely cause and a fix.

On Sessions, the filter button narrows the list to one user (start typing their user id, such as an email address, and pick them from the list), to visitors with a customer ID (your site called identify for them), to guests, or to sessions with errors. Open a session from the filtered list and Previous session and Next session step through that same list.

Why a session looks the way it does

Every session explains itself in plain words, so you can tell a person from a script and know why a recording is missing. These are hints drawn from what the session sent, not verdicts: nothing is hidden, dropped or counted differently because of them.

On Sessions, a small robot icon after a session's device icons marks it as likely automated, and its reasons are in the icon's label. The Replay column says "Recorded" or, in a few words, why there is no recording. Open the session to read every reason in full.

Likely automated

A session is called likely automated only when one of these is true:

  • The browser said so. It reported that automation software was controlling it (navigator.webdriver, sent by SDK 0.11.0 and later).
  • It came in a burst and did nothing. Two or more other sessions on the same site started within the same second with the same window size, screen size, browser and operating system, this one had no clicks, taps or scrolling and lasted under 5 seconds, and it was not a returning visitor.

When it is, the session also lists any of these that apply. None of them is enough on its own:

ReasonWhat it is based on
New visitorThe browser had not visited the site before: its visitor id was created when this session started.
A page no other visitor viewedNo other session, outside the same burst, viewed that page in the 3 days either side, so it likely does not exist on the site.
A page titled not foundA page the session viewed had "404" or "not found" in its title.
Browser language for another countryThe browser's language, such as zh-CN, names a different country than the one the visit came from.

Automated visits are judged only from what the session sent. No IP address, user agent or fingerprint is stored or used. posthog-js already ignores browsers that announce themselves as known crawlers, so what is left is mostly headless browsers that look like ordinary ones, which is what these rules look for.

Why there is no replay

When a session has no recording, it says why, using the first of these that applies:

ReasonWhat it is based on
Replay is off for this siteYour site set sessionReplay: false (SDK 0.11.0 and later say so).
The recording was removedThe session is older than your workspace keeps recordings.
Only a page-leaveThe session is a single page-leave. A tab left idle for over 30 minutes starts a new session when it is closed, so nothing else happened in it.
Likely automatedSee above. Automated visits usually leave before the recorder starts.
The visit ended within 2 secondsThe recorder loads after the page, so a very short visit is usually gone before it starts.
Not in the sampleYour site records a sample of sessions (sampleRate under 1) and this one was likely not picked.
No recording arrived (iOS)iOS can pause a tab in the background before its recording is uploaded.

If none of these fits, the session simply says it was not recorded.

Session replay

From SDK 0.6.0 each visit is recorded, and the session's page in Sessions plays it back above the timeline. Press Play from here on any event in the timeline to watch that moment, or open a session from a log line: any line in the Log Explorer with a session_id, session.id or $session_id field shows Watch session replay, which opens the recording at the time the line was written. Pass the browser's session id (analytics.getSessionId()) to your backend, for example in a request header, and log it, and a backend error leads straight to what the visitor was doing when it happened.

Recordings are made by posthog-js's own recorder, bundled with the SDK and downloaded only when replay is on. Nothing is loaded from PostHog.

What a recording is

A recording is not a video. It is a description of the page, its structure and styles, followed by every change to it: content appearing and disappearing, scrolling, mouse movement, clicks and taps, and the size of the window. The player rebuilds the page from that in a sandboxed frame with the page's own scripts removed. A typical recording is tens to hundreds of kilobytes, mostly the description of the page.

A recording contains:

  • the page's layout and text, with inputs and media masked as described below;
  • where the visitor moved the mouse, scrolled, clicked and typed, but not what they typed;
  • the address of each page they were on, without its query string or fragment;
  • when the tab was hidden and shown again.

It never contains console output, network requests, request headers or bodies, cookies, or anything from another site embedded in the page.

Masking happens in the browser

Masking is done by the SDK in the visitor's browser, before anything is sent. It is not a setting in your workspace, and nothing in your workspace can loosen it or unmask a recording later, because the masked content was never sent. Changing what is masked means changing the options you pass to init() and deploying your site.

By default:

  • every input, textarea and select value is replaced with asterisks, and password fields always are;
  • text typed into a rich text editor (any contenteditable element), the options of a select, and anything you mark data-logs-mask are replaced with asterisks;
  • images, video, audio, canvases, iframes and anything you mark data-logs-block are recorded as empty boxes of the same size;
  • other page text is recorded as the visitor saw it (SDK 0.8.0 and later).

So a recording shows what the visitor saw and did, but never what they typed or chose. Text your pages show is recorded unless you mark it, so mark the parts that show personal details:

HTML
<p data-logs-mask>Signed in as [email protected]</p>
<div data-logs-block>...</div>

data-logs-mask keeps an element's text masked, and data-logs-block records an element as an empty box whatever the other settings say.

Changed in SDK 0.8.0: page text is recorded

Up to SDK 0.7.0, recordings masked all page text by default. From 0.8.0, sessionReplay.maskAllText defaults to false: page text is recorded, while inputs, selects, rich text editors and anything marked data-logs-mask stay masked. The change takes effect when you install 0.8.0 and applies to recordings made from then on. Recordings already stored are not changed, and sites that stay on an older SDK keep masking all text.

If your pages show personal or confidential data as text, such as account names, addresses, order history or messages, mark those parts data-logs-mask before you upgrade, or keep masking all text:

JavaScript
init({
  key: "obi_...",
  host: "https://ingest.obistack.com",
  sessionReplay: { maskAllText: true },
});

Masking all text

With maskAllText: true, all page text and the text of title, alt, placeholder and aria-label attributes are replaced with asterisks, so a recording shows only the shape of the page. To show the parts that are safe, such as navigation, headings and button labels, mark them with data-logs-unmask (SDK 0.6.1 and later). Text, input values and text attributes inside a marked element are recorded as they are. Anything you did not mark stays masked, so forgetting a marker hides something rather than exposing it.

HTML
<nav data-logs-unmask>...</nav>
<h1 data-logs-unmask>Choose a plan</h1>
<section data-logs-unmask>
  <p data-logs-mask>Signed in as [email protected]</p>
</section>

The nearest marker wins: a data-logs-mask inside an unmasked element is still masked. data-logs-block always wins, and password fields are masked wherever they are.

Other masking options

JavaScript
init({
  key: "obi_...",
  host: "https://ingest.obistack.com",
  sessionReplay: {
    maskTextSelector: "[data-logs-mask], select, [contenteditable], .account-details", // mask these too
    blockSelector: "[data-logs-block], video", // show images, keep video blocked
    sampleRate: 0.5, // record half of all sessions
  },
});
sessionReplay optionDefaultWhat it does
maskAllInputstrueReplace every input, textarea and select value with asterisks. Passwords are masked either way.
maskAllTextfalseReplace all page text and readable text attributes with asterisks. Was true up to SDK 0.7.0.
maskTextSelector'[data-logs-mask], select, [contenteditable]:not([contenteditable="false"])'With maskAllText: false, the text that is still masked. Replaces the default, so keep the parts you want.
blockSelector"[data-logs-block], img, picture, video, audio, canvas, iframe, object, embed"Elements recorded as empty boxes. Replaces the default, so keep the parts you want.
sampleRate1Share of sessions recorded, from 0 to 1.

Before you change masking, check:

  • Addresses. Page addresses, link targets and image sources are kept without their query string or fragment (SDK 0.6.1 and later; recordings from 0.6.0 keep link targets in full). The path is kept, so keep tokens, email addresses and other personal data out of your URL paths.
  • Text you show. With maskAllText: false, the default, everything a visitor can read is recorded unless it matches maskTextSelector or blockSelector. Names, email addresses, addresses and account details on screen need one of those.
  • Images you show. Removing img from blockSelector records the image addresses, and the player loads those images from your site when someone watches. An image whose address needs its query string, such as a signed link, does not load in the player.

To keep a whole area of a page out of recordings, such as a payment form or an account screen, wrap it in an element marked data-logs-block.

Who can watch, and for how long

  • Anyone who can see a session's events in your workspace can watch its recording. A member limited to some data sees only the recordings of sessions they can see.
  • Recordings are stored apart from your events, in storage of their own, under your workspace and readable only through it.
  • Recordings are kept for 7 days after the session ends by default, then deleted. A workspace owner or admin can choose anywhere from 24 hours to 90 days: open Add-ons, then Configure on Website analytics. A recording is never kept longer than your own log retention, so it never outlives the session it belongs to. Shortening the period deletes older recordings within about 15 minutes.
  • Deleting the workspace deletes every recording with it. Deleting a person's profile does not delete their recordings early.

Who is recorded

Visitors who have opted out, or whose browser sends Do Not Track while respectDoNotTrack is on, are not recorded. If you need consent before recording, start opted out; see Consent. sampleRate records only a share of sessions. If a session was open in two tabs, the player has a tab picker. Mobile apps are not recorded.

If your site needs consent before tracking, start opted out:

JavaScript
const analytics = init({
  key: "obi_your_website_key",
  host: "https://ingest.obistack.com",
  optOutByDefault: true,
});

onConsentAccepted(() => analytics.optIn());
onConsentDeclined(() => analytics.optOut());

The choice persists across page loads, and analytics.hasOptedOut() reports it.

What you get

Every screen has a site picker (one website or all of them) and the same time range picker as the Log Explorer, starting on the last hour: a preset such as the last 24 hours or 7 days, any window you type such as the last 90 days, or a fixed date and time range up to a year long. Both are kept in the URL, so any view can be shared as a link. Retention picks 4, 8 or 12 weeks instead.

  • Overview - visitors, pageviews, sessions, bounce rate and session duration, each compared with the previous period, plus live visitors, referrers, UTM campaigns, countries, devices, browsers, operating systems, languages, timezones, custom events and top clicks.
  • Pages - views and visitors per page, with time on page, scroll depth, entries and exits.
  • Heatmaps - for one page at a time: the links, buttons and form controls visitors click, ranked, with rage clicks and how many visitors clicked each; where on the page clicks land, by screen height from the first screen down, with clicks on fixed headers and buttons counted separately; and how far visitors scroll before leaving, as the share who reached 25%, 50%, 75% and the bottom. These are numbers and bars, not a picture of your page: nothing loads, frames or draws over your site. Click positions need SDK 0.4.0 or later; the ranked elements and scroll depth work with every version.
  • Performance - Core Web Vitals from your real visitors' browsers: Largest Contentful Paint (how fast the main content appears), Interaction to Next Paint (how fast the page responds to a click or key press), Cumulative Layout Shift (how much the page jumps around) and First Contentful Paint. Each shows its 75th percentile, rated Good, Needs improvement or Poor against Google's thresholds, with a chart over time and a table of every page.
  • Funnels - how many sessions or visitors complete a sequence of pages, custom events and clicks within a time window, and where the rest drop off. Save a funnel with a name to come back to it, either private to you or shared with your workspace. A saved funnel keeps its steps, not a site or time range, so it works with whatever you have picked.
  • Paths - where visitors go next from any page, and where sessions start and end. Focus on a page to see the flow through it: where sessions came from and where they went next, drawn as one diagram you can click through page by page.
  • Sessions - every session, newest first, with the user id you passed to identify (opening that person), its recording, and a click-by-click timeline of what the visitor did, including any errors their browser hit along the way. Filter to the sessions that viewed a given page. Each session says when it was likely automated and why, and why a recording is missing; see Why a session looks the way it does.
  • People - everyone your site has identified, with their properties, the ids they were known by, and their sessions; see People.
  • Retention - weekly cohorts of returning visitors over 4, 8 or 12 weeks.

Pages whose address differs only by an id are counted together. A visit to /event/LJ9ja2ZjQN and one to /event/Xk2pQ9r7Ta are both shown as /event/[id] on the Overview, Pages, Heatmaps, Performance and Paths screens, so you see how event pages perform as a whole. A segment counts as an id when it is all digits, a UUID or a generated token such as LJ9ja2ZjQN; readable names such as my-first-post keep their own row. Session timelines always show the exact page.

Any chart, breakdown or timeline opens the Explorer on the same events.

Searching website events

Website events carry _service_type="user-analytics", so they can be searched like anything else:

_service_type="user-analytics" event="checkout_completed"

Useful fields include event, path, url, title, referrer, route (the path with ids replaced by [id]), referring_domain, utm_source and the other campaign fields, session_id, visitor_id, country (a two-letter code such as GB), browser, os, device_type, language, timezone, app_version and app_build (from an app), sdk, and properties.<name> for your own event properties.

An app's screen views are events named $screen, with the screen name in path:

_service_type="user-analytics" event="$screen" os="iOS"

Click positions arrive as events named $$heatmap, one per page every few seconds while a visitor is clicking, holding counts rather than single clicks: heatmap_clicks, heatmap_rageclicks, heatmap_fixed_clicks and heatmap_screen_1 to heatmap_screen_5 (clicks on the first screen of the page down to the fifth or further). They are not tied to a session. A rage click is 4 or more fast clicks on the same spot, each less than 750 ms after the last. Clicks that are normal to repeat never count: text fields, number inputs, sliders, selects, + and - steppers, pagination, next and previous buttons, video, audio and canvas. Add the class ph-no-rageclick to exclude any other element. The clicked elements themselves are $autocapture events with element_tag, element_text and element_href:

_service_type="user-analytics" event="$autocapture" path="/pricing" | stats count() by element_text

Web vitals are events named $web_vitals, with lcp_ms, inp_ms and fcp_ms in milliseconds and cls as a score:

_service_type="user-analytics" event="$web_vitals" path="/pricing"

Errors

The SDK captures front-end errors from your visitors' browsers by default:

  • Uncaught errors - anything thrown and not caught, such as TypeError: Cannot read properties of undefined.
  • Unhandled promise rejections - a failed fetch or async function with no .catch.
  • console.error calls - from your own code or a library. The message still prints in the browser console as usual.

Each error is stored with its type, message, the file and line it was raised on, the newest 20 lines of its stack, and the page, session and browser it happened in. It appears on that session's timeline, so you can see what the visitor did just before it broke. Errors from a script on another domain that the browser hides the details of ("Script error.") are skipped, and at most 30 errors are sent per minute from one page so an error in a loop cannot flood your workspace.

Errors are events named $exception:

_service_type="user-analytics" event="$exception" error_source="console"
FieldWhat it holds
error_typeThe error's name, such as TypeError.
error_messageThe message, with query strings removed from any URLs in it.
error_sourceuncaught, rejection, console, or manual for an error your code reported itself.
error_handledfalse for uncaught errors and rejections, true otherwise.
error_locationfile:line:column where it was raised, in your own code when that can be told apart.
error_stackUp to 20 stack lines, newest first.

Count errors per page with | stats count() by path, error_type, or set an alert on a spike. To capture only some kinds, pass an object, for example captureErrors: { console: false }; captureErrors: false turns error capture off.

Alerting

User Analytics > Alerts lists alerts we ship for your websites. They are all switched on when you turn the add-on on; switch off any you do not want, and one you switch off stays off. Each one fires separately for every website, opens an incident when it fires, and notifies your default notification groups and any destinations you give it.

AlertFires when, for one websiteLevel
Website traffic stoppedNo page views for an hour, after the site had some in the hours before.Warning
Front-end error rateMore than 5 uncaught errors or unhandled rejections per 100 page views over 15 minutes, for 10 minutes.Warning
Front-end error rate, criticalThe same, above 25 per 100 page views, for 5 minutes.Critical
Slow page loadsMore than a quarter of LCP measurements are slower than 4 seconds over an hour, for 30 minutes - the point where the Performance screen rates LCP Poor.Warning
Slow interactionsThe same for INP above 500 milliseconds.Warning
Layout shiftsThe same for CLS above 0.25.Warning
Rage clicksMore than 10 rage clicks per 100 page views over an hour, for 15 minutes.Warning

Open an alert to change its threshold, how long it measures over and how long the problem has to last, who it notifies, and how its incidents behave. Reset to shipped settings puts the numbers back. Its search and level are fixed. Switching an alert off pauses it and keeps its settings.

A site that gets no visitors overnight will fire Website traffic stopped every night: give it a longer window, or leave that alert off. On a site with only a few page views an hour, one error moves the error rate a long way, so lengthen the window there too.

For anything else, any alert rule can watch website events, for example pageviews on your checkout page dropping to zero, or a custom signup_completed event stopping.

Privacy

  • We read the IP once to find the country and never store it. The endpoint looks up the visitor's country from their IP address, keeps only the two-letter country code, and throws the address away. It is never written to your events, our logs or anywhere else, and it is never sent to another service: the lookup runs against a database on our own servers. An event that sets $geoip_disable: true gets no lookup at all. There is no city or region. VPNs and privacy relays show up as the country the visitor connects through, and a session without a country is shown as Unknown.
  • No query strings. Query strings and fragments are removed from page URLs, referrers and clicked links before anything is stored, along with advertising click ids.
  • Click positions only. A heatmap records where on the page a click landed and the visitor's window height, nothing about what was clicked or typed. Mouse movement is dropped from heatmaps at the endpoint; session recordings do include it. Set heatmaps: false to stop sending positions.
  • Person properties are checked before they are stored. Anything that looks like an email address, a phone number, a card number or a secret is withheld, query strings are removed from web addresses, and each profile is capped in size; see People. Properties are kept on the profile only, never on the events. Only identified users get a profile, and an Owner or Admin can delete one.
  • Recordings are masked before they leave the browser. Every input, select, rich text editor and all media are masked by default, and console output and network requests are never recorded. From SDK 0.8.0 other page text is recorded as shown unless you mark it data-logs-mask or set sessionReplay: { maskAllText: true }. Masking is set in your site's code, not in your workspace, and a recording cannot be unmasked later. Addresses in a recording lose their query strings and fragments; see Session replay.
  • Error messages are kept as written, apart from query strings in URLs. Avoid putting personal data in errors or console.error calls, or set captureErrors: false.
  • Do Not Track is your choice. Browsers that send it are captured like any other by default; set respectDoNotTrack: true to capture nothing from them. For consent, call the SDK's optOut() until the user agrees, and optIn() once they do. A visitor who has opted out sends nothing, so there is nothing to look up.
  • Your workspace only. The SDK is built on the open-source posthog-js library, configured to send only to the host you give it, never to PostHog, and it loads nothing from PostHog. Surveys, feature flags, dead-click detection and the rest of PostHog's cloud features are switched off. PostHog's mobile SDKs send only to the host you set, and the endpoint drops session recordings, surveys and flag events if an app sends them anyway.

The analytics key

An analytics key sits in your page source or your app's binary, so it is public by design. It is write-only and accepted only for website events: it cannot read data, and it cannot send log lines, metrics or traces. A secret ingest key is refused here too, so one pasted into a page by mistake does not quietly work.

Analytics keys, including the ones your apps use, are listed in Data Sources as User Analytics, where you can rename, disable or revoke one. Disabling a key stops it accepting events from the next request and deletes nothing; revoking it cannot be undone, and a site still using it stops sending analytics. A copied key is limited by a per-key rate limit, and rejected attempts appear in your workspace's security history.

Attribution

Countries come from the IP to Country Lite database by DB-IP, licensed under Creative Commons Attribution 4.0.

Not included yet

A heatmap drawn over a picture of your page, surveys, feature flags, experiments, location below country (region or city), replay of mobile apps, searching recordings by what happened in them, and recordings that expire before the workspace is deleted are not part of this add-on yet. Web vitals keep the four numbers per page, without the detail of which element was slow.