【发布时间】:2010-09-14 04:21:23
【问题描述】:
我们公司运营一个网站 (oursite.com),其中的关联合作伙伴向我们发送流量。在某些情况下,我们会使用自己的子域 (affiliate.oursite.com) 设置关联公司,并使用 iframe 在其网站 (affiliate.com) 上显示我们网站的选定内容。
他们网站上的页面示例:
<html>
<head></head>
<body>
<iframe src="affiliate.example.com/example_page.html">
...content...
[google analytics code for affiliate.oursite.com]
</iframe>
[google analytics code for affiliate.com]
</body>
</html>
我们希望对affiliate.oursite.com 进行谷歌分析跟踪。目前,当页面从 iframe 加载时,Google 似乎没有收到任何来自关联公司的数据。
现在,存在安全隐患,因为 Javascript 不喜欢访问有关不同域中页面的信息,而 IE 不喜欢为不同域设置 cookie。
有没有人可以解决这个问题?我们是否需要将affiliate.oursite.com 命名为 cname.oursite.com,还是有更简洁的解决方案?
【问题讨论】:
-
到底是什么问题?期望的输出是什么?
-
我已编辑问题以更清楚地说明问题。
-
在 iframe 中运行谷歌分析并不是好的做法。另一种方法是,如果您想跟踪您的网站流量,您可以使用 embed api 进行谷歌分析。 developers.google.com/analytics/devguides/reporting/embed/v1/…ga-dev-tools.appspot.com/embed-api
标签: javascript iframe google-analytics cross-domain tracking