javascript - 为什么用户计时数据没有显示在 Google Analytics 中?

标签 javascript google-analytics

我正在尝试将用户计时数据添加到已运行 Google Analytics(分析)的现有网站。它似乎已正确提交,但它没有显示在 Google Analytics(分析)仪表板中。我不知道如何进一步调试它...我陷入困境!

请参阅以下 HTML 示例。在此示例中,我尝试提交“事件”和“时间”。 结果:事件成功!但 Google Analytics(分析)中并未显示该时间。

<html>
<head>
<script>
    function universalAnalyticsPush() {
        if (!window.ga) {
            (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');

            window.ga('create', 'UA-xxxxxx-xx', 'auto');
        }

        window.ga.apply(window.ga, arguments);
    }

    universalAnalyticsPush('send', {
        'hitType': 'event',
        'eventCategory': 'test-corey-blobby-event',
        'eventAction': 'test-corey-marks',
        'eventLabel': 'geronimo',
        'eventValue': 33,
    });

    universalAnalyticsPush('send', {
    'hitType': 'timing',
    'timingCategory': 'test-corey-submission',
    'timingVar': 'test-corey-variation',
    'timingValue': 172,
    });
</script>
</head>
<body>
<p>Something.</p>
</body>
</html>

查看 Google Tag Assistant,事件和时机似乎都很好:

event data is submitting timing data is submitting

现在,如果我们在 Google Analytics 中查看“报告”->“实时”->“事件”,就会出现该事件,并且看起来很棒:

Google Analytics view of Real Time Events

但是没有用户计时数据(或者我没有在正确的位置寻找它):

Google Analytics view of User Timings

我的 JavaScript 中似乎没有任何错误。我收到的唯一警告来自使用 Google Analytics 调试器:

View of the Console with 1 warning, no errors

Chrome 的 WebView 表明跟踪调用已成功发生:

Chrome got 200 OK on both the event and the timing submissions

那么...为什么 Google Analytics 会忽略我的计时数据?

最佳答案

您正在使用实时事件报告,该报告将显示当前数据,但用户计时报告无法实时使用。您需要等待数据可用(4-6 小时),然后再检查。您正在查看的用户计时报告是正确的。

与此同时,我可能会读到 sampling rate for User Timings 。我怀疑它会影响您的数据,但需要考虑修改或只是一般性地理解。

希望有帮助!

关于javascript - 为什么用户计时数据没有显示在 Google Analytics 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34326123/

相关文章:

javascript - 使用 MediaRecorder API 在录制的视频中搜索不起作用

asp.net - 隐藏谷歌分析代码

reactjs - 有没有人成功地在 SPA React 应用程序中实现谷歌优化?

google-analytics - GTM : Purpose of "Click Listener" Tag Type?

google-analytics - 如何通过 Google Analytics Management API 设置 "Advertising Features"和其他设置?

javascript - 触发复选框单击按钮

javascript - 如何从 JavaScript 中的字符串中获取 ASCII 码?

javascript - Google Analytics - 如何在提交表单时跟踪登录用户的 ID

javascript - W3C/PhoneGap FileReader - 如何使用?

javascript - 请分享 JavaScript 中日历或日期选择器(弹出窗口)的代码以在 JSF 中实现