Google Analytics

Campaign Tracking - Web Tracking (ga.js)

  1. Overview
  2. Campaign Tracking
    1. General Campaign Features
    2. Custom Campaign Tracking

Overview

This document covers how to customize the elements that are displayed in the Traffic Sources section of the Google Analytics reporting interface. Google Analytics tracks traffic to your website from two basic referring sources:

  • organic

    Organic campaigns can come from an unpaid search engine results link, a referral from another website (such as a blog) and direct traffic.

  • paid

    Paid campaigns can come from AdWords, paid search engine keywords, or paid ad campaigns from non-Adwords providers.

Once a user reaches your site from one of these sources, that user's visit is tagged with a campaign tracking cookie as coming from that source. In addition, Analytics treats paid campaign visits from different sources as follows:

  • Source precedence—A direct traffic visit that follows a paid referred visit will never override an existing paid campaign. Whatever is the latest paid campaign visit is listed as the referral for the visit.
  • Campaign precedence—Each visit to your site from a different paid source—such as from a paid search engine link, an Adwords link, or a banner ad—overrides the campaign cookie information set by a previous source.
  • One Campaign Per Session—Each visit to your site from a different campaign—organic or paid—triggers a new session, regardless of the actual time elapsed in the current session. Specifically, a change in value for any of the following campaign URL parameters triggers a new session: utm_source, utm_medium, utm_term, utm_content, utm_id, utm_campaign, gclid. For more information on sessions, see Sessions in our Help Center.

Back to Top

Campaign Tracking

In its broadest definition, campaign tracking refers to a method of identifying how users discover your site. Specifically, you use campaign tracking in Google Analytics to accurately track online advertising campaigns to your website, both from AdWords-generated campaigns as well as from other advertising sources. You can use some of the campaign tracking customizations to adjust whether subsequent ad referrals override earlier referrals to your site, either organic or paid.

Before configuring campaign tracking using the ga.js campaign tracking settings, you should understand how campaign tracking works in general and how you can best use it to track advertising referrals to your site. The following table lists a number of articles in the Help Center that describe campaign tracking. The rest of this section describes campaign tracking settings specific to the ga.js tracking code.

Article Description
How Campaign Tracking Works Describes the process of campaign tracking, from setting up and parsing a link, to logging campaign data in the Analytics reporting and associating campaigns with goals in order to track user conversion.
Tagging Your Destination URLs Describes how to enable/disable auto-tagging for your AdWords campaigns and provides information for how to manually tag destination URLs.
URL Builder Tool Tool you can use to automatically generate a campaign tracking URL if necessary.
Best Practices for Tagging Links Describes how to employ effective link tagging for non-AdWords campaigns. See the information in this section for details on how to use ga.js method calls to use your own campaign tracking variables with this model.

Back to Top

General Campaign Features

Use these methods to control general characteristics of campaign behavior on your entire site or a set of pages.

Feature Method Description
Disable Campaign Tracking _setCampaignTrack() Campaign tracking is enabled by default, but you can use this method to disable campaign tracking and its associated cookies for a given page or pages.
Anchors in URLs _setAllowAnchor()

Set this method to use the # sign as a query string delimiter in campaign tracking URLs.

This method allows you to get reporting data for campaign tracking parameters even if your site doesn't support query parameters. For example, if your webserver hosts static content for speed in page delivery, you will not be able to retrieve campaign tracking data using the conventional query strings. In this case, you can use the _setAllowAnchor() method in your tracking code, which will reconfigure campaign tracking to retrieve campaign URL strings after the anchor.

Set Campaign Timeout _setCampaignCookieTimeout() By default, campaigns are tracked for 6 months, so that you can determine over a 6-month period if visitors to your site convert based on a specific campaign. However, you can use this method to adjust the tracking life span for your campaigns.
Campaign Overrides _setCampNOKey By default, the most recent ad impression is the campaign that is credited in your conversion tracking. If you prefer to associate the first-most impressions to a conversion, use this method.

Custom Campaign Tracking

Google Analytics automatically collects your Google AdWords data if you have linked your Adwords account to your Analytics account. If you have non-AdWords keyword links using other advertising sources, or if you want to track user clicks to your site from email campaigns or similar sources, you can create custom campaigns using the URL Builder Tool. The tables below describe the ga.js methods you can use to create customize campaign tracking behavior for your site. See the Campaign Tracking Reference for specific examples for these methods.

Variable Type Method Description
Campaign Name _setCampNameKey This variable is used to define the name of your campaign, which appears in the Analytics reports on the top-level campaign report.
Campaign Source _setCampSourceKey The source variable is typically used to define where the campaign is originating from, such as a website name or a company. For all campaigns, or for a particular campaign, this appears as Source under the Segment pull-down in the Analytics Reports.
Campaign Medium _setCampMediumKey Typically used to define the type of the campaign, such as a banner ad, email campaign, or click ad. For all campaigns, or for a particular campaign, this appears as Keyword under the Segment pull-down in the Analytics Reports.
Campaign Term _setCampTermKey Defines the keyword terms for that ad. For all campaigns, or for a particular campaign, this appears as Keyword under the Segment pull-down in the Analytics Reports.
Campaign Content _setCampContentKey Typically used to set the content description for that campaign ad. For all campaigns, or for a particular campaign, this appears as Ad Content under the Segment pull-down in the Analytics Reports.

Back to Top

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.