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.
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:


You can also generate custom reports based on this dimension. 

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