How to Integrate AppsFlyer with Google Analytics

  • Advertisers
  • Ad Networks

Introduction

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

 Important!

Some media sources restrict sharing data with 3rd parties. AppsFlyer cannot share user level data of users acquired through these media sources with 3rd party platforms or services. All installs from such media sources are therefore sent as organic.

For more details and a list of media sources that restrict sharing data with 3rd parties, click here.

The integration can be performed in two different ways:

  1. Integrating AppsFlyer’s Data with Google Analytics - Recommended
  2. Custom Dimensions on Google Analytics

1. Integrating AppsFlyer's Data with Google Analytics

Advertisers who work 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.

Setting Up Google Analytics

Go to the dashboard of your app and click on Integrated Partners on the left bar.

Integrated_Partners_link.png

Enter "Google Analytics" in the search field and click on its logo to open the Google Analytics configuration window.

The Google Analytics configuration window includes 4 tabs: Integration, Tracking link, Data Enrichment and Permissions. Click on the items below to read about the tabs setup.

For a detailed description of the Partner Configuration Window Header, click here.

Integration Tab

The Integration Tab is divided into different sections as described below.

General Settings

Account ID

Google Analytics connects with AppsFlyer via a unique Account ID. If you don't already have it, you must obtain it from Google Analytics to continue with the integration or follow the steps below.

Google_Analytics_msc_new_2.png

Obtaining the Account ID

From the Google Analytics admin window, copy your Tracking ID

mceclip3.png

 

Paste the Tracking ID in the Account_ID field.

Click Save to finish if you only want to send mobile installations data to GA.

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.

Default Postbacks

AppsFlyer can send automatic postbacks to Google Analytics user installs. Use this section to define sending these postbacks.

Events attributed to any partner or organic to send postbacks for any user that downloads the app to Google Analytics.

 

In-App Event Settings

Enter the Account ID again to enable in-app event postbacks.

In-App Event Postbacks

Toggle In-App Events Postback on to enable sending in-app event postbacks to GA.

ga-send-in-app-events.png

Select the events you wish to send to GA.

 Important!

You can only select events that have been sent in the past. If the event you want to select is not in the list, make sure it is sent at least once.

If you choose not to send the af_app_opened event, you cannot view session data in GA.

Tracking Link Tab

Tracking Links are not available for Google Analytics.
 

Data Enrichment Tab

Data Enrichment is not available for Google Analytics.

Permissions Tab

Permissions are not available for Google Analytics.

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.

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

 Note

This method requires you to integrate GA SDK in your app.

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.

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.

Android iOS
private static Tracker sTracker;
@Override
public void onInstallConversionDataLoaded(Map<String, String> conversionData)
{
  if (conversionData.get("af_status") == "Non-organic")
  {
    String mediaSource = conversionData.get("media_source");
    String campaign = conversionData.get("campaign");
    sTracker.set(Fields.customDimension(10), mediaSource);
    sTracker.set(Fields.customDimension(1), campaign);
  }
  else if (conversionData.get("af_status") == "Organic")
  {
    sTracker.set(Fields.customDimension(10), "Organic");
  }
}

Viewing AppsFlyer Data in GA Reports

AppsFlyer sends installs and in-app events as installs to GA. You can view the data that AppsFlyer sends in the events page in GA.

In your GA dashboard:

  1. Click on Behavior in the left-hand side menu
  2. Click on Events
  3. Click on Overview

ga-events-af.png

The screenshot above shows the event categories that AppsFlyer sends to GA. There are three types of events:

  • Organic - installs, sessions and in-app events of a user whose install is organic
  • Regular -  installs, sessions and in-app events of a user whose install is attributed to a media source
  • Re-Attribution - installs, sessions and in-app events of a user whose install is attributed to a media source and a retargeting campaign

Viewing Install Data

To view install data:

  1. In the overview page, click on regular-install
  2. In the next view, click on Secondary dimension
  3. Type the name of the dimension you want to view i.e. campaign or source / medium

    secondary-dimension-campaign.png

  4. Choose the secondary dimension

The table shows the name of the campaign for each install:

secondary-dimension-campaign-data.png

Viewing In-App Event Data

  1. In the overview page, click on regular-in-app-event
  2. Click on the event

    af_purchase.png

  3. In the next view, click on Secondary dimension
  4. Type the name of the dimension you want to view i.e. campaign or source / medium

    event_source.png

  5. Choose the secondary dimension

The table shows the name of the campaign (the selected secondary dimension) for each in-app event:

secondary-dimension-source-data.png

Viewing Session Data

Whenever a user opens the app, AppsFlyer sends an event to GA. The event is af_app_opened. This event is the equivalent of AppsFlyer session. 

GA shows session data in two places:

  1. The Audience overview page:

    af_ga_sessions.png
  2. The event overview page:
    • In your GA dashboard click on Behavior in the left-hand side menu
    • Click on Events
    • Click on Overview
    • Click on regular-in-app-event or organic-in-app-event
    • Click on af_app_opened

      af_app_opened.png
Was this article helpful?
1 out of 1 found this helpful