简体   繁体   English

Adobe Air-分析

[英]Adobe Air - Analytics

I'm soon to be launching an Adobe AIR desktop app. 我即将启动Adobe AIR桌面应用程序。 To make the best out of future updates I need to get analytics of which features get used the most and which not. 为了从未来的更新中获得最大的收益,我需要分析哪些功能使用得最多,哪些功能没有使用。

How to track what the user clicks? 如何跟踪用户的点击?

I agree with @Pranav on the methods for logging the clicks, but I totally disagree with how he wants to implement the tracking on the client side. 我同意@Pranav记录点击次数的方法,但是我完全不同意他如何在客户端实施跟踪。

  • Extending the 'Button' class : violates several rules of good coding practice. 扩展'Button'类 :违反了良好编码实践的一些规则。 But I prefer to give a practical example instead of abstract rules: what if you want to track something other than Buttons? 但是我更喜欢给出一个实际的例子,而不是抽象的规则:如果您想跟踪Button以外的东西怎么办? Extend every visual component in the framework? 扩展框架中的每个可视组件? What if you want to track something other than clicks? 如果您想跟踪点击以外的内容怎么办? ... ...
  • Manually add the code in every click handler : seems like a lot of work if you have a larger application, plus it's hard to refactor if the need be. 在每个点击处理程序中手动添加代码 :如果您有一个较大的应用程序,这似乎需要大量工作,而且如果需要,则很难进行重构。

Solution

If all you need is clicks, then I would just have one click listener on the stage. 如果您只需要点击,那么我在舞台上只有一个点击监听器。 That way you can handle your click tracking in a class that is completely separate from the rest of your application. 这样,您就可以在与应用程序其余部分完全独立的类中处理点击跟踪。 And you can do it any way you like. 您可以按照自己喜欢的任何方式进行操作。 eg you could divide the screen into areas and see which areas are most clicked; 例如,您可以将屏幕划分为多个区域,然后查看点击次数最高的区域; you could use stage.getObjectsUnderPoint() to find all the objects that were just clicked (usually the topmost object is the one you want, but perhaps you want to log all of them). 您可以使用stage.getObjectsUnderPoint()查找刚刚单击的所有对象(通常最顶层的对象是您想要的对象,但也许您希望记录所有对象)。

Either way, you now have complete liberty in how you choose to track usage and the code is all in one place if you ever need to change anything. 无论哪种方式,您现在都可以完全自由选择如何跟踪使用情况,并且如果您需要进行任何更改,代码都可以放在一个地方。

If your app is almost done, then you should be pretty familiar with AIR. 如果您的应用程序即将完成,那么您应该对AIR非常熟悉。

You can do your tracking in 2 ways (There must be many more, but I'm going to highlight 2 of them). 您可以通过2种方式进行跟踪(必须有更多方法,但我将重点介绍其中2种)。 Both require you extending the Button class and doing different things in your click handler, or you could manually add the code in every click handler you want to track) 两者都需要您扩展Button类并在点击处理程序中执行不同的操作,或者您可以在要跟踪的每个点击处理程序中手动添加代码)

First 第一
You keep a click tracker service like clicky on your server. 您在服务器上保留了诸如clicky之类的点击跟踪服务。 The click handler should call the code that is given in the documentation of the analytics code 点击处理程序应调用分析代码文档中提供的代码

Second 第二
You write the feature used (or whatever else you want to track) to a log file which is then uploaded whenever an internet connection is there (Basically try to upload every 10 minutes or so and ignore any http errors). 您可以将使用的功能(或其他任何您想跟踪的功能)写入日志文件,然后在有互联网连接时将其上传(基本上尝试每10分钟左右上传一次,而忽略任何http错误)。 The upload script will parse the log file and then show you whatever information you require. 上传脚本将解析日志文件,然后向您显示所需的任何信息。 The log file will then be erased. 日志文件将被删除。

Look into using the Command Pattern. 查看使用命令模式。 In addition to rollback, it can count instances of that command. 除了回滚之外,它还可以计算该命令的实例。

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

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