开发者

Google Analytics Tracking - Multiple Accounts - _trackEvent

What I basicly want to do is to be able to call _trackevent for 2 accounts. One goes to the main brand domain, and the other to the dealer brand domain. But for some reason, the "b" account wont send any beacon.

Not working:

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-12345678-1']);
_gaq.push(['_setDomainName', 'brand.dealer1.domain.com']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
_gaq.push(['b._setAccount', 'UA-17225318-3']);
_gaq.push(['b._setDomainName', 'brand.domain.dk']);
_gaq.push(['b._setAllowLinker', true]);
_gaq.push(['b._trackPageview']);

But if I simplifie the trackingscript, without _setDomainName, it will work. But I need the _setDomainName in my tracking.

Working

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-12345678-1']);
_gaq.push(['_trackPageview']);
_gaq.push(['b._setAccount', 'UA-23456789-3']);
_gaq.push(['b._trackPag开发者_运维技巧eview']);

So can anyone point me in the right direction?


If the _setDomainName value doesn't match the current hostname, the beacon isen't sent. You can't bind a cookie to a foreign hostname.

Since you have two unique IDs, the data from the standard tracker and the b-tracker is separated, and sent to the different accounts. So the dual track-events (with different prefixes), will work fine.

Why do you need the setdomainname? Are the sites cross-domained og subdomained? In either case, I'd just use:

_gaq.push(['_setDomainName', 'none']);

For both trackers. And throw in a:

_gaq.push(['_setAllowHash', false]);

Just to be sure that the cookies will work for both trackers.

The segmentation can then be done with filters/profiles/advanced segments in the GA interface.

Hope this helps

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