Automatic Logging
When you use the Facebook SDK, certain events in your app are automatically logged and collected for Facebook Analytics unless you disable automatic event logging. These events are relevant for all use cases - targeting, measurement and optimization.
Disable Automatically Logged Events
To disable automatic logging you must add certain fields to the manifest and info additions in your application descriptor.
- APM
- Manual
This value is set by configuration parameters in your project configuration. You most likely set this value initially when you ran through the extension configuration, but this will allow you to change it easily.
apm project config set facebookAutoLogAppEventsEnabled true
Once you have added this configuration run the steps to update / generate your application descriptor. This will apply to both iOS and Android.
For Android add the following line to your manifest additions:
<meta-data android:name="com.facebook.sdk.AutoLogAppEventsEnabled"
android:value="false"/>
This must be added inside the application
node of your manifest additions.
For iOS add the following to your info additions:
<key>FacebookAutoLogAppEventsEnabled</key>
<false/>
In some cases, you want to only delay the collection of automatically logged events, such as to obtain User consent or fulfill legal obligations. In this case disable the automatic logging as above and then once you have been provided consent call the setAutoLogAppEventsEnabled()
function:
Facebook.instance.setAutoLogAppEventsEnabled( true );
Similarly to suspend collection again for any reasons:
Facebook.instance.setAutoLogAppEventsEnabled( false );
Disable Collection of Advertiser IDs
To disable collection of the advertiser id, you must add certain fields to the manifest and info additions in your application descriptor.
- APM
- Manual
This value is set by configuration parameters in your project configuration. You most likely set this value initially when you ran through the extension configuration, but this will allow you to change it easily.
apm project config set facebookAdvertiserIDCollectionEnabled true
Once you have added this configuration run the steps to update / generate your application descriptor.
For Android add the following line to your manifest additions:
<meta-data android:name="com.facebook.sdk.AdvertiserIDCollectionEnabled"
android:value="false"/>
This must be added inside the application
node of your manifest additions.
For iOS add the following to your info additions:
<key>FacebookAdvertiserIDCollectionEnabled</key>
<false/>
In some cases, you want to delay the collection of the advertiser id, such as to obtain User consent or fulfill legal obligations, instead of disabling it.
In this case disable the collection of the advertiser id as above and then once you have been provided consent call the setAdvertiserIDCollectionEnabled
function:
Facebook.instance.setAdvertiserIDCollectionEnabled( true );
Similarly to suspend collection again for any reasons:
Facebook.instance.setAdvertiserIDCollectionEnabled( false );