针对第三方JavaScript小部件的分析

时间:2021-12-13 15:50:47

I'm trying to find the best approach for analyics on 3rd party JavaScript widgets - i.e. tools and content that is distributed to any number of arbitrary users, who include the widgets as HTML snippets with tags.

我正在尝试为第三方JavaScript小部件找到最佳的分析方法 - 即分发给任意数量的任意用户的工具和内容,其中小部件包含带有标签的HTML片段。

On the same domain

Note that the widgets do not load into an iframe element that has a document loaded from the external site. Instead, they load content into the DOM of the host page - i.e. they are treated as being on the same domain as the host.

请注意,窗口小部件不会加载到具有从外部站点加载的文档的iframe元素中。相反,它们将内容加载到主机页面的DOM中 - 即它们被视为与主机位于同一域中。

Analytics for a fragment of the host page

So, essentially, I want to track stats (such as widget views, user clicks and custom interactions within the widget), but I only want to track stats for the fragment of the host page that is the widget. I don't want to track clicks on the host page that are outside the widget.

因此,基本上,我想跟踪统计信息(例如窗口小部件视图,用户点击和窗口小部件中的自定义交互),但我只想跟踪作为窗口小部件的主机页面片段的统计信息。我不想跟踪窗口小部件外部的主机页面上的点击。

I want the stats to be collated together, so that stats for the widget on site A will be aggregated with those of the widget on site B and site C, etc.

我希望将统计信息整理在一起,以便站点A上的窗口小部件的统计信息将与站点B和站点C上的窗口小部件的统计信息等汇总。

Questions

  1. Is it possible to use Google Analaytics in a custom way that satisfies these requirements? Or is it not possible to separate GA from the rest of the data collected on the host page?
  2. 是否可以以满足这些要求的自定义方式使用Google Analaytics?或者是否无法将GA与主页上收集的其他数据分开?

  3. If it is possible to use Google Analytics, then will there be a problem if the host page already uses GA (with a different GA profile ID), or is it possible to keep them safely apart?
  4. 如果可以使用Google Analytics,那么如果主页已经使用GA(具有不同的GA个人资料ID),或者是否可以将它们安全地分开,那么会出现问题吗?

  5. Are there any other analytics packages out there that are properly suited to widget stats tracking, to meet these requirements?
  6. 是否有其他适合小部件统计信息跟踪的分析软件包,以满足这些要求?

  7. Or, how else would you approach the problem of obtaining stats for these widgets?
  8. 或者,您如何处理获取这些小部件的统计信息的问题?

1 个解决方案

#1


8  

GA can be used for this, though since it is a free tool, it is a bit limited compared to the other tools out there. Example of other tools out there are Yahoo Web Analytics (YWA), Omniture SiteCatalyst, and Webtrends.

GA可用于此,但由于它是一个免费工具,与其他工具相比,它有点受限。其他工具的示例有Yahoo Web Analytics(YWA),Omniture SiteCatalyst和Webtrends。

Most of the tracking tools out there have the ability to do custom link and "event" tracking. Basically what you would do is lookup the necessary snippet of code for custom link tracking and put it into a wrapper function to be executed in an onclick event (or add an event listener, etc..).

大多数跟踪工具都可以进行自定义链接和“事件”跟踪。基本上你要做的是查找自定义链接跟踪所需的代码片段,并将其放入一个包装函数中,以便在onclick事件中执行(或添加一个事件监听器等)。

The first thing you want to do is decide what "events" you want to have for the widget(s). You mentioned counting "widget views". That's easy enough to do: just put a snippet of custom code on the page the widget is embedded on.

您要做的第一件事是决定您想要为窗口小部件添加哪些“事件”。你提到计算“小部件视图”。这很容易做到:只需在嵌入小部件的页面上放置一小段自定义代码即可。

But beyond that...does clicking any button count as a single event? Does each button signify a different event? etc... Also, are there any custom values you want to associate with the buttons, like a product ID or description or whatever.

但除此之外......点击任何按钮都算作单个事件?每个按钮是否表示不同的事件?等等...此外,是否有任何您想要与按钮关联的自定义值,例如产品ID或描述或其他。

Another important thing to ask yourself when deciding on what you want to track is "How actionable is this data?" There is very little you can't track, but there are a lot of things that aren't very useful for making real business decisions.

