This document provides an overview of how to measure campaigns and traffic sources with the Google Analytics SDK for iOS v2.
Measuring campaigns in Google Analytics can help you improve the value of your marketing channels by enabling the attribution of campaigns and traffic sources to user activity within your application.
There are several kinds of campaign measurement available in the Google Analytics SDK for iOS:
- Measuring General Campaigns - See which campaigns or traffic sources launched your app it was installed.
- Measuring Referrals - See which referring traffic source, such as websites or other apps, launched your app after it was installed.
The following sections will describe when and how to implement each type of campaign measurement in your app.
Measuring General Campaigns
General campaign measurement can be used to associate a campaign or traffic source with a user after they've already installed your app.
For example, if you were running a paid campaign to reach existing users who have already installed your app, you could use general campaign measurement to measure which app launches were the result of that campaign.
Implementing General Campaign Measurement
To set general campaign values, call
setCampaignUrl:campaignUrl, where campaignUrl is a valid
Campaign Parameter string.
General campaign measurement is useful if your app implements a Custom URL
Scheme. For example, if your app is launched in response to a URL, you can
retrieve any query parameters and pass them to
to store that information in Google Analytics. Any subsequent user activity
would then be associated with the campaign information retrieved from the
campaign parameters in that URL.
Referral measurement is similar to other types of campaign measurement in that it allows you to measure a referring source that launched your app on a user's device. However, referral measurement uses a simple string like "google.com" or "myOtherApp", rather than a string of campaign parameters.
When you set a referring source, like "google.com", the source dimension is set to "google.com", while the medium dimension is implicitly set to "referrer"
As with campaign measurement, set a referring source will, by default, cause the next send call to start a new session.
To set a referrer, call
referrer is a string like "google.com" or "myOtherApp".
- The Apple App Store does not currently support campaign measurement using Google Analytics. However, custom URL schemes can be used in conjunction with general campaign measurement to pass campaign information into your iOS app after it has been downloaded and installed.
Campaign parameters are used to pass information about the traffic sources and campaigns that are bringing users to your app.
- In general campaign measurement, an unencoded campaign parameter string is
passed as an argument to
The following is an example of a valid, unencoded campaign string that could be used for general campaign measurement:
The table below shows the complete list of the available campaign parameters that can be used in general campaign measurement.
|Campaign name; used for keyword analysis to identify a specific product promotion or strategic campaign
|Campaign source; used to identify a search engine, newsletter, or other source
|Campaign medium; used to identify a medium such as email or cost-per-click (cpc)
|Campaign term; used with paid search to supply the keywords for ads
|Campaign content; used for A/B testing and content-targeted ads to differentiate ads or links that point to the same URL
|Google Ads autotagging parameter; used to measure Google Ads. This value is generated dynamically and should never be modified.