Skip to main content

User and session identifiers

Snowplow tracks a number of different identifiers to help you understand user behavior across sessions and devices. Read more about these in the identifiers overview page.

The main user and session identifiers are tracked as:

  • Atomic event properties
  • Session entity properties

User atomic event properties

These properties can be assigned using most Snowplow trackers, regardless of the platform.

Some trackers set certain user properties automatically, while others require you to set them manually using the tracker's API.

If you don't manually set an IP address or network_userid, the event Collector will automatically add them to the event based on the request HTTP headers and the Collector cookie. You can turn this feature off using server-side anonymization.

TrackerSupportedSince versionNotes
Web0.1.0Set user_id only. Tracker sets the domain_userid, network_userid, domain_sessionid, and domain_sessionidx automatically from cookies.
iOS0.5.0Set all properties except domain_sessionid and domain_sessionidx.
Android0.1.0Set all properties except domain_sessionid and domain_sessionidx.
React Native0.1.0Set all properties.
Flutter0.1.0Set user_id only on web. Set user_id, domain_userid, network_userid, and user_ipaddress on mobile.
Roku0.2.0Set user_id and network_userid only. You can automatically populate domain_userid, domain_sessionid, and domain_sessionidx by configuring sessionAsCookies.
Node.js0.8.0Set all properties.
Golang1.0.0Set all properties.
.NET0.1.0Set all properties.
Java0.10.0Set all properties.
Python0.13.0Set all properties.
Scala0.6.0Set all properties except domain_sessionid and domain_sessionidx.
Ruby0.3.0Set all properties.
Rust0.1.0Set all properties except domain_sessionidx.
PHP0.1.0Set all properties.
C++0.1.0Set user_id and user_ipaddress only.
Unity0.1.0Set all properties.
Lua0.1.0Set user_id only.
Google Tag ManagerSet using custom configuration.

Session entity

Some trackers can track an entity containing information about the current session.

This table shows the support for client_session entity tracking across the main Snowplow tracker SDKs:

TrackerSupportedSince versionAuto-tracking
Web3.5.0
iOS0.5.0
Android0.5.0
React Native1.0.0
Flutter0.2.0
Roku0.3.0
Node.js
Golang
.NET1.0.0
Java
Python
Scala
Ruby
Rust
PHP
C++1.0.0
Unity
Lua
Google Tag Managerv4

The client_session entity contains data such as the session identifier and session index, as well as information about the previous session to help analysis.

The userId property is the device ID.

client_session

Event
Schema for a client-generated user session
Schema URIiglu:com.snowplowanalytics.snowplow/client_session/jsonschema/1-0-2
Example
json
{
"sessionIndex": 7,
"sessionId": "bca0fa0e-853c-41cf-9cc4-15048f6f0ff5",
"previousSessionId": "fa008142-c427-4289-8424-6fb2b6576692",
"userId": "7a62ec9d-2aa0-4426-b014-eba2d0dcfebb",
"firstEventId": "1548BE58-4CE7-4A32-A5E8-2696ECE941F4",
"eventIndex": 66,
"storageMechanism": "SQLITE",
"firstEventTimestamp": "2022-01-01T00:00:00Z"
}
Properties and schema
PropertyDescription
userId
string
Required. An identifier for the user of the session. It is set on app install.
sessionId
string
Required. An identifier for the session
sessionIndex
integer
Required. The index of the current session for this user
eventIndex
null
Optional. Optional index of the current event in the session
previousSessionId
null
Required. The previous session identifier for this user
storageMechanism
string
Required. The mechanism that the session information has been stored on the device
Must be one of: SQLITE, COOKIE_1, COOKIE_3, LOCAL_STORAGE, FLASH_LSO
firstEventId
null
Optional. The optional identifier of the first event for this session
firstEventTimestamp
null
Optional. Optional date-time timestamp of when the first event in the session was tracked
Warehouse query
sql
select
unstruct_event_com_snowplowanalytics_snowplow_client_session_1_0_2
from
PIPELINE_NAME.events events
where
events.collector_tstamp > timestamp_sub(current_timestamp(), interval 1 hour)
and events.event = 'unstruct'
and events.event_name = 'client_session'
and events.event_vendor = 'com.snowplowanalytics.snowplow'

On this page

Want to see a custom demo?

Our technical experts are here to help.