Disable Web SDK tracking
This guide uses code samples from v4 of the Braze Web SDK. If you’re not yet on v4 please follow our upgrade guide.
To comply with data privacy regulations, data tracking activity on the Web SDK can be stopped entirely using the method
This method will sync any data logged before
disableSDK() was called, and will cause all subsequent calls to the Braze Web SDK for this page and future page loads to be ignored. If you wish to resume data collection at a later point in time, you can use the
enableSDK() method to resume data collection.
If you wish to provide users with the option to stop tracking, we recommend building a simple page with two links or buttons, one that calls
disableSDK() when clicked, and another that calls
enableSDK() to allow users to opt back in. You can use these controls to start or stop tracking via other data sub-processors as well.
Note that the Braze SDK does not need to be initialized to call
disableSDK(), allowing you to disable tracking for fully anonymous users. Conversely,
enableSDK() does not initialize the Braze SDK so you must also call
initialize() afterward to enable tracking.