Google Analytics:未检测到HTTP响应

时间:2016-05-21 16:40:58

标签: javascript google-maps

我正在尝试使用GoDaddy上的Google Analytics跟踪我的网页。我之前从未遇到过使用它的问题;但是,Google跟踪代码管理器告诉我,Google Analytics代码中没有检测到HTTP响应。

  

缺少HTTP响应表示,而Google Analytics代码   在页面源中检测到,脚本本身没有执行。   每次Google Analytics脚本执行时,我们都会期待HTTP   响应跟踪请求到Google的服务器。这意味着   Google Analytics代码未在页面上正确实施   并且不会收集任何数据。   https://support.google.com/tagassistant/answer/3059154#http_response

这个html的任何人都有任何想法:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- Page Information -->
    <meta name="description" content="...">
    <meta name="author" content="...">
    <title>Happening</title>
    <!-- Favicon -->
    <link rel="apple-touch-icon" sizes="57x57" href="img/icons/apple-touch-icon-57x57.png">
    <link rel="apple-touch-icon" sizes="60x60" href="img/icons/apple-touch-icon-60x60.png">
    <link rel="apple-touch-icon" sizes="72x72" href="img/icons/apple-touch-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="76x76" href="img/icons/apple-touch-icon-76x76.png">
    <link rel="apple-touch-icon" sizes="114x114" href="img/icons/apple-touch-icon-114x114.png">
    <link rel="apple-touch-icon" sizes="120x120" href="img/icons/apple-touch-icon-120x120.png">
    <link rel="apple-touch-icon" sizes="144x144" href="img/icons/apple-touch-icon-144x144.png">
    <link rel="apple-touch-icon" sizes="152x152" href="img/icons/apple-touch-icon-152x152.png">
    <link rel="apple-touch-icon" sizes="180x180" href="img/icons/apple-touch-icon-180x180.png">
    <link rel="icon" type="image/png" href="img/icons/favicon-32x32.png" sizes="32x32">
    <link rel="icon" type="image/png" href="img/icons/favicon-194x194.png" sizes="194x194">
    <link rel="icon" type="image/png" href="img/icons/favicon-96x96.png" sizes="96x96">
    <link rel="icon" type="image/png" href="img/icons/android-chrome-192x192.png" sizes="192x192">
    <link rel="icon" type="image/png" href="img/icons/favicon-16x16.png" sizes="16x16">
    <link rel="manifest" href="img/icons/manifest.json">
    <link rel="mask-icon" href="img/icons/safari-pinned-tab.svg" color="#571619">
    <!-- Shows error when validated, but is legal -->
    <link rel="shortcut icon" href="img/icons/favicon.ico">
    <meta name="apple-mobile-web-app-title" content="Happening">
    <meta name="application-name" content="Happening">
    <meta name="msapplication-TileColor" content="#da532c">
    <meta name="msapplication-TileImage" content="img/icons/mstile-144x144.png">
    <meta name="msapplication-config" content="img/icons/browserconfig.xml">
    <meta name="theme-color" content="#571619">
    <!-- Styles -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
    <link rel="stylesheet" href="css/main.css">
    <link rel="stylesheet" href="css/bootstrap-datetimepicker.min.css">
    <!-- Fonts -->
    <link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
    <link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
    <link href='https://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Lato:100,300,400,700,900,400italic' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.2/css/font-awesome.min.css">
    <!-- JS Libs  -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script src="js/moment-with-locales.min.js"></script>
    <script src="js/bootstrap-datetimepicker.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
    <script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" async defer></script>
    <!-- Google Analytics -->
    <script>
    (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', 'https://www.google-analytics.com/analytics.js', 'ga');

    ga('create', 'UA-77358803-2', 'auto');
    ga('send', 'pageview');
    </script>
</head>

2 个答案:

答案 0 :(得分:3)

尝试使用分析的调试版本。将分析网址更改为https://www.google-analytics.com/analytics_debug.js(根据建议from Google)。它将在控制台中显示信息和警告。在我的情况下,它给了我一个警告,'ga'已经定义了(我所包含的另一个脚本污染了全局名称空间)。

答案 1 :(得分:1)

  1. 收到此警告后,您是否正在登录WordPress时查看网站?

  2. 在Google Analytics(分析)设置(网站工具>设置> Analytics(分析)>编辑)中,您是否可以选择将已登录的用户从跟踪中排除?

  3. 如果是这样,当您禁用此选项时,Tag Assistant中的警告会消失吗?

如果是这种情况,则该警告是正常现象,并表示防止跟踪已登录用户的选项正在运行。您可以选择打开还是关闭此选项,具体取决于您希望在Google Analytics(分析)中跟踪什么。