This reference describes the methods that you use for setting up and customizing campaign tracking in Google Analytics reporting.
GATC Campaign Tracking Methods
_setAllowAnchor(bool)_setCampContentKey(newCampContentKey)_setCampMediumKey(newCampMedKey)_setCampNameKey(newCampNameKey)_setCampNOKey(newCampNOKey)_setCampSourceKey(newCampSrcKey)_setCampTermKey(newCampTermKey)_setCampaignTrack(bool)_setCampaignCookieTimeout(cookieTimeoutMillis)_setCookieTimeout(newDefaultTimeout)deprecated_setReferrerOverride(newReferrerUrl)
Method Details
_setAllowAnchor()
_setAllowAnchor(bool)
This method sets the # sign as the query string delimiter in campaign
tracking. This option is set to false by default.
Conventional campaign tracking URLs use the question mark (?) to indicate the beginning of key/value pairs that make up the query. If you set this option to true, your campaign tracking URLs can use a pound (#) sign instead of the question mark (?) to indicate the beginning of the query string.
http://mysite.net/index.html#utm_source=In+House&utm_medium=email&utm_campaign=Fall+email+offers _gaq.push(['_setAllowAnchor', true]);
parameters
Boolean true or false If
this parameter is set to true, then campaign uses anchors.
Otherwise, the campaign uses search strings.
_setCampContentKey()
_setCampContentKey(newCampContentKey)
Sets the campaign ad content key. The campaign content key is used to retrieve the ad content (description) of your advertising campaign from your campaign URLs. Use this function on the landing page defined in your campaign.
For example, suppose you have an ad on another website with this URL to your site:
http://mysite.net/index.html?utm_source=giganoshopper.com&utm_medium=referral&utm_campaign=Christmas+specials&description=Garden+gloves
In this URL, the key "description" delineates the content supplied in the URL for that campaign. (These terms and phrases appear under the Ad Content column in the Campaign detail page in the Traffic Sources report.) To use that key as your customized campaign content key, you would set:
_gaq.push(['_setCampContentKey', 'description']);
parameters
String newCampContentKey New campaign content
key to set.
_setCampMediumKey()
_setCampMediumKey(newCampMedKey)
For example, suppose you have an ad on another website with this URL to your site:
http://mysite.net/index.html?utm_source=giganoshopper.com&method=ad&utm_campaign=Christmas+specials&utm_content=Garden+gloves
In this URL, the key "method" delineates the medium in the URL for that campaign.
_gaq.push(['_setCampMediumKey', 'method']);
parameters
String newCampMedKey Campaign medium key
to set.
_setCampNameKey()
_setCampNameKey(newCampNameKey)
For example, suppose you send an email to registered users about a special offer, and the link to that offer looks like:
http://mysite.net/index.html?utm_source=In+House&utm_medium=email&offer_type=Fall+email+offers
In this URL, the key "offer_type" delineates the name supplied in the URL for that campaign. (This is the name that appears in the list of Campaigns in the Traffic Sources report.)
_gaq.push(['_setCampNameKey', 'offer_type']);
parameters
String newCampNameKey Campaign name key.
_setCampNOKey()
_setCampNOKey(newCampNOKey)
If you have an ad on another website with this URL to your site:
http://mysite.net/index.html?utm_source=giganoshopper.com&utm_medium=referral&utm_campaign=Christmas+specials&utm_content=Garden+gloves&noo=1234
In this URL, the key "noo" delineates the no-override value in the URL for that campaign.
_gaq.push(['_setCampNOKey', 'noo']);
parameters
String newCampNOKey Campaign no-override
key to set.
_setCampSourceKey()
_setCampSourceKey(newCampSrcKey)
For example, suppose you have an ad on another website with this URL to your site:
http://mysite.net/index.html?source=giganoshopper.com&utm_medium=referral&utm_campaign=Christmas+specials&utm_content=Garden+gloves
In this URL, the key "source" delineates the source in the URL for that campaign.
_gaq.push(['_setCampSourceKey', 'source']);
parameters
String newCampSrcKey Campaign source key
to set.
_setCampTermKey()
_setCampTermKey(newCampTermKey)
For example, suppose you have a paid ad on a search engine tagged as follows:
http://mysite.net/index.html?source=weSearch4You.com&utm_medium=paidSearchAd&utm_campaign=Christmas+specials&utm_content=Garden+gloves&term=garden+tools
In this URL, the key "term" delineates the keyword terms in the URL for that campaign.
_gaq.push(['_setCampTermKey', 'term']);
parameters
String newCampTermKey Term key to set.
_setCampaignTrack()
_setCampaignTrack(bool)
true for
standard Google Analytics set up. If you wish to disable campaign tracking
and the associated cookies that are set for campaign tracking, you can
use this method.
parameters
Boolean true or false True
by default, which enables campaign tracking. If set to false,
campaign tracking is disabled.
_setCampaignCookieTimeout()
_setCampaignCookieTimeout(cookieTimeoutMillis)
Sets the campaign tracking cookie expiration time in milliseconds. By default, campaign tracking is set for 6 months. In this way, you can determine over a 6-month period whether visitors to your site convert based on a specific campaign. However, your business might have a longer or shorter campaign time-frame, so you can use this method to adjust the campaign tracking for that purpose.
You can change the expiration timeout to 0 to indicate that this cookie should be deleted when the browser is closed.
_gaq.push(['_setCampaignCookieTimeout', 15768000000]);
parameters
Number cookieTimeoutMillis
New cookie expiration time in milliseconds or 0 to delete the cookie when the browser is closed.
_setCookieTimeout()
_setCookieTimeout(newDefaultTimeout)
_setCampaignCookieTimeout(cookieTimeoutMillis) instead.
_gaq.push(['_setCookieTimeout', 3152600]);
parameters
String newDefaultTimeout New default cookie
expiration time to set. Pass in as a string and it is converted to an
integer.
