Google Analytics电子商务跟踪"未检测到HTTP响应" [英] Google Analytics Ecommerce Tracking "No HTTP Response Detected"
问题描述
遵循以下文档: https://developers.google.com/analytics / devguides / collection / gajs /
我在空的html文件中做了一个最简单的例子:
< script type =text / javascript>
var _gaq = _gaq || [];
_gaq.push(['_ setAccount','UA-XXXX-2']);
_gaq.push(['_ trackPageview']);
(function(){
var ga = document.createElement('script'); ga.type ='text / javascript'; ga.async = true;
ga .src =('https:'== document.location.protocol?'https:// ssl':'http:// www')+'.google-analytics.com / ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga,s);
})();
< / script>
当我使用Google Tag Assistant插件在Chrome中加载页面时,它显示没有检测到HTTP响应而我在Developer Tools网络标签中看到的所有内容都是HTML文件加载和从谷歌下载的ga.js脚本。我在IE中得到了相同的结果,但是当我使用Firefox时,我可以看到它试图从Google获得__utm.gif,这是我的理解,它应该可以工作。
我看到控制台没有错误,为什么不能在IE和Chrome中工作?
以下是整个html:
<!DOCTYPE html>
< html xmlns =http://www.w3.org/1999/xhtml>
< head runat =server>
< title> GA Test< / title>
< script type =text / javascript>
var _gaq = _gaq || [];
_gaq.push(['_ setAccount','UA-X-2']);
_gaq.push(['_ trackPageview']);
(function(){
var ga = document.createElement('script'); ga.type ='text / javascript'; ga.async = true;
ga .src =('https:'== document.location.protocol?'https:// ssl':'http:// www')+'.google-analytics.com / ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga,s);
})();
< / script>
< / head>
< body>
< p>测试GA< / p>
< / body>
< / html>
如果您使用跟踪代码,可能会发生这种情况在本地HTML文件中(正如你所说,那个网站还没有实时播放)。
所以, Following the documentation found here: https://developers.google.com/analytics/devguides/collection/gajs/ I have made a simplest case in an empty html file as such: When I load the page in Chrome with the Google Tag Assistant plugin it says "No HTTP Response Detected" and I all I see in the Developer Tools network tab is the html file load and the ga.js script being downloaded from google. I get the same result in IE, but when I use Firefox I can see the it trying to get __utm.gif from Google which is how I understand that it should work. I see no errors in the console, why wouldn't this work in IE and Chrome? Here is the entire html:
May be this happens, if you are using tracking code at the locale HTML file(as you said, that website is not live yet). So,
这篇关于Google Analytics电子商务跟踪"未检测到HTTP响应"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
_gaq。 push(['_ setDomainName','none']);
在字符串 _gaq.push(['_ trackPageview']);
在您的语言环境HTML中,它将适用于您并发送HTTP响应。
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXX-2']);
_gaq.push(['_trackPageview']);
(function () {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>GA Test</title>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-X-2']);
_gaq.push(['_trackPageview']);
(function () {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<p>Testing GA</p>
</body>
</html>
_gaq.push(['_setDomainName', 'none']);
before string _gaq.push(['_trackPageview']);
in your locale HTML, it will work for you and will send HTTP-response.