Uncategorized

Community Tip: Measuring the Value of Mobile Ad Campaigns

This Community Tip provides a step-by-step guide to use Mixpanel with a mobile ad attribution partner to understand the effectiveness of your campaigns. Mixpanel automatically tracks source attribution on the web by capturing any referrer or utm information, however there’s no immediate means to accomplish similar tracking through the iOS app store. Instead, Mixpanel customers often work with a third party tool.

Installing your Attribution SDK

Attribution through the iOS app store requires that you use a third party service to capture an “App Install” event and link it to an advertisement. Various mobile attribution companies including AppsFlyer, Kochava, TapStream, Tune (HasOffers & MobileAppTracking), and others integration with Mixpanel’s flexible tracking API. For this example, we’ll focus on implementing with AppsFlyer, but the process is virtually identical for most providers.

The first step is to download the AppsFlyer SDK here. You’ll then embed the SDK into your iOS app, and add the AppsFlyer header and library files into your project. Finally, inside didFinishLaunchingWithOptions or applicationDidBecomeActive, you’ll initialize the AppsFlyer SDK.

Here’s an example below with AppsFlyer initialized in applicationDidBecomeActive.

- (void)applicationDidBecomeActive:(UIApplication )application
{
    / Initialize AppsFlyer */
    [AppsFlyerTracker sharedTracker].appleAppID = @"YOUR APP ID"; // The Apple app ID. Example 34567899
    [AppsFlyerTracker sharedTracker].appsFlyerDevKey = @"YOUR APPSFLYER DEVELOPER KEY";
    // You can get this key at the configuration page of your app on AppsFlyer's dashboard.
    [[AppsFlyerTracker sharedTracker] trackAppLaunch]; //***** THIS LINE IS MANDATORY *****
    // load the conversion data
    [AppsFlyerTracker sharedTracker].delegate = self;
}

That takes care of initializing AppsFlyer, however you’ll also need another method inside your implementation file where you’ll actually capture and send that initial app install event to Mixpanel.

Sending the Install Event to Mixpanel

Once a user installs your application, you’re going to use a method called deferred deep-linking to grab the install event from the client and send that data to Mixpanel. AppsFlyer (and other Attribution Providers) listen for the app install and when a user first launches the app the onConversionDataReceived method fires and the app install event is sent. Here’s more AppsFlyer documentation around deferred-deep linking, but within this method you’ll be sending an install event to Mixpanel with the relevant campaign and media_source properties. The media-source property represents the specific platform the install originated from (AdMob, Tapjoy, Chartboost… etc), and the campaign property represents the specific campaign the install originated from.

Here’s an example code snippet below that demonstrates how to define this onConversionDataReceived method with the appropriate Mixpanel tracking calls. It’s important to note AppsFlyer triggers the listener on every app launch, not just install – to make sure that you are only capturing install data you should wrap onConversionDataReceived in an operator that only triggers the ‘App Install’ event on the first instance.

-(void)onConversionDataReceived:(NSDictionary*) installData {
    id status = [installData objectForKey:@"af_status"];

    if([status isEqualToString:@"Non-organic"]) {
        id sourceID = [installData objectForKey:@"media_source"];
        id campaign = [installData objectForKey:@"campaign"];

        /* Initialize a Mixpanel Instance */
        Mixpanel *mixpanel = [Mixpanel sharedInstance];

        /* Register the attribution properties as Super Properties */
        [mixpanel registerSuperProperties:@{@"campaign": campaign, @"media_source": sourceID}];

        /* Track An app-install event which will include the campaign super properties */
        [mixpanel track:@"App Install"];

    } else if([status isEqualToString:@"Organic"]) {
        /* Initialize a Mixpanel Instance */
        Mixpanel *mixpanel = [Mixpanel sharedInstance];

        /* Register the Attribution Properties as Super Properties */
        [mixpanel registerSuperProperties:@{@"campaign": @"Organic", @"media_source": @"Organic"}];

        /* Track An app-install event which will include Organic Super Properties */
        [mixpanel track:@"App Install"];
}
/* ...Sometime later a Purchase event will also include the campaign Super Properties */
    Mixpanel *mixpanel = [Mixpanel sharedInstance];
    [mixpanel track:@"Purchase" properties:@{@"Price": 25.99}];

Similarly, here is a example of TapStream’s method

Your mobile attribution partner may provide the ability to post back “App Install” events to Mixpanel, but we recommend sending them from the client. Email us if you’d like to discuss your specific needs in detail: support@mixpanel.com

Using the Data in Mixpanel

Inside Mixpanel’s reporting, you will be able to segment the “App Install” event by the different campaign and media source properties to see which are the most valuable. If you’ve included Super Properties, you will also be able to use those properties across the different Engagement Reports (Funnels, Segmentation, Retention, etc) to understand which campaigns produce the most valuable users, not just the most installs.

For example, here’s a distribution of users who’ve installed the event from different sources.

On the Mixpanel platform, this pie chart attributes the product's app installs to different media sources, Bright Roll, Twitter Ads, AdMob, Facebook Ads, and Tapjoy.

While this implementation example is specific to AppsFlyer, other attribution providers have similar methods of attributing mobile installs to specific campaign sources. If you’re using a different provider, you can follow a similar rubric to send the attribution data to Mixpanel.

If you need any help with mobile attribution, please email us at support@mixpanel.com to speak to someone smart, quickly.

Get the latest from Mixpanel
This field is required.