27

I'm using Facebook App Events tracking for Android, but I have no idea how to disable tracking when a user wants to opt out! Does anyone know how to do that?

The documentation says:

We recommend that you use our SDK tools to offer the opt-out.

But they don't actually describe it anywhere. Classic Facebook move.

EDIT: Now with the GDPR being in effect for so long, they still don't have any way to disable all tracking until the user consents, do they?

0101100101
  • 5,786
  • 6
  • 31
  • 55

3 Answers3

10

After the documentation was updated it seems the new way to go is a combination of disabling

<meta-data android:name="com.facebook.sdk.AutoLogAppEventsEnabled"
        android:value="false"/>
<meta-data android:name="com.facebook.sdk.AdvertiserIDCollectionEnabled"
        android:value="false"/>
<meta-data android:name="com.facebook.sdk.AutoInitEnabled"
        android:value="false"/> <!--OPTIONAL-->

And at runtime to opt in call:

FacebookSdk.setAutoLogAppEventsEnabled(true)
FacebookSdk.setAdvertiserIDCollectionEnabled(true)
// OPTIONALLY the following line if AutoInitEnabled is set to false in manifest:
FacebookSdk.setAutoInitEnabled(true) // automatically calls FacebookSdk.fullyInitialize() under the hood

Right now I don't see when it would be good to disable (and later enable) auto init, maybe someone else might have an idea here.

0101100101
  • 5,786
  • 6
  • 31
  • 55
9

Don't know about per User, but you can opt put from Facebook SDK event logging:

Add this int your Android.Manifest.xml:

<meta-data android:name="com.facebook.sdk.AutoLogAppEventsEnabled"
            android:value="false"/>
Bhavana Vadodariya
  • 2,287
  • 1
  • 19
  • 26
  • 1
    Logging can be enabled again with `FacebookSdk.setAutoLogAppEventsEnabled(true);` after user provides his consent if needed. – kphil Jan 03 '19 at 18:26
0

The opt-out they are talking about is described in the heading below: https://developers.facebook.com/docs/app-events/android#setlimiteventusage

You can call AppEventsLogger.setLimitEventUsage(this, true); to "opt-out" (at least limit) how the events logged are used.

Roy Solberg
  • 18,133
  • 12
  • 49
  • 76
  • 1
    I suppose, but does that means there is no way of disabling any tracking whatsoever? For example, Firebase offers the method `setAnalyticsCollectionEnabled`. Enforcing tracking without any opt-out option is illegal in many countries. – 0101100101 Oct 17 '16 at 09:22
  • 3
    Facebook does not seem to offer that. :( Your best shot is probably to dealing with activating and manual logging either via some log wrapper of your own or with some condition checking on each call to their SDK. If you activate the logging in Application.onCreate() the user's option to opt-in or -out will be activated on next full application launch. – Roy Solberg Oct 17 '16 at 10:04
  • "Facebook may continue to use the information for other purposes, including frequency capping, conversion events, estimating the number of unique users, security and fraud detection, and debugging." – Hogdotmac Jun 07 '19 at 12:14