Skip to main content
The Tappd Web SDK tracks every visitor from their very first page view — even before they create an account or log in. Each anonymous visitor gets a stable identifier stored in their browser, and the moment they identify themselves, all of their previous activity is automatically merged into their user profile.

How Anonymous Tracking Works

1

First Visit — Anonymous ID Generated

When the SDK initializes for the first time, it generates a unique anonymousId (for example, anon_xyz789abc123) and stores it in localStorage under the key _tappd_anonymous_id. All events from this point forward are tracked against that ID.
2

Anonymous Events Are Captured

Every track() and trackPageView() call is recorded with the anonymousId. You don’t need to do anything special — it all happens behind the scenes.
3

User Identifies — Events Are Merged

When the user logs in or signs up, call identify(). The SDK automatically links all previous anonymous events to the newly identified user.
4

Future Events Use the Identified User

After identify() is called, events are tracked with the identified user’s external_id. The anonymousId is retained as an alias for future matching.

Anonymous ID Persistence

The anonymous ID is designed to survive normal browser activity, but it resets when users explicitly clear their data.

Persists across...

  • Browser sessions
  • Tab refreshes
  • Browser restarts
  • Device reboots (same browser)

Resets when...

  • User clears browser data
  • User closes an incognito/private window
  • You call tappd.reset()
You can inspect the stored value directly:

Use Cases

Capture product browsing and cart activity before a user creates an account, then attribute that behavior to the new user automatically.

Getting the Anonymous ID

Resetting Anonymous Tracking

Call tappd.reset() when a user logs out. This clears the current identity, regenerates a fresh anonymousId, and ensures the next user on the same browser starts with a clean slate.
Avoid calling reset() unless the user is explicitly logging out. Unnecessary resets break the anonymous-to-identified journey and prevent historical data from merging correctly.

Data Privacy

Anonymous tracking is built with privacy compliance in mind:
  • No personal information is stored in the anonymousId
  • Fully GDPR compliant
  • Users can opt out via standard browser privacy settings
  • Anonymous data can be deleted on request

Troubleshooting

Cause: The browser has localStorage disabled or blocked.Fix: Check for localStorage support before initializing the SDK:
Cause: identify() was called without a valid external_id, or the anonymous context was lost before identification.Fix: Always pass a non-empty external_id when calling identify(). The SDK uses this to link the anonymous session to the user record server-side.