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)
    JAVA
  • Current caching data will be sent to the servers before opting out:

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

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

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