This reference describes the methods that you use for setting up and customizing campaign tracking in Google Analytics reporting.
_setAllowAnchor(bool)_setCampContentKey(newCampContentKey)_setCampMediumKey(newCampMedKey)_setCampNameKey(newCampNameKey)_setCampNOKey(newCampNOKey)_setCampSourceKey(newCampSrcKey)_setCampTermKey(newCampTermKey)_setCampaignTrack(bool)_setCampaignCookieTimeout(cookieTimeoutMillis)_setCookieTimeout(newDefaultTimeout) deprecated_setReferrerOverride(newReferrerUrl)_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]);
http://mysite.net/index.html#utm_source=In+House&utm_medium=email&utm_campaign=Fall+email+offers pageTracker._setAllowAnchor(true);
Boolean true or false If
this parameter is set to true, then campaign uses anchors.
Otherwise, the campaign uses search strings.
_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']);
pageTracker._setCampContentKey("description");
String newCampContentKey New campaign content
key to set.
_setCampMediumKey(newCampMedKey)
http://mysite.net/index.html?utm_source=giganoshopper.com&method=ad&utm_campaign=Christmas+specials&utm_content=Garden+gloves
_gaq.push(['_setCampMediumKey', 'method']);
pageTracker._setCampMediumKey("method");
String newCampMedKey Campaign medium key
to set.
_setCampNameKey(newCampNameKey)
http://mysite.net/index.html?utm_source=In+House&utm_medium=email&offer_type=Fall+email+offers
_gaq.push(['_setCampNameKey', 'offer_type']);
pageTracker._setCampNameKey("offer_type");
String newCampNameKey Campaign name key.
_setCampNOKey(newCampNOKey)
http://mysite.net/index.html?utm_source=giganoshopper.com&utm_medium=referral&utm_campaign=Christmas+specials&utm_content=Garden+gloves&noo=1234
_gaq.push(['_setCampNOKey', 'noo']);
pageTracker._setCampNOKey("noo");
String newCampNOKey Campaign no-override
key to set.
_setCampSourceKey(newCampSrcKey)
http://mysite.net/index.html?source=giganoshopper.com&utm_medium=referral&utm_campaign=Christmas+specials&utm_content=Garden+gloves
_gaq.push(['_setCampSourceKey', 'source']);
pageTracker._setCampSourceKey("source");
String newCampSrcKey Campaign source key
to set.
_setCampTermKey(newCampTermKey)
http://mysite.net/index.html?source=weSearch4You.com&utm_medium=paidSearchAd&utm_campaign=Christmas+specials&utm_content=Garden+gloves&term=garden+tools
_gaq.push(['_setCampTermKey', 'term']);
pageTracker._setCampTermKey("term");
String newCampTermKey Term key to set.
_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.
Boolean true or false True
by default, which enables campaign tracking. If set to false,
campaign tracking is disabled.
_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]);
pageTracker._setCampaignCookieTimeout(15768000000); //number of milliseconds in 6 months
Number cookieTimeoutMillis
New cookie expiration time in milliseconds or 0 to delete the cookie when the browser is closed.
_setCookieTimeout(newDefaultTimeout)
_setCampaignCookieTimeout(cookieTimeoutMillis) instead.
_gaq.push(['_setCookieTimeout', 3152600]);
pageTracker._setCookieTimeout('3152600'); //number of seconds in 1 year
String newDefaultTimeout New default cookie
expiration time to set. Pass in as a string and it is converted to an
integer.
_setReferrerOverride(newReferrerUrl)
document.referrer property to determine
the referrer URL, which is passed in the utmr parameter of the GIF request.
However, you can over-ride this parameter with your own value. For example, if
you set the new referrer to http://www.google.com/search?hl=en&q=hats,
the campaign cookie stores a new campaign with source=google,
medium=organic, and keyword=hats.
String newReferrerOverride The new url for
the document referrer.