Google Analytics:跟踪页面浏览量,但不跟踪电子商务交易

发布于 2024-10-20 19:43:02 字数 1533 浏览 2 评论 0原文

我试图找出为什么 Google Analytics 中的电子商务跟踪似乎不起作用。我可以看到正确跟踪的页面浏览量,但没有交易。

确认页面的片段:

<head>
<script type="text/javascript">
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-XXXXXXX-1']);
    _gaq.push(['_setDomainName', '.mydomain.com']);
    _gaq.push(['_trackPageview']);

    _gaq.push(['b._setAccount', 'UA-YYYYYYYY-1']);
    _gaq.push(['b._setDomainName', 'none']);
    _gaq.push(['b._addTrans',
                  '44bbd391-ff38-4f8d-ad68-aec490666151',
                  'Name',
                  '1.00',
                  '',
                  '',
                  '',
                  '',
                  ''
              ]);
    _gaq.push(['b._addItem',
                  '44bbd391-ff38-4f8d-ad68-aec490666151',
                  '15',
                  'test',
                  '',
                  '1.00',
                  '1'
              ]);
    _gaq.push(['b._trackTrans']);

    _gaq.push(['b._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>

我正在使用 Firebug 监控页面上的流量,确认所有像素请求均已发出并正常返回。

我读到过要等几个小时,最多一天,才能在 GA 中看到结果,但我只等几分钟就可以看到页面浏览量。

但是,使用相同跟踪器对象(“b”)跟踪的交易在任何地方都找不到(电子商务报告的刷新速度可能比页面视图慢吗?)

I'm trying to figure out why the Ecommerce tracking in Google Analytics doesn't seem to work. I can see the page views correctly tracked but no transactions.

Snippet from the confirmation page:

<head>
<script type="text/javascript">
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-XXXXXXX-1']);
    _gaq.push(['_setDomainName', '.mydomain.com']);
    _gaq.push(['_trackPageview']);

    _gaq.push(['b._setAccount', 'UA-YYYYYYYY-1']);
    _gaq.push(['b._setDomainName', 'none']);
    _gaq.push(['b._addTrans',
                  '44bbd391-ff38-4f8d-ad68-aec490666151',
                  'Name',
                  '1.00',
                  '',
                  '',
                  '',
                  '',
                  ''
              ]);
    _gaq.push(['b._addItem',
                  '44bbd391-ff38-4f8d-ad68-aec490666151',
                  '15',
                  'test',
                  '',
                  '1.00',
                  '1'
              ]);
    _gaq.push(['b._trackTrans']);

    _gaq.push(['b._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>

I'm monitoring the traffic on the page with Firebug confirming that all pixel requests were made and came back OK.

I read about having to wait a few hours, up to one day, before you can see results in GA, but I can see the page views after only waiting a few minutes.

However, the transactions tracked using the same tracker object ("b") are not to be found anywhere(could the Ecommerce reports be refreshing slower than the page views?)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

姜生凉生 2024-10-27 19:43:02

我终于发现了问题。答案就隐藏在 GA 文档页面上

_trackTrans()

发送交易和项目
数据传输至 Google Analytics 服务器。
该方法应该在之后调用
_trackPageview(),并与 _addItem() 和
addTrans() 方法。

它很容易被忽视,但它有一个根本性的影响:交易不会被跟踪。

所以,是的,请始终在_trackPageview之后调用_trackTrans

And I finally found the issue. The answer is inconspicuously present on the GA docs page:

_trackTrans()

Sends both the transaction and item
data to the Google Analytics server.
This method should be called after
_trackPageview(), and used in conjunction with the _addItem() and
addTrans() methods.

It's rather easy to overlook but it has such a fundamental effect: transactions won't be tracked.

So yes, always call _trackTrans after _trackPageview!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文