Manage Shopper Tracking Preferences
In compliance with Salesforce’s core value of trust and respecting user privacy, the B2C Commerce platform offers a comprehensive mechanism for shoppers to control tracking preferences. Our Do Not Track (DNT) support provides compliance with local laws while giving shoppers control over how their data is used. Developers can seamlessly incorporate tracking preferences into their applications and respect shoppers’ choices.
Only existing customers can access some of the links on this page. Visit Salesforce Commerce Cloud GitHub Repositories and Access for information about how to get access to the Commerce Cloud repositories.
With SCAPI, when you get a SLAS token using getAccessToken, you specify a tracking preference. The tracking preference is respected for all requests using that token.
When you get an access token for a shopper, provide the query parameter dnt=true
to disable tracking. When a shopper opts out of tracking, the shopper's activity is no longer utilized to enhance strategy recommendations, and analytics tracking is disabled for services such as recently viewed and real-time personalized recommendations. For additional details, refer to B2C Commerce Do Not Track Impact and Set Privacy Preferences for B2C Commerce.
SCAPI provides the following capabilities for managing user tracking preferences:
- SLAS JWTs include the DNT claim, which, by default, is set to:
- 0 (tracking is enabled) for all requests except Trusted Agent on Behalf (TAOB). When
dnt=false
is provided, then the JWT contains the claimdnt:0
. - 1 (tracking is disabled) for TAOB requests. When
dnt=true
is provided, then the JWT contains the claimdnt:1
.
- 0 (tracking is enabled) for all requests except Trusted Agent on Behalf (TAOB). When
- SCAPI responses include a DNT HTTP response header reflecting the shopper's preference that was passed:
dnt:1
(disable tracking) ordnt:0
(enable tracking). - Tracking preferences are stored, so refreshing returns the same information unless you change the preference.
- If a shopper changes their tracking preference, use their refresh token to request a new token, and pass the new preference.
- For hooks and custom APIs, use session.isTrackingAllowed() to respect shoppers’ tracking preferences. For details, see the B2C Commerce Script API Documentation.
Allow tracking by default to maximize the quality of CommerceCloud report data. When tracking is disabled, personal identifiable information (PII) is stripped from collected data, which removes those records from appearing in select reports and dashboards.
To opt out of tracking, provide dnt=true
:
With custom APIs and hooks, you can use an external tracking service for orders and pass DNT preferences:
- Use session.isTrackingAllowed().
- Ensure that the DNT setting is passed on to third-party integrations or analytics components when making calls.
- B2C Commerce Privacy settings only impact controller behavior, not SCAPI behavior.
- You can use Business Manager to change the default tracking behavior in Controllers. For additional details, refer to B2C Commerce Do Not Track Impact and Set Privacy Preferences for B2C Commerce.