在决定要跟踪的内容时要问自己的另一个重要事项是“这些数据的可操作性如何?”很少有你无法跟踪,但有很多事情对做出真正的商业决策并不是很有用。

For example, it sounds like overall you are wanting to try to measure user interaction with widgets. I'm sure the idea is to figure out how useful, engaging, etc... they are to people, so you can figure out whether it's worth further developing them or throwing money at them or dropping them. Fair enough. But just remember to make the events goal-oriented. Knowing how many times a user clicked a button isn't very useful because all by itself it isn't very actionable. Knowing how many times people completed a process or step, etc.. is more actionable.

例如,听起来总体上您想要尝试测量用户与小部件的交互。我确信这个想法是要弄清楚它们对人们有多么有用,有吸引力等等,所以你可以弄清楚是否值得进一步开发它们或向它们投钱或放弃它们。很公平。但请记住让事件以目标为导向。知道用户点击按钮的次数不是很有用,因为它本身并不是非常有效的。知道人们完成一个过程或步骤等的次数是更有效的。

Once you have made a list of what all you want to track and when, then you can start building your custom code.

一旦列出了所有想要跟踪的内容以及何时,您就可以开始构建自定义代码了。

With GA, there are 2 main ways to track events and metrics: through steps/goals, and through custom variables. The way you setup steps/goals with GA is to have GA match what the URL of the page is. For example, if you have a newsletter signup form, the form page might be signup.html and the confirmation page might be signup_confirmation.html. You would then setup a goal in the GA interface. The goal would match for signup_confirmation.html and you could have a step be to look for signup.html. Then you can see how many people viewed your form and completed it vs. abandoned it.

使用GA,有两种主要方式可以跟踪事件和指标:通过步骤/目标和自定义变量。使用GA设置步骤/目标的方法是让GA匹配页面的URL。例如,如果您有简报注册表单,则表单页面可能是signup.html,确认页面可能是signup_confirmation.html。然后,您将在GA界面中设置目标。目标将与signup_confirmation.html匹配,您可以采取措施寻找signup.html。然后,您可以看到有多少人查看了您的表单并完成了它而不是放弃它。

You can use this same tracking method with events, by pushing a virtual page view to GA.

通过将虚拟页面视图推送到GA,您可以对事件使用相同的跟踪方法。

Here is an article detailing how to push a virtual page view:

这篇文章详细介绍了如何推送虚拟页面视图:

http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55521

