Skip to content

Anonymous visitors

Observe public pages (a landing, a sign-up form, a pricing calculator) without knowing who the visitor is and without leaving an identifier on their device.

Applies to EngineCloud
View as Markdown
On this page
  1. Turn it on
  2. What changes on an anonymous route
  3. From an anonymous page to a signed-in one
  4. Privacy and consent
  5. In the engine and the console

Some pages of your app have visitors you do not know and should not track: the landing, a sign-up form, a price calculator, a page a customer’s family opens from a link. You still want to know whether they work: whether the form fails, where people give up, which button nobody can click.

Anonymous mode observes those pages without identity. It is a list of routes, anonymousRoutes, available from version 0.3.0 of @sypnia/telemetry.

Turn it on

In the browser, list the public routes in init:

src/sypnia.ts
import { init } from '@sypnia/telemetry/browser';

init({
  project: 'spk_…',
  // Signed-in areas: observed as before, with identify().
  allowRoutes: ['/app', '/settings'],
  // Public pages: observed anonymously.
  anonymousRoutes: ['/', '/pricing', '/signup', /^\/invite\/[^/]+$/],
});

A route in anonymousRoutes is observed even when allowRoutes does not list it. ignoreRoutes still wins over both.

On the server, give the same list so the requests those pages make are traced the same way:

Node
import { init } from '@sypnia/telemetry/node';

init({ anonymousRoutes: ['/', '/pricing', '/signup', '/api/public'] });
next.config.ts (Next.js)
export default withSypnia(nextConfig, {
  server: { anonymousRoutes: ['/', '/pricing', '/signup', '/api/public'] },
});

What changes on an anonymous route

Signed-in routesAnonymous routes
identify()Attaches the person and account to every eventIgnored. A call made there is kept in memory and only applies once the visitor reaches a route that is not anonymous.
person, account on eventsThe identified onesAlways null. Events carry anon: true.
Device id (did)32 hex in localStorage, sypnia:deviceNot created, not read, not sent.
Session idlocalStorage, shared by every tab, 30 minutes of inactivitysessionStorage (sypnia:anon), this tab only. Gone when the tab closes, or after 30 minutes of inactivity. No cookie.
Typed valuesNever capturedNever captured
Custom event properties (track)As you send themStrings scrubbed: e-mail addresses become [email], runs of 6 or more digits (phones, document numbers) become [number]. Numbers of 9 or more digits are dropped.
Click labels and contextThe visible text, unless maskAllTextScrubbed like properties. With anonymous.hideClickText, no label and no context at all.
Error messagesE-mails replacedE-mails and digit runs replaced
Replays and page snapshotsAs configuredOff. With anonymous.replay: true, on, with every text of the page masked.
Page views, clicks, rage and dead clicks, errors, failed calls, vitalsCapturedCaptured

anonymous options:

OptionDefaultWhat it does
replayfalseRecords replays and page snapshots on anonymous routes. Every text is masked there, whatever maskAllText says. The session’s replay decision is asked without person or account.
hideClickTextfalseSends no label and no context with clicks and form errors on anonymous routes: only the element’s position and its selector.

From an anonymous page to a signed-in one

A visitor who signs up on /signup and lands on /app in the same tab keeps one session: the trace of the sign-up continues into the app. Identity starts when your app calls identify() on the signed-in route.

  • The events sent before keep person: null. Nothing is rewritten after the fact.
  • The session in the list shows the person from that moment, because a session shows the latest identified person it saw. The session also shows that it had anonymous pages.

The other way round, a signed-in person who opens an anonymous route gets a separate anonymous session there, so a public page is never tied to someone’s account by its session.

This mode is designed to stay outside what needs a consent banner in most cases, but whether you need consent is your decision and depends on your law. What it does and does not do:

  • Nothing that lasts. No cookie, nothing in localStorage. The only stored value is a random session id in sessionStorage, deleted when the tab closes. It cannot recognise a returning visitor.
  • No identity. No person, no account, no device id. The engine stores the events with person empty.
  • What a request still carries. The engine receives the visitor’s IP address with every request, as any server does. Sypnia uses it for rate limits only and does not store it with the events.
  • What you send is yours. A custom property is scrubbed of the common patterns above, but a name or an address written into a property is not recognised. Do not put personal data in track() properties.

Under the GDPR, an anonymous session of this kind is often treated as data that does not identify a person. Combined with other data it might be, so check with whoever handles privacy for you before turning on anonymous.replay.

In the engine and the console

  • Each event keeps anon: true. Server spans of anonymous routes carry the attribute sypnia.anonymous = true, and their url.path is the route (/invite/:id), never the path with its ids or tokens (0.3.1).
  • A session that had anonymous pages has anonymous: true in GET /v1/sessions and in the session’s page.
  • GET /v1/sessions?anonymous=true lists only those sessions; anonymous=false, only sessions without anonymous pages.
  • The console’s session list has the same filter.

An engine without this field still stores the events of anonymous routes and shows their sessions, only without the filter: an event field it does not know is kept, never refused.

  1. Turn it on
  2. What changes on an anonymous route
  3. From an anonymous page to a signed-in one
  4. Privacy and consent
  5. In the engine and the console

    Search pages, sections and terms