In universal analytics (new google analytics) do I need to explicitly set campaign tracking parameters? I have found examples where the params are simply included in the url. Is that enough to initiate the campaign? Or should I also explicitly set the parameters on the tracker?
I am currently doing both and see no results in my ga reports.
Here's an example url
http://google.com/help?utm_source=tuestest&utm_medium=tuestest&utm_content=tuestest&utm_campaign=tuestest
And also my attempt to explicitly add parameters (this does in fact add them to the send event as can be seen in ga debugger but they never reach the results analytics page.
var gaMap = {'utm_source': 'campaignSource','utm_medium':'campaignMedium','utm_content':'campaignContent','utm_campaign':'campaignName'};
var urlParams = Object.keys(gaMap);
var parsed = Query.parse();
var _this = this;
parsed.forEach(function(key) {
var name = Object.keys(key)
var nameLower = name[0].toLowerCase()
if (!_.has(gaMap,nameLower)) return;
_this.ga('set',gaMap[nameLower],key[name])
})
I think i must be missing something in the documentation that specifies how to trigger the campaign?
Addition: I inspected the _utmz param in the google analytics gif and saw this:
.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
However, my params are present
cn:tuestest
cs:tuestest
cm:tuestest
cc:tuestest
Is it possible they're getting overwritten somehow by the utmcsr, etc?
The problem was that the url params were stripped before the analytics object was submitted. If, like me, you want the url params stripped for aesthetic reasons, instead of adding the attributes individually to the GA object, just set the &dl attribute to the original url as such:
this.set('location', window.location.protocol + '//' + window.location.hostname + window.location.pathname + '?' + encodedSubUrl);
If you use the GA inspector add-on in chrome the &dl param should look like this. Adding each of the attributes like utm_source in individually, however, will not work.
&dl: http://google.com/help?utm_source=tuestest&utm_medium=tuestest&utm_content=tuestest&utm_campaign=tuestest