Google Analytics电子商务跟踪"未检测到HTTP响应" [英] Google Analytics Ecommerce Tracking "No HTTP Response Detected"

查看:88
本文介绍了Google Analytics电子商务跟踪"未检测到HTTP响应"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

遵循以下文档: 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文件中(正如你所说,那个网站还没有实时播放)。



所以,

  • 当您将其发布到活动域时,此跟踪代码可以正常工作;
  • 可能会添加字符串
    _gaq。 push(['_ setDomainName','none']);
    在字符串 _gaq.push(['_ trackPageview']);
    在您的语言环境HTML中,它将适用于您并发送HTTP响应。


  • 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:

    <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>
    

    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:

    <!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>
    

    解决方案

    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,

    1. This tracking code will work, when you publish it to live domain;
    2. May be if you add string _gaq.push(['_setDomainName', 'none']); before string _gaq.push(['_trackPageview']); in your locale HTML, it will work for you and will send HTTP-response.

    这篇关于Google Analytics电子商务跟踪&quot;未检测到HTTP响应&quot;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