Google Analytics “No HTTP response detected” while tracking multiple accounts and using linker

时间秒杀一切 提交于 2019-12-10 10:11:56

问题


I am trying to not only track two different GA accounts, but also on one account I need to use a linker between sites. Google is coming back with "Error: No HTTP response detected" on the site using the linker.

Here is the code, thanks for the help.

(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-XXXXXXX-1', 'site1.com');
ga('create', 'UA-XXXXXXX-4', 'auto', {'name': 'siteLinker','allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', ['site2.com','site3.com'] );
ga('require', 'displayfeatures');
ga('send', 'pageview');

回答1:


Take a look at Google's documentation for Working with Multiple Trackers. The only command you missed was to send the second pageview of the second 'siteLinker' tracker.

(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-XXXXXXX-1', 'site1.com');
ga('create', 'UA-XXXXXXX-4', 'auto', {'name': 'siteLinker','allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', ['site2.com','site3.com'] );
ga('require', 'displayfeatures');
ga('send', 'pageview');

// Missing the send command for the second 'named' tracker
ga('siteLinker.send', 'pageview');

I also noticed that there is an analytics.js file loading from an external script in the . Any reason why this is hear? It was interfering when I was trying to debug.



来源:https://stackoverflow.com/questions/24289588/google-analytics-no-http-response-detected-while-tracking-multiple-accounts-an

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!