问题
I'm looking at the js for google analytics on a page. It contains the following (changed the domain name, name etc). This is on the home page. I understand that these are used to set campaign variables but... why would someone do this on the home page? Perhaps because they have multiple sites and are tracking hits to each one as a campaign? Is this a good configuration?
_gaq.push(['_setDomainName', 'somesite.co.uk']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_setCampNameKey', 'John Doe']);
_gaq.push(['_setCampSourceKey', 'any']);
_gaq.push(['_setCampMediumKey', 'any']);
_gaq.push(['_setCampTermKey', 'plumbs']);
_gaq.push(['_setCampContentKey', 'all']);
_gaq.push(['_trackPageview']);
回答1:
You're thinking a step further. All the _setCamp*Key
functions tell GA there to look in the Key
-- not the value. Take a closer look at the examples in the GA Campaign Tracking Docs
来源:https://stackoverflow.com/questions/15697112/setcampnamekey-usage-in-google-analytics