But basically, whenever the event happens (like a view of the widget, click of a button, etc.. you would execute the following javascript:

但基本上,每当事件发生时(如窗口小部件的视图,单击按钮等等),您将执行以下javascript:

pageTracker._trackPageview(’virtual url here’);

pageTracker._trackPageview('virtual url here');

Main thing to note about this method is that you can organize/categorize/provide hierarchy to your data by passing delimited values. This will help you rollup data for different widgets/sites.

关于此方法的主要注意事项是,您可以通过传递分隔值来组织/分类/提供数据层次结构。这将帮助您汇总不同小部件/站点的数据。

The 2nd way to record events is with custom variables. Making use of custom variables during events provides a lot of reporting possibilities and flexibility. Here is a link to how to use them:

记录事件的第二种方法是使用自定义变量。在事件期间使用自定义变量提供了大量的报告可能性和灵活性。以下是如何使用它们的链接:

http://code.google.com/apis/analytics/docs/tracking/gaTrackingCustomVariables.html

#1


8  

GA can be used for this, though since it is a free tool, it is a bit limited compared to the other tools out there. Example of other tools out there are Yahoo Web Analytics (YWA), Omniture SiteCatalyst, and Webtrends.

GA可用于此,但由于它是一个免费工具,与其他工具相比,它有点受限。其他工具的示例有Yahoo Web Analytics(YWA),Omniture SiteCatalyst和Webtrends。

Most of the tracking tools out there have the ability to do custom link and "event" tracking. Basically what you would do is lookup the necessary snippet of code for custom link tracking and put it into a wrapper function to be executed in an onclick event (or add an event listener, etc..).

大多数跟踪工具都可以进行自定义链接和“事件”跟踪。基本上你要做的是查找自定义链接跟踪所需的代码片段,并将其放入一个包装函数中,以便在onclick事件中执行(或添加一个事件监听器等)。

The first thing you want to do is decide what "events" you want to have for the widget(s). You mentioned counting "widget views". That's easy enough to do: just put a snippet of custom code on the page the widget is embedded on.

您要做的第一件事是决定您想要为窗口小部件添加哪些“事件”。你提到计算“小部件视图”。这很容易做到:只需在嵌入小部件的页面上放置一小段自定义代码即可。

But beyond that...does clicking any button count as a single event? Does each button signify a different event? etc... Also, are there any custom values you want to associate with the buttons, like a product ID or description or whatever.

但除此之外......点击任何按钮都算作单个事件?每个按钮是否表示不同的事件?等等...此外,是否有任何您想要与按钮关联的自定义值,例如产品ID或描述或其他。

Another important thing to ask yourself when deciding on what you want to track is "How actionable is this data?" There is very little you can't track, but there are a lot of things that aren't very useful for making real business decisions.

在决定要跟踪的内容时要问自己的另一个重要事项是“这些数据的可操作性如何?”很少有你无法跟踪,但有很多事情对做出真正的商业决策并不是很有用。

For example, it sounds like overall you are wanting to try to measure user interaction with widgets. I'm sure the idea is to figure out how useful, engaging, etc... they are to people, so you can figure out whether it's worth further developing them or throwing money at them or dropping them. Fair enough. But just remember to make the events goal-oriented. Knowing how many times a user clicked a button isn't very useful because all by itself it isn't very actionable. Knowing how many times people completed a process or step, etc.. is more actionable.

例如,听起来总体上您想要尝试测量用户与小部件的交互。我确信这个想法是要弄清楚它们对人们有多么有用,有吸引力等等,所以你可以弄清楚是否值得进一步开发它们或向它们投钱或放弃它们。很公平。但请记住让事件以目标为导向。知道用户点击按钮的次数不是很有用,因为它本身并不是非常有效的。知道人们完成一个过程或步骤等的次数是更有效的。

Once you have made a list of what all you want to track and when, then you can start building your custom code.

一旦列出了所有想要跟踪的内容以及何时,您就可以开始构建自定义代码了。

With GA, there are 2 main ways to track events and metrics: through steps/goals, and through custom variables. The way you setup steps/goals with GA is to have GA match what the URL of the page is. For example, if you have a newsletter signup form, the form page might be signup.html and the confirmation page might be signup_confirmation.html. You would then setup a goal in the GA interface. The goal would match for signup_confirmation.html and you could have a step be to look for signup.html. Then you can see how many people viewed your form and completed it vs. abandoned it.

使用GA,有两种主要方式可以跟踪事件和指标:通过步骤/目标和自定义变量。使用GA设置步骤/目标的方法是让GA匹配页面的URL。例如,如果您有简报注册表单,则表单页面可能是signup.html,确认页面可能是signup_confirmation.html。然后,您将在GA界面中设置目标。目标将与signup_confirmation.html匹配,您可以采取措施寻找signup.html。然后,您可以看到有多少人查看了您的表单并完成了它而不是放弃它。

You can use this same tracking method with events, by pushing a virtual page view to GA.

通过将虚拟页面视图推送到GA,您可以对事件使用相同的跟踪方法。

Here is an article detailing how to push a virtual page view:

这篇文章详细介绍了如何推送虚拟页面视图:

http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55521

But basically, whenever the event happens (like a view of the widget, click of a button, etc.. you would execute the following javascript:

但基本上,每当事件发生时(如窗口小部件的视图,单击按钮等等),您将执行以下javascript:

pageTracker._trackPageview(’virtual url here’);

pageTracker._trackPageview('virtual url here');

Main thing to note about this method is that you can organize/categorize/provide hierarchy to your data by passing delimited values. This will help you rollup data for different widgets/sites.

关于此方法的主要注意事项是,您可以通过传递分隔值来组织/分类/提供数据层次结构。这将帮助您汇总不同小部件/站点的数据。

The 2nd way to record events is with custom variables. Making use of custom variables during events provides a lot of reporting possibilities and flexibility. Here is a link to how to use them:

记录事件的第二种方法是使用自定义变量。在事件期间使用自定义变量提供了大量的报告可能性和灵活性。以下是如何使用它们的链接:

http://code.google.com/apis/analytics/docs/tracking/gaTrackingCustomVariables.html