简体   繁体   English

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

[英]Analytics for 3rd party JavaScript widgets

I'm trying to find the best approach for analyics on 3rd party JavaScript widgets - ie 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. 请注意,窗口小部件不会加载到具有从外部站点加载的文档的iframe元素中。 Instead, they load content into the DOM of the host page - ie they are treated as being on the same domain as the host. 相反,它们将内容加载到主机页面的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? 是否可以以满足这些要求的自定义方式使用Google Analaytics? Or is it not possible to separate GA from the rest of the data collected on the host page? 或者是否无法将GA与主页上收集的其他数据分开?
  2. 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? 如果可以使用Google Analytics,那么如果主页已经使用GA(具有不同的GA个人资料ID),或者是否可以将它们安全地分开,那么会出现问题吗?
  3. Are there any other analytics packages out there that are properly suited to widget stats tracking, to meet these requirements? 是否还有其他适合小组件统计信息跟踪的分析软件包,以满足这些要求?
  4. Or, how else would you approach the problem of obtaining stats for these widgets? 或者,您如何解决获取这些小部件的统计数据的问题?

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. GA可用于此,但由于它是一个免费工具,与其他工具相比,它有点受限。 Example of other tools out there are Yahoo Web Analytics (YWA), Omniture SiteCatalyst, and Webtrends. 其他工具的示例有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. 使用GA,有两种主要方法可以跟踪事件和指标:通过步骤/目标和自定义变量。 The way you setup steps/goals with GA is to have GA match what the URL of the page is. 使用GA设置步骤/目标的方法是让GA匹配页面的URL。 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. 例如,如果您有简报注册表单,则表单页面可能是signup.html,确认页面可能是signup_confirmation.html。 You would then setup a goal in the GA interface. 然后,您将在GA界面中设置目标。 The goal would match for signup_confirmation.html and you could have a step be to look for signup.html. 目标将与signup_confirmation.html匹配,您可以采取措施寻找signup.html。 Then you can see how many people viewed your form and completed it vs. abandoned it. 然后,您可以看到有多少人查看了您的表单并完成了它而不是放弃它。

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 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 http://code.google.com/apis/analytics/docs/tracking/gaTrackingCustomVariables.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM