Skip to main content

Enable anonymous tracking with the Flutter tracker

Anonymous tracking is a feature that enables anonymization of various user and session identifiers, to support user privacy when consent for tracking the identifiers isn't given.

This table shows the user and session identifiers that can be anonymized on web and mobile:

IdentifierLocation in eventTracked on webTracked on mobile
user_idAtomic
domain_useridAtomic✅ Non-configurable
domain_sessionidAtomic✅ Non-configurable
domain_sessionidxAtomic✅ Non-configurable
userIdSession entity✅ Non-configurable, same as domain_userid✅ Non-configurable
sessionIdSession entity✅ Non-configurable✅ Non-configurable
previousSessionIdSession entity✅ Non-configurable✅ Non-configurable
appleIdfaMobile (platform) entity
appleIdfvMobile (platform) entity
androidIdfaMobile (platform) entity
network_useridAtomic✅ Non-configurable
user_ipaddressAtomic✅ Non-configurable

You can set some of these properties at tracker initialization.

Network properties on mobile

The Collector captures the IP address from the request HTTP headers, and updates the user_ipaddress event property. However, if you set the user_ipaddress property at initialization, that value has priority.

Similarly, if you set the network_userid property, that value is used instead of the Collector cookie value.

Read more about anonymous tracking in the overview page.

There are several levels to the anonymization depending on which of the categories are affected.

1. Full client-side anonymization

In this case, we want to anonymize both the client-side user identifiers as well as the client-side session identifiers. Here the Session entity is not configured: no session information will be tracked at all.

dart
const TrackerConfiguration()
.userAnonymisation(true)
.sessionContext(false)
.platformContext(true) // only relevant for mobile

On web, setting userAnonymisation stops any user identifiers or session information being stored in cookies or localStorage. This means that domain_userid, domain_sessionid, and domain_sessionidx will be anonymized. These properties are already not present in any mobile events.

On mobile, setting userAnonymisation affects properties in the Session and Platform entities. In this example, the Platform entity is enabled. The appleIdfv Platform property would be anonymized, as well as appleIdfa/androidIdfa if your app is configured to track those.

IdentifierLocation in eventIncluded in event?
user_idAtomic
domain_useridAtomic
domain_sessionidAtomic
domain_sessionidxAtomic
userIdSession entity❌ no session entity
sessionIdSession entity❌ no session entity
previousSessionIdSession entity❌ no session entity
appleIdfaMobile (platform) entityN/A
appleIdfvMobile (platform) entityN/A
androidIdfaMobile (platform) entityN/A
network_useridAtomic
user_ipaddressAtomic

2. Client-side anonymization with session tracking

This setting disables client-side user identifiers but tracks session information.

dart
const TrackerConfiguration()
.userAnonymisation(true)
.sessionContext(true)
.platformContext(true) // only relevant for mobile

Enabling both userAnonymisation and sessionContext means that events will have the Session entity, but the userId property will be anonymised to a null UUID (00000000-0000-0000-0000-000000000000). The sessionId and sessionIndex are still present, as are domain_sessionid and domain_sessionidx for web events. As above, if the Platform entity is enabled, the IDFA identifiers will not be present.

IdentifierLocation in eventIncluded in event?
user_idAtomic
domain_useridAtomic
domain_sessionidAtomic
domain_sessionidxAtomic
userIdSession entity❌ null UUID
sessionIdSession entity
previousSessionIdSession entity
appleIdfaMobile (platform) entityN/A
appleIdfvMobile (platform) entityN/A
androidIdfaMobile (platform) entityN/A
network_useridAtomic
user_ipaddressAtomic

3. Server-side anonymization

Server-side anonymization affects user identifiers set server-side. In particular, these are the network_userid property set in server-side cookie and the user IP address (user_ipaddress). You can anonymize the properties using the serverAnonymisation flag in EmitterConfiguration:

dart
const EmitterConfiguration()
.serverAnonymisation(true)

Setting this will add a SP-Anonymous HTTP header to requests sent to the Snowplow collector. The Snowplow pipeline will anonymize the identifiers.

On mobile, serverAnonymisation and userAnonymisation are separate. This means you can anonymize only the server-side identifiers without also anonymizing the client-side identifiers.

On web, setting serverAnonymisation provides full anonymization. It's effectively a subset of userAnonymisation. If serverAnonymisation is enabled, this will also set userAnonymisation to true (even if set to false in your TrackerConfiguration).

IdentifierLocation in eventIncluded in event?
user_idAtomic
domain_useridAtomic
domain_sessionidAtomic
domain_sessionidxAtomic
userIdSession entity❌ no session entity
sessionIdSession entity❌ no session entity
previousSessionIdSession entity❌ no session entity
appleIdfaMobile (platform) entityN/A
appleIdfvMobile (platform) entityN/A
androidIdfaMobile (platform) entityN/A
network_useridAtomic
user_ipaddressAtomic

4. Full anonymization for mobile

For full anonymization on mobile, set both client-side and server-side anonymization.

dart
const TrackerConfiguration()
.userAnonymisation(true)
.sessionContext(false)
.platformContext(true) // only relevant for mobile

const EmitterConfiguration()
.serverAnonymisation(true)
IdentifierLocation in eventIncluded in event?
user_idAtomic
domain_useridAtomic
domain_sessionidAtomicN/A
domain_sessionidxAtomicN/A
userIdSession entity❌ no session entity
sessionIdSession entity❌ no session entity
previousSessionIdSession entity❌ no session entity
appleIdfaMobile (platform) entity
appleIdfvMobile (platform) entity
androidIdfaMobile (platform) entity
network_useridAtomic
user_ipaddressAtomic