Skip to main content

User and session identifiers

Snowplow tracks several identifiers to help you understand user behavior across sessions and devices. These include tracker-generated IDs stored on the client, server-generated IDs from the Collector, and business user IDs you set in your app.

Understanding how these identifiers work enables you to build a complete picture of user journeys, whether through real-time identity resolution with Snowplow Identities, or identity stitching in your data models.

Read more about tracking identifiers in the OOTB user and session data page.

User identifiers

For identifiers in cookies, consider using the Cookie Lifetime Extension service to prevent identifier loss due to browser restrictions.

Tracker-generated

This on-device user identifier is generated by the tracker. It takes the form of a UUID, and is tracked differently on web or mobile.

It's the default identifier used in our dbt packages to identify users. The Unified Digital package coalesces the domain_userid and the userId property into a single user_identifier field, to make it easier to work with. The value can come from either place.

WebMobile
Event fielddomain_useriduserId
Location in eventAtomic event propertyClient session entity
Persistance mechanismBrowser cookiesApp user settings storage
Unified Digital fielduser_identifieruser_identifier
Mobile-specific identifiers

In mobile apps, there are additional on-device identifiers provided by the platform: advertising ID (IDFA) and vendor ID (IDFV, app set ID). These can be tracked in the mobile entity.

Server-generated

The Snowplow Collector generates the network_userid user identifier. It's a UUID that's returned in the Collector's HTTP response to the tracker, as the sp cookie in a Set-Cookie header.

Whether the network_userid persists between events or sessions depends on the tracker:

TrackerPersists within sessionPersists across sessionsMechanism
WebStored in sp cookie
iOSStored using HTTPCookieStorage
AndroidStored using SharedPreferences
React NativeDepends on platform used
FlutterDepends on platform used
Roku
Node.js
Golang
.NET
Java❌/✅Stored in memory by default; configure a CollectorCookieJar to persist the network_userid across sessions
Python
Scala
Ruby
Rust
PHP
C++❌/✅Stored in memory by default; configure a cookie_file to persist the network_userid across sessions
UnitySet all properties.
LuaSet user_id only.
Google Tag ManagerSame as for the web tracker: stored in sp cookie

Some trackers also allow you to set your own network_userid value.

Business-generated

The business-generated user identifier is an external identifier given to the tracker by the application. Most commonly it's the username or email address of the logged in user e.g. jane.doe@email.com.

It's tracked as the atomic user_id field. All Snowplow trackers have an API to set this identifier.

Snowplow ID

If you use Snowplow Identities, each event will receive a Snowplow ID from the resolved user profile. The ID is added in an identity entity. You can configure Identities to stitch together any identifiers for identity resolution.

IP address

Snowplow events also contain the IP address of the user. The value is stored in the atomic user_ipaddress property.

We don't recommend using the IP address as a primary identifier: multiple users can share an IP address, and a user's IP address can change frequently. However, it can be useful for certain use cases such as bot detection or geolocation.

Session identifiers

The main Snowplow session identifiers are the session ID and session index:

  • Session ID: a UUID generated by the tracker at the start of the session
  • Session index: the index of the session for the current user, based on the domain_userid or userId tracker-generated user identifier

They're tracked differently depending on the tracker. On web, they're tracked as the domain_sessionid and domain_sessionidx atomic event fields. In other trackers, they're part of the client session entity, which also includes other session-related information. Note that the web trackers can also track the client session entity, but not all trackers support session tracking.

Identity resolution

Identity resolution is the process of taking various user identifiers and combining them into a single user identifier, to better identify and track users throughout their journey on your site or app. It allows you to attribute logged-in and non-logged-in sessions back to a single user.

Snowplow offers two approaches to identity resolution:

We recommend setting the business user identifier, where possible, when using either approach.

Reset generated identifiers on web

If you're not using Identities, there's a risk of attributing sessions to the wrong user when multiple users share the same browser or device.

If this is a problem for you, the JavaScript tracker allows you to clear all user data. If you call this function when a user logs out, the tracker will generate new user and session identifiers for subsequent events. This feature is only available for the JavaScript tracker.

Anonymous tracking

The user and session identifiers, along with the IP address, are considered personal identifiable information (PII). Snowplow also allows you to track data without these identifiers: check out the anonymous tracking overview page.