iOS Campaign Tracking Url Builder

iOS Campaign Tracking Url Builder

Generate trackable URLs for measuring the source of iOS application installs

Measure iOS campaigns in Google Analytics, enable the attribution of traffic sources to user activity within your application.

Analytics Google Tracking script

5.0 Share

Fill in the form

Ad Network *

The object that was interacted with

Application ID *

The final package that is used in your built .apk's manifest

Analytics property ID *

The ID property of Analytics acocunt e.g. UA-XXXX-YY

Redirect URL *

The URL to which the user will be redirected

Campaign Source *

original referrer, e.g. google, citysearch, newsletter4

Campaign Medium

marketing medium, e.g. cpc, banner, email

Campaign Term

paid keywords, e.g. running+shoes

Campaign Content

ad-specific content used to differentiate ads

Campaign Name

product, promotion code, or slogan

BUILD URL

What is the iOS Campaign Tracking URL Builder?

How you can use it in your campaign?

Measuring campaigns in Google Analytics enables the attribution of campaigns and traffic sources to user activity within your application. These options are available for campaign and traffic source attribution in the Google Analytics SDK for iOS:

Redirect and Ping flow for iOS Campaign Tracking

Redirect
The redirect method uses a campaign URL that points the user to the Google Analytics click server that will then redirect the user to the app's iTunes page. The URL will look similar to the following:

  1. The AD Network forms the URL and sets the query string parameters to include campaign information and the IDFS;
  2. The user clicks the AD and they are redirected to Google Analytics which collects the IDFA and other parameter values;
  3. The user is redirected to the app's iTunes page;
  4. User install app. This will be matched to the campaign from AD clicked in step #2.

Asynchronous Ping
The ping method requires the Ad Network to make a direct request to the Google Analytics server when a user clicks an ad. The ping URL will look similar to the following:

  1. The user clicks the AD which brings them to the app's iTunes page;
  2. The AD Network pings the Google Analytics server with the query string parameters that have been set with campaign information and IDFA;
  3. Google Analytics collects the IDFA and other parameter values from the ping request;
  4. User install app. This will be matched to the campaign from AD clicked in step #1.

Information and examples

Campaign parameters are used to pass information about the traffic sources and campaigns that are bringing users to your app.

The table below contains the available campaign parameters that can be used in iOS or general campaign measurement:

Google Analytics Property ID *

Required

Used to identify the Google Analytics Property
Example: UA-XXXX-YY

AD Network *

Required

Used to identify the AD Network source

Redirect URL: *

Required

The URL to which the user will be redirected
Example: https://itunes.apple.com/us/app/my-app/id123456789

iTunes Store ID: *

Required

Used to identify the iTunes Store Property

App ID *

Required

Your app's Bundle Identifier
Example: com.company.app

Campaign Source *

Required

Campaign source; used to identify a search engine, newsletter, or other source
Example: google

Campaign Medium

Campaign medium; used to identify a medium such as email or cost-per-click (cpc)
Example: cpc

Campaign Term

Campaign term; used with paid search to supply the keywords for ads
Example: running+shoes etc.

Campaign Content

Campaign content; used for A/B testing and content-targeted ads to differentiate ads or links that point to the same URL
Example: logolink or textlink

Campaign Name

Google Ads autotagging parameter; used to measure ads. This value is generated dynamically and should never be modified.
Example: logolink or textlink

General Campaign & Traffic Source Attribution

Implementing iOS campaign attribution

After an app has been installed, it may be launched by referrals from ad campaigns, websites, or other apps. In this scenario, referring traffic sources or marketing campaigns can be attributed to user activity in subsequent sessions by setting the campaign fields on a tracker directly.

The easiest way to send campaign data is to use [GAIDictionaryBuilder setCampaignParametersFromUrl:urlString], where urlString is a string representing a URL that may contain Google Analytics campaign parameters.

Note that in the following examples, campaign data is not set on the tracker directly, as it only needs to be sent once:

/*
 * MyAppDelegate.m
 * An example of how to implement campaign and referral attribution. 
 * If no Google Analytics campaign parameters are set in the referring URL, use the hostname as a referrer instead.
 */

// For iOS 9.0 and later
- (BOOL)application:(UIApplication *)app openURL:(nonnull NSURL *)url
            options:(nonnull NSDictionary *)options {

// For iOS versions prior to 9.0
//- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
//  sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {

  NSString *urlString = [url absoluteString];

  id<GAITracker> tracker = [[GAI sharedInstance] trackerWithName:@"tracker" trackingId:@"UA-XXXX-Y"];

  // setCampaignParametersFromUrl: parses Google Analytics campaign ("UTM")
  // parameters from a string url into a Map that can be set on a Tracker.
  GAIDictionaryBuilder *hitParams = [[GAIDictionaryBuilder alloc] init];

  // Set campaign data on the map, not the tracker directly because it only needs to be sent once.
  [hitParams setCampaignParametersFromUrl:urlString];

  // Campaign source is the only required campaign field. If previous call did not set a campaign source, use the hostname as a referrer instead.
  if(![hitParams get:kGAICampaignSource] && [url host].length !=0) {
    // Set campaign data on the map, not the tracker.
    [hitParams set:@"referrer" forKey:kGAICampaignMedium];
    [hitParams set:[url host] forKey:kGAICampaignSource];
  }

  NSDictionary *hitParamsDict = [hitParams build];

  // A screen name is required for a screen view.
  [tracker set:kGAIScreenName value:@"screen name"];

  // Previous V3 SDK versions.
  // [tracker send:[[[GAIDictionaryBuilder createAppView] setAll:hitParamsDict] build]];

  // SDK Version 3.08 and up.
  [tracker send:[[[GAIDictionaryBuilder createScreenView] setAll:hitParamsDict] build]];

Alternatively, if you have campaign information in a form other than Google Analytics campaign parameters, you may set it on a NSDictionary and send it manually:

// Assumes at least one tracker has already been initialized.
id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];

// Note that it's not necessary to set kGAICampaignKeyword for this email campaign.
NSDictionary *campaignData = [NSDictionary dictionaryWithObjectsAndKeys:
    @"email", kGAICampaignSource,
    @"email_marketing", kGAICampaignMedium,
    @"summer_campaign", kGAICampaignName,
    @"email_variation1", kGAICampaignContent, nil];

// A screen name is required for a screen view.
[tracker set:kGAIScreenName value:@"screen name"];

// Note that the campaign data is set on the Dictionary, not the tracker. Previous V3 SDK versions.
// [tracker send:[[[GAIDictionaryBuilder createAppView] setAll:campaignData] build]];

// SDK Version 3.08 and up.
[tracker send:[[[GAIDictionaryBuilder createScreenView] setAll:campaignData] build]];

iOS install campaign measurement

See which campaigns from other apps are referring users to iTunes to download your iOS app.

Google Analytics offers out-of-the-box support for iOS Install Campaign Measurement for popular networks and provides the ability to generate your own custom URLs for any additional networks.

To enable iOS Install Campaign Measurement, use the iOS Campaign Tracking URL Builder below to generate destination URLs for your ads that send users to the App Store. In order for iOS Campaign Tracking to work, you must have already implemented Google Analytics in your iOS app, enabled IDFA collection, and be tracking one or more screen views or events in your app. You will also need to add an additional framework to your app if you want to use automatic iAd install campaign measurement.

Note: iOS Install Tracking only works for ads served through mobile ad networks, such as Google AdMob that serves in-app ads.

Self-serve diagnosis for iOS conversion tracking

1 - Confirm iOS campaign tracking is enabled
To confirm iOS campaign tracking is enabled for the target property click the Admin tab in Analytics Account, select the property and click Property Settings and make sure iOS Campaign Tracking is ON.

2 - Confirm application ID matches
To correctly attribute a campaign with app data, the iOS campaign tracking URL and your app tracking implementation need to use the same App ID. To determine the App ID for an app that you're currently tracking, create a custom report in the Google Analytics web interface with App Id as a dimension and Sessions as a metric.

While creating a click iOS campaign tracking URL, use the App ID appearing in the custom report.

3 - Confirm Google Analytics SDK is sending the IDFA
Google Analytics uses Identifier for Advertiser (IDFA) as one of the keys to join mobile clicks with Google Analytics hits. Ensure that:

  • Your app is using Google Analytics SDK for iOS version 3.10 or higher.
  • If you use the standalone SDK download:
    • Your app is linked with libAdIdAccess.a as part of the Google Analytics iOS release.
    • Your app is linked with AdSupport.framework.
  • If you use CocoaPods to install and manage dependencies, add the GoogleIDFASupport Cocoapod to the Podfile:
    pod 'GoogleIDFASupport'
  • You have enabled IDFA collection on each tracker:
    tracker.allowIDFACollection = YES;
  • If possible use a debugging proxy application to view HTTP requests and confirm IDFA is included.

4 - Look at the demographics report to confirm IDFA is being sent
Google Analytics uses IDFA to generate the demographics reports. In Google Analytics, click the Reporting tab and click Audience > Demographics > Overview to check if you see demographic data. If you do, IDFA is being sent correctly.

5 - Ensure iOS campaign tracking URLs are correct
Use iOS Campaign Tracking URL Builder tool to verify that the iOS campaign tracking URLs are correct.

When selecting the Custom option for Ad Network, make sure to also consult with that network to confirm it supports tracking individual device IDs using redirect URLs. If it doesn't, then you will not see any data in Google Analytics reporting.

Share this Tool

Did you like it? Share it!

Share this tool

Related tools. Try these one!

Generators, builders and validators to improve your SEO and web performances

Home Back to top of the page