At a glance: Send rich mobile attribution data from AppsFlyer to Google Analytics (GA). This feature works with iOS and Android apps.
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. Installs from such media sources are 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:
- Integrating AppsFlyer’s Data with Google Analytics - Recommended
- Custom Dimensions on Google Analytics - Not Recommended
Notes concerning UTMs
AppsFlyer doesn't recommend manually adding UTM parameters to attribution links.
Doing so is only supported in cases where AppsFlyer directly sends the user to Google Play. In SRNs and ad networks that operate using server-to-server clicks, this is not supported. For example, if a user comes from an SRN or an ad network that reports clicks to AppsFlyer using server-to-server but sends the user to Google Play, AppsFlyer is unable to report these installs to Google Analytics.
Also, with UTMs AppsFlyer can only send installs to Google Analytics but not in-app events.
Reporting data to Google Analytics
For each new install or in-app event, a postback is sent from AppsFlyer to GA with the following attribution data:
AppsFlyer Fields | Google Analytics Dimensions |
---|---|
Media source name (pid parameter on the attribution link) | Source (utm_source) |
Campaign name (c parameter on the attribution link) | Campaign (utm_campaign) |
Google search Keywords | Keyword (utm_term) |
Country code (GEO) | Country ISO Code |
App ID (package name on the attribution link) | App ID |
App Name (package name on the attribution link) | App Name |
App Version | App Version |
CID (Advertising ID for Android or IDFA for iOS) | Client Id - appears in the audience dashboard on Google Analytics |
Type | Event Category |
Event Name | Event Action / Event Label |
Setting up Google Analytics
Go to the dashboard of your app and click on Integrated Partners on the left menu.
Enter "Google Analytics" in the search field and click on its logo to open the Google Analytics configuration window.
The Google Analytics configuration window only makes use of the Integration tab.
For a detailed description of the Partner Configuration Window Header, click here.
Integration tab
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.
Obtaining the account ID
From the Google Analytics admin window, copy your Tracking ID.
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 into 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 in GA’s platform gets duplicated.
To avoid duplicate data reporting do the following:
- Set the CID (in GA SDK) value to the unique Device ID (GAID or IDFA) of the new user.
- Toggle off sending CustomerUserID (see below).
If your app has only the AppsFlyer’s SDK, then no code changes are required.
Default postbacks
AppsFlyer sends automatic postbacks to Google Analytics following user installs. Use this section to define sending these postbacks.
Select Events attributed to any partner or organic to send postbacks for any user that installs your app.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.
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.
Attribution link tab
Cost tab
Cost data is not supported in the integration with Google Analytics.
Ad revenue tab
Ad Revenue is not supported in the integration with Google Analytics.
Permissions tab
Permissions are not available for Google Analytics.
Viewing AppsFlyer data in GA reports
AppsFlyer sends installs and in-app events as events to GA. You can view the data that AppsFlyer sends in the events page in GA.
In your GA dashboard:
- Click on Behavior in the left-hand side menu
- Click on Events
- Click on Overview
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
Currently, app open and events from reengagement are reported but not under a reengagement category. App open and events following reengagement are reported to Google Analytics according to the install type that precedes the reengagement.
For example, a user installs the app after engaging an ad. A non-organic install is reported to Google Analytics. Some time later, the user engages with a reengagment campaign and performs a few in-app events. The app open and subsequent events are reported under a the regular (non-organic) install category. So the events appear under the regular-in-app event category.
Viewing install data
- In the overview page, click on regular-install
- In the next view, click on Secondary dimension
- Type the name of the dimension you want to view i.e. campaign or source / medium
- Choose the secondary dimension
The table shows the name of the campaign for each install:
Viewing in-app event data
- In the overview page, click on regular-in-app-event
- Click on the event
- In the next view, click on Secondary dimension
- Type the name of the dimension you want to view i.e. campaign or source / medium
- Choose the secondary dimension
The table shows the name of the campaign (the selected secondary dimension) for each in-app event:
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.
Important!
AppsFlyer and Google Analytics each have different definitions of and ways of counting sessions. See here to learn more.
GA shows session data in two places:
- The Audience overview page:
Note
The data here conforms to Google's definition of a session.
- 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
Note
The data here conforms to AppsFlyer's definition of a session.
Custom dimensions on Google Analytics
There is another method for sending AppsFlyer's attribution data to Google analytics, that is set up on GA and not on AppsFlyer's dashboard.
Important!
The Custom Dimensions method IS NOT RECOMMENDED due to the following:
- Integrating Google Analytics through AppsFlyer dashboard is simple, quick and easy
- Integrating Google Analytics using Custom Dimensions is complicated and error-prone
- Using Custom Dimensions requires you to use both AppsFlyer SDK and Google Analytics SDK
- Using Custom Dimensions has a greater potential of causing discrepancies
Advertisers that use the new integration with Google Analytics don't need to use the custom dimensions method.
Setting media source as a custom dimension on Google Analytics
Google Analytics has a powerful tool to create 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.
Each 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 the 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, you need to get the media source value from AppsFlyer SDK. You can do this using the method onConversionDataSuccess
.
Note: Starting SDK V5, onConversionDataSuccess
is the name of the method for getting conversion data. If you are using an SDK version lower than 5.0.0, the name of the method is onInstallConversionDataLoaded
in Android and onConversionDataReceived
in iOS. We recommend that you upgrade to SDK 5.0.0. To learn more, click here.
Then, you can set the media source as custom dimension using Google Analytics SDK. See the following code samples to learn how to do it:
private static Tracker sTracker;
@Override
public void onConversionDataSuccess(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");
}
}
-(void)onConversionDataSuccess:(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: See the results in Google Analytics
Most GA reports have a drill-down option called Custom Dimensions. You can select the dimensions AppsFlyer Media Source or AppsFlyer Campaign (set in step 1) to see which media sources and campaigns bring users that install your app.
Discrepancies in data between AppsFlyer and Google Analytics
Discrepancies between AppsFlyer and Google Analytics are highly unlikely. This is because AppsFlyer is the only source of data and the one that reports to Google Analytics.
However, discrepancies might still occur (especially due to re-installs) when comparing AppsFlyer and Google Analytics. Below we list several reasons why that might happen.
Incorrect tracking ID
Make sure to specify the correct Google Analytics Tracking ID when integrating with AppsFlyer. If you set an incorrect tracking ID, data might be reported to the wrong dashboard or not reported at all.
Example
The Google Analytics Tracking ID has the format of UA-123456789-1
. This is the tracking ID that you should specify in the integration.UA-123456789
, 123456789-1
and 123456789
are incorrect formats.
Customer user ID
Google Analytics associates events by Customer User ID. The Customer User ID that AppsFlyer sends by default is GAID or IDFA.
Therefore, Google Analytics sees re-installing users (users who install, uninstall and then reinstall) as the same users.
Example
A user installs your app and then uninstalls it. The user then re-installs the app through a retargeting campaign within the re-attribution window.
Google Analytics sees this user as the same user. In User Explorer in Google Analytics, this user has listed under them all of the following:
- regular-install
- regular-in-app-event
- reattribution-install
- reattribution-in-app-event
AppsFlyer, on the other hand, sees this user as two different users:
- A user that comes from a UA campaign
- A user that comes from a retargeting campaign
Time zone differences
If the time zone of your GA dashboard differs from that of your app's timezone in AppsFlyer, data might not align.
Example
Your app's dashboard is configured to GMT +13 and your GA dashboard is configured to GMT. This means that your app's dashboard is ahead of your GA's dashboard by one day.
Therefore, data that appears in GA dashboard for March 2nd only appears in your app's dashboard if you choose March 3rd in the date range filter.
Duplicate events
If events occur in close proximity to each other, both AppsFlyer and Google Analytics might drop them as duplicate events. AppsFlyer's event deduplication mechanism is different than the one that Google Analytics uses.
Because AppsFlyer and Google Analytics deduplicate events differently, discrepancies in events data might occur.
Session count
AppsFlyer counts sessions each time the app is launched or comes back to the foreground. Google Analytics counts sessions according to CID (customer user id) and activity.
Example
A user launches your app, performs some actions and then sends the app to the background. The user then repeats the process 4 times, each time in an interval of about 5 minutes.
To AppsFlyer, this counts as 5 different sessions. However, to Google Analytics this counts as a single session.
To learn more about how AppsFlyer and Google Analytics calculate sessions, check the resources below.
Google Analytics views and filters
Google Analytics allows you to create different views and apply different filters to them. When you compare data from AppsFlyer and Google Analytics, make sure you view data in the All Web Site Data view in Google Analytics.