Skip to main content

Anonymous tracking for the React Native 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.

On React Native, the following user and session identifiers can be anonymized:

  • Client-side user identifiers:
    • user_id, domain_userid, network_userid, and user_ipaddress, set by you in Subject
    • userId, a device ID, set automatically in the session entity
    • For mobile only, IDFA identifiers (appleIdfa and appleIdfv for iOS, androidIdfa for Android) in the mobile entity if configured
  • Client-side session identifiers:
    • previousSessionId in the session entity, set automatically by the tracker
  • Server-side user identifiers:
    • network_userid and user_ipaddress, set by the Collector
User-set properties

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 in the Subject, that value has priority.

Similarly, if you set the network_userid property in the Subject, 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.

Available anonymization options

Because of a change in architecture, the anonymous tracking options for the React Native tracker changed between version 2.x and version 4.x.

FeatureVersion 4.xVersion 1.3 - 2.x
Full client-side anonymization
Client-side anonymization with session tracking
Toggle anonymous tracking at runtime
Server-side anonymization

1. Full client-side anonymization

In this case, you anonymize both client-side user identifiers and client-side session identifiers. This means disabling the session entity altogether.

typescript
const tracker = await newTracker({
namespace: 'appTracker',
endpoint: COLLECTOR_URL,
sessionContext: false, // Session entity won't be added to events
platformContext: false, // Mobile entity won't be added to events

});
IdentifierLocation in eventIncluded in event?
user_idAtomic✅ if set
domain_useridAtomic✅ if set
userIdSession entity❌ no session entity
sessionIdSession entity❌ no session entity
previousSessionIdSession entity❌ no session entity
appleIdfaMobile (platform) entity❌ no mobile entity
appleIdfvMobile (platform) entity❌ no mobile entity
androidIdfaMobile (platform) entity❌ no mobile entity
network_useridAtomic
user_ipaddressAtomic

2. Client-side anonymization with session tracking

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

Newer versions of the React Native tracker don't support client-side anonymization with session tracking. Unlike in version 2.x, you can't track the session entity with an anonymized userId.

3. Server-side anonymization

Server-side anonymization affects user identifiers set by the Collector: the network_userid property (set in the server-side cookie) and the user IP address. Use the serverAnonymization flag to prevent the Collector from setting these values.

Spelling

The new API uses the US English spelling "anonymization", rather than the British English "anonymisation" seen in the older API.

typescript
const tracker = await newTracker({
namespace: 'appTracker',
endpoint: COLLECTOR_URL,
serverAnonymization: true,
});

Setting this flag adds an SP-Anonymous HTTP header to requests sent to the Collector. The Snowplow pipeline then anonymizes the network_userid and user_ipaddress identifiers.

IdentifierLocation in eventIncluded in event?
user_idAtomic✅ if set
domain_useridAtomic✅ if set
userIdSession entity
sessionIdSession entity
previousSessionIdSession entity
appleIdfaMobile (platform) entity✅ if set
appleIdfvMobile (platform) entity✅ if set
androidIdfaMobile (platform) entity✅ if set
network_useridAtomic❌/✅ still present if you provided this in Subject
user_ipaddressAtomic❌/✅ still present if you provided this in Subject

4. Full anonymization

Full anonymization combines client-side and server-side anonymization to remove all user and session identifiers from events.

Avoid configuring unwanted identifiers for full anonymization in version 4.x of the React Native tracker.

typescript
const tracker = await newTracker({
namespace: 'appTracker',
endpoint: COLLECTOR_URL,
sessionContext: false, // No session entity
serverAnonymization: true, // Collector won't set network_userid or capture IP
},
});
IdentifierLocation in eventIncluded in event?
user_idAtomic✅ if set
domain_useridAtomic✅ if set
userIdSession entity❌ no session entity
sessionIdSession entity❌ no session entity
previousSessionIdSession entity❌ no session entity
appleIdfaMobile (platform) entity✅ if set
appleIdfvMobile (platform) entity✅ if set
androidIdfaMobile (platform) entity✅ if set
network_useridAtomic❌/✅ still present if you provided this in Subject
user_ipaddressAtomic❌/✅ still present if you provided this in Subject