Google Analytics “No HTTP response detected” while

2019-05-13 22:55发布

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条回答
ら.Afraid
2楼-- · 2019-05-13 23:32

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.

查看更多
登录 后发表回答