In some cases, it is necessary to exclude users completely from tracking. For this purpose, the SDK provides an opt-out option. Internally, calling this method will delete all current tracking data cached in the database (if sendCurrentData is set to false), cancel the sending of requests, terminate the WorkManager, and disable all incoming tracking requests.

These are the possible options for an opt-out:

  • Complete opt-out while deleting all caching data without sending the data to the servers:

    Webtrekk.getInstance().optOut(value = true, sendCurrentData = false)
  • Current caching data will be sent to the servers before opting out:

    Webtrekk.getInstance().optOut(value = true, sendCurrentData = true)
  • Disabling the opt-out option:

    Webtrekk.getInstance().optOut(value = false)
  • Checking whether the opt-out option is active or not:

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