How to Integrate AppsFlyer with Google Analytics

Introduction

The purpose of this article is to describe how to integrate AppsFlyer with Google Analytics.  Once integrated AppsFlyer data is presented in the Google Analytics dashboard.

The integration can be performed in three different ways:

1.  Integrating AppsFlyer’s Data with Google Analytics

2.  Custom Dimensions on Google Analytics

3.  UTM Parameters (not recommended)

1. Integrating AppsFlyer's Data with Google Analytics

Advertisers who are used to working with Google Analytics (GA) can easily supplement GA information with rich mobile attribution data from AppsFlyer, for both iOS and Android apps. 

For every new install or in-app event AppsFlyer can automatically send a postback with the following attribution data to GA:

  • Media source name (utm_source)
  • Campaign name (utm_campaign)
  • Google search Keywords (utm_term)
  • Country code (Geo)
  • App ID
  • App Name
  • Bundle ID
  • App version
  • CID (Advertising ID for Android or IDFA for iOS)
  • Type (install / in-app event)
  • Event name (as sent from AF SDK)

AppsFlyer also sends all organic installs and events data to GA. Please note that organic data has no source information associated with it.

Configuring Google Analytics on AppsFlyer's Dashboard

For each app you want to send the attribution data from:

  1. Click Integrated Partners on the left menu bar

    Integrated_Partner.png

  2. Begin entering Google Analytics Solutions and then click the Google Analytics Solutions logo

  3. From the Google Analytics admin window, copy your Tracking ID
  4. From AppsFlyer's Partner Integration Configuration window select Enable to integrate and send all installs to Google Analytics.
  5. Paste the Tracking ID in the Account_ID field.
  6. Click Save & Close to finish if you only want to send mobile installations data to GA.

  7. To send your mobile users’ in-app events data to GA click the In App Events tab
  8. Select All in-app events option from the drop-down box
  9. Paste your Tracking ID on the Account ID box
  10. Select the Map all SDK events option or manually select the specific events to be sent to GA
  11. Click Save & Close

AppsFlyer and Google Analytics SDKs

If your app has both the AppsFlyer and GA SDKs integrated in it, then you must set the Client ID (CID) parameter value to match between the two SDKs. GA’s SDK creates a unique CID upon initialization, while for AppsFlyer the value sent as CID is the unique Device ID (GAID for Android and IDFA for iOS). If these values are not matched, data reported on GA’s platform is duplicated.

To avoid duplicate data reporting you must perform ONE of the following options:

If you choose the first option leave the Enable sending CustomerUserID button toggled to off (see below).
For the second option you must toggle the button to "On".

The correct time to perform the tracking, as described, is after the new version has been submitted and updated by the majority of your active users.

If your app has only the AppsFlyer’s SDK, then no code changes are required.

Migrating from the Old UTM Parameters System

AppsFlyer also supports an older integration method with Google Analytics. For details, click here.

If your app is already using the older integration method it has to be disabled first or the result is duplicate results on GA when both methods are activated at the same time.  Contact AppsFlyer Support or your CSM to perform the switch over between the two methods to avoid any duplicates or loss of data.

 Note

As with all 3rd party platforms, Google Analytics receives all Facebook and Twitter data labeled as “organic” due to their T&Cs.

2.  Custom Dimensions on Google Analytics

There is another available method for sending AppsFlyer's attribution data to Google analytics, that is set up on GA and not on AppsFlyer's dashboard. You can read about it here.

Advertisers that use the new integration with Google Analytics don't need to use the custom dimensions method. 

2. Setting Media Source as Custom Dimension on Google Analytics

Google Analytics has a powerful tool to track user-level segmentation called custom dimensions. The custom dimension values are sent from mobile devices and your reports are generated, based on these dimensions from your Google Analytics dashboard.
 

 Note

Some media sources prohibit the sending of user level data to 3rd parties as described in their terms of service, e.g. Facebook, Twitter, Snapchat etc.

Step 1 - Define it on Google Analytics

  • Select your app from the GA menu.
  • Select Admin at the top bar on GA dashboard.
  • On the PROPERTY column select Custom Definition  
  • Select Custom Dimensions

  • Create a new dimension. Call it AppsFlyer Media Source and make sure you select User scope.  This ensures the data is saved over multiple sessions.

ga2.png

Every dimension is created with an index which you must remember so you can later use it in the GA API from your app. In this example the index of our new dimension is 10.


Repeat this step and create another dimension and call it AppsFlyer Campaign

Step 2 - Setting and Sending the Data from the App

First we need to get the media source value from AppsFlyer SDK. This can be performed on the AppsFlyerTrackerDelegate method onConversionDataReceived.
 
-(void)onConversionDataReceived:(NSDictionary*) installData {
    id status = [installData objectForKey:@"af_status"];
    if([status isEqualToString:@"Non-organic"]) {
    id mediaSource = [installData objectForKey:@"media_source"];
    id campaign = [installData objectForKey:@"campaign"];
    [[[GAI sharedInstance] defaultTracker] set:[GAIFields customDimensionForIndex:10] value: mediaSource];
        [[[GAI sharedInstance] defaultTracker] set:[GAIFields customDimensionForIndex:1] value: campaign];
      } else if([status isEqualToString:@"Organic"]) {
      [[[GAI sharedInstance] defaultTracker] set:[GAIFields customDimensionForIndex:10] value: "Organic"];
        } 
}

Step 3 - Generate Reports

Most of GA reports have a drill-down option called Secondary Dimension. You can select the new dimensions from this drill-down:

Example:

You can also generate custom reports based on this dimension. 

3. UTM Parameters

UTM parameters is a method for sending AppsFlyer's attribution data to Google Analytics.
UTM parameters are tags added to a URL — when the AppsFlyer Tracking Link is clicked, the tags are added to the Google Play URL.

However, UTM parameters don't work in most cases. Ad Networks with a server-to-server integration (i.e. Facebook, Twitter, etc.) are currently not supported. Also, if AppsFlyer is not the last party redirecting to Google Play this method does not work.

If you are still using UTM parameters it is highly recommended to use one of the preferred methods detailed above.

UTM Parameters Details

 Notes

  • To enable UTM parameters to be added to the link, contact your AppsFlyer Customer Success Manager.
  • This article is relevant for Android apps only. 

When enabled, we automatically add two parameters to the click URL when forwarding the traffic to the Google Play Store (as a part of the 'referrer' value):

utm_source
Set to the media source name (i.e. the value of the 'pid' parameter on the click URL)
utm_campaign
Set to the campaign name (i.e. the value of the 'c' parameter on the click URL)

In addition, when one of the following parameters explicitly appears on the AppsFlyer tracking link, we add it to the Google Play redirected link:

  • utm_source (overrides the 'pid' value)
  • utm_campaign (overrides the 'c' value)
  • utm_medium
  • utm_term
  • utm_content

There are two ways to retrieve these values from Google Analytics or the Google Play Campaigns Measurement API:

Was this article helpful?
0 out of 0 found this helpful