1

我在我的客户网站上构建页面,这些页面可以是他们合作伙伴网站上的 iframe。
我在网站上包含了这个 GA 代码。

    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-1494300-1']);
    _gaq.push(['_setDomainName', 'mysite.com']);
    _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);
        _gaq.push(['_trackEvent', 'iframe', '/products/default.aspx', 'Petersburg- Zip Code:26847',, false]);

    })();

我已经验证了代码显示并在从 iframe 中拉入网站时被调用,但是,我们没有在 GA 中获得任何事件数据。我已经阅读了 iframe 和 GA 跟踪,大多数问题似乎是跨域限制的结果。但是,通过这种实现,我不需要来自父母的任何信息,而父母也不需要来自我的任何信息,我只需要事件数据。有任何想法吗?

4

2 回答 2

1
  1. 确保您没有任何过滤器过滤掉数据
  2. 确保您列出的_setDomainName域与您的 iframe 域匹配
  3. 确保您指向正确的帐户#
于 2013-02-08T23:13:14.770 回答
1

谷歌分析依赖于 cookie。不同域中 iframe 中的 Cookie 从技术上讲是第 3 方 Cookie。默认情况下,Safari 会阻止第三方 cookie。您仍然应该看到 Chrome 和 Firefox 用户的大部分流量,除了少数更改默认设置的用户。

对于 Internet Explorer 流量,您必须确保在 iframe 的响应中实施 P3P 紧凑策略。否则,第三方 cookie 也将被阻止。

阅读有关如何为 Google Analytics 设置 P3P CP 标头的更多信息

于 2013-02-08T23:08:23.607 回答