我可以使用Google Analytics跟踪IFRAME小部件吗?

时间:2021-04-10 15:20:43

We are going to launch JS based widgets which webmasters (any site) will be putting on their site by embedding a small code snippet like :

我们将通过嵌入一个小代码片段来启动基于JS的小部件,网站管理员(任何网站)将放在他们的网站上,如:

<iframe src="SOURCE_PATH" frameborder="0" width="300px" height="150px"  scrolling="no" id="cd_frame"></iframe>

Inside the widget there are three links and we need to track how many clicks are happening on them from the external sites where the widget is going to get used.

在小部件内部有三个链接,我们需要跟踪小部件将要使用的外部站点上发生的点击次数。

If I simply put the code which GA provides will that work? OR do I need to make any changes?

如果我只是简单地把GA提供的代码放在哪里?或者我需要进行任何更改吗?

Thanks.

1 个解决方案

#1


you should be able to track from your iframe as it would appear to google analytics as a regular page. your issue would be knowing what iframe you were tracking. if you can pass a unique id via the iframe url then you should be able to add a custom parameter to track the different sites.

你应该能够从你的iframe中进行跟踪,因为它似乎是谷歌分析作为常规页面。您的问题是知道您跟踪的iframe是什么。如果您可以通过iframe网址传递唯一ID,那么您应该能够添加自定义参数来跟踪不同的网站。

eg

<iframe src="SOURCE_PATH?uniquetrackingid=123" frameborder="0" width="300px" 
height="150px" scrolling="no" id="cd_frame"></iframe>

information about custom tracking codes can be found here http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55585

有关自定义跟踪代码的信息,请访问http://www.google.com/support/analytics/bin/answer.py?hl=zh-CN&answer=55585

#1


you should be able to track from your iframe as it would appear to google analytics as a regular page. your issue would be knowing what iframe you were tracking. if you can pass a unique id via the iframe url then you should be able to add a custom parameter to track the different sites.

你应该能够从你的iframe中进行跟踪,因为它似乎是谷歌分析作为常规页面。您的问题是知道您跟踪的iframe是什么。如果您可以通过iframe网址传递唯一ID,那么您应该能够添加自定义参数来跟踪不同的网站。

eg

<iframe src="SOURCE_PATH?uniquetrackingid=123" frameborder="0" width="300px" 
height="150px" scrolling="no" id="cd_frame"></iframe>

information about custom tracking codes can be found here http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55585

有关自定义跟踪代码的信息,请访问http://www.google.com/support/analytics/bin/answer.py?hl=zh-CN&answer=55585