Facebook Event Logging

In conjunction with the attribution and logging features provided by Attribution Analytics (AA), you can also log the AA-recorded events to Facebook by integrating the Facebook SDK (along with the TUNE SDK) into your app. The integration of these SDKs allows you to log events in both systems, so you can measure and optimize campaign performance in not only AA, but also Facebook App Insights and Facebook Ads. Please keep in mind that in AA, events attributed to Facebook appear as Organic because Facebook is not a AA-integrated partner.

When you enable Facebook event logging (as described below), AA invokes the Facebook AppEventsLogger class through reflection. Then, events passed in “measureEvent” calls will correspond with the following Facebook events:

AA Event Facebook Event
registration Registration
content_view Content View
search Search
rated Rating
tutorial_complete Tutorials Completed
add_to_cart Add to Cart
add_to_wishlist Add to Wishlist
checkout_initiated Initiated Checkout
added_payment_info Added Payment Info
purchase Purchases
level_achieved Levels Achieved
achievement_unlocked Achievements Unlocked
spent_credits Spent Credits

Any other event names passed to “measureEvent” get sent in their original form to Facebook Insights.

For event templates, please visit In-App Events with SDK.

For more information about the AppEventsLogger class in Facebook, please visit AppEventsLogger (Facebook).

Android

To enable Facebook event logging with AA, make sure that the Facebook SDK is integrated and your Facebook app id is set in res/values/strings.xml:

<string name="facebook_app_id">your_facebook_app_id_here</string>

The “facebook_app_id” value allows the Facebook SDK to find your app id.

Then, add a meta-data tag to your AndroidManifest.xml inside <application> referring to the FB app id string set previously:

<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>

Next, after initializing Tune in your Activity, call “setFacebookEventLogging“, passing in “true” to enable logging, the Activity context, and whether the user chose the FB opt-out for ads targeting:

tune = Tune.init(getApplicationContext(), "TUNE_ADVERTISER_ID", "TUNE_CONVERSION_KEY");
tune.setFacebookEventLogging(true, this, limitEventAndDataUsage);

(To disable logging, call “setFacebookEventLogging” with “false” instead.)

With Facebook event logging enabled, “measureSession” and “measureEvent” calls will trigger the following Facebook events:

  • First “measureSession” call on device -> App Installs
  • Subsequent “measureSession” calls -> App Launches
  • Events passed in “measureEvent” calls correspond with the Facebook events listed in the table at the top of this page.

iOS

To enable Facebook event logging with AA, make sure that the Facebook SDK is integrated and your FacebookAppId is set in Info.plist of your project. Also make sure that the “Other Linker Flags” build setting contains the “-ObjC” flag.

Next, after initializing Tune in your AppDelegate “application:didFinishLaunchingWithOptions:“, call “setFacebookEventLogging:limitEventAndDataUsage:“, passing YES as the first parameter (to enable Facebook event logging) and the appropriate value (YES/NO) for “limitEventAndDataUsage” to restrict the data sent to Facebook from being used for purposes other than analytics and conversions.

[Tune initializeWithTuneAdvertiserId:TUNE_ADVERTISER_ID
                               tuneConversionKey:TUNE_CONVERSION_KEY];
    
[Tune setFacebookEventLogging:YES limitEventAndDataUsage:NO];

(To disable Facebook event logging, call “setFacebookEventLogging:limitEventAndDataUsage:” and pass NO as the first parameter; in this case, the second parameter has no effect.)

With Facebook event logging enabled, “measureSession” and “measureEvent” calls will trigger the following Facebook events:

  • Calls to AA “measureSession” result in calls to FB “activateApp
  • Events passed in “measureEvent” calls will correspond with the Facebook events listed in the table at the top of this page.

No Comments

Leave a reply