Tracking Non Google Analytics Campaign Parameters in Google Analytics

Google Analytics can track up to 5 campaign variable of which 3 are required.  Generally, the campaign variables are passed via URL of the campaign landing page.   For example, if you  want to send users to via a campaign then you might use something like utm_campaign=Feb2012bannercampaign&utm_medium=bannerad&utm_source = yahoo&utm_content = 300X250&utm_term=training

In the above URL, all the query parameters are the campaign parameter that Google Analytics needs to track and attribute the click to the campaign. (See How to Track Campaigns in Google Analytics for more details)

In some case you might not have the campaign parameters as formatted above, maybe because you were using some other web analytics tool that required different parameters or somebody made a mistake and the parameters are messed up. Whatever the reason ; you just don’t have the right parameters.

Let’s assume that instead of the URL above, your URL looks like following campaign=Feb2012bannercampaign& medium=bannerad& source = yahoo& content = 300X250&term=training

(Note that none of the parameters contain utm_, e.g. instead of “utm_campaign”, the URL only has “campaign”)

So Google Analytics won’t recognize these parameters as valid campaign parameters and will ignore them.  However you can fix the problem by forcing Google Analytics to recognize these variable as valid campaign variable by using few lines of codes. The way you fix them is by calling a function that sets the new campaign parameter

_gaq.push(['_setCampNameKey', 'campaign']); 

The above code tells Google Analytics to use ‘campaign’ as the CampaignName parameter instead of the ‘utm_campaign’ parameter

Similarly set other parameters as follows

_gaq.push(['_setCampMediumKey', 'medium']);

_gaq.push(['_setCampSourceKey', 'source']);

_gaq.push(['_setCampContentKey', 'content']);

_gaq.push(['_setCampTermKey', 'term']);


  1. [...] Also, see Tracking Non Google Analytics Campaign Parameters in Google Analytics [...]

Speak Your Mind