Opt-out of Tracking

Prev Next

In certain cases, you may need to fully exclude users from tracking. The Mapp SDK provides an opt-out mechanism to achieve this. When a user opts out, all cached tracking data will be deleted (if sendCurrentData is set to false), requests will be canceled, the WorkManager will terminate, and no further tracking requests will be processed.

Opt-out Options

Here are the different ways you can implement the opt-out functionality:

  1. Complete Opt-out Without Sending Cached Data

    This option deletes all cached data without sending it to the servers:

    Webtrekk.getInstance().optOut(value = true, sendCurrentData = false)

  2. Complete Opt-out With Cached Data Sent to Servers

    This option sends the cached data to the servers before opting out:

    Webtrekk.getInstance().optOut(value = true, sendCurrentData = true)

  3. Disable Opt-out Option

    To disable the opt-out and re-enable tracking:

    Webtrekk.getInstance().optOut(value = false)

  4. Check if Opt-out is Active

    To verify whether the opt-out option is currently enabled:

    Webtrekk.getInstance().hasOptOut() // Returns true if opt out is active