如何在iOS中跟踪表中的行选择事件 [英] How to track event of row selection in table in iOS

查看:104
本文介绍了如何在iOS中跟踪表中的行选择事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用Google Analytics跟踪事件?我可以跟踪屏幕名称,但我无法跟踪事件。我有这样的代码:
$ b $ pre $ [[GAI sharedInstance] .defaultTracker trackEventWithCategory:@UIAction
withAction:@ buttonPress
withLabel:@下一个按钮到第二页
withValue:[NSNumber numberWithInt:1]];

但是其中的类别,动作,标签和价值是多少?



我想跟踪表格中的行选择。那么我该如何为这个事件创建一个事件?

解决方案

您需要将代码放入 tableView :didSelectRowAtIndexPath:方法来跟踪表格行选择。然后,您需要正确命名类别,操作和标签。我会推荐这样的东西:

  NSString * label = [NSString stringWithFormat:@Section#%i,indexPath.section ]。 
[[GAI sharedInstance] .defaultTracker trackEventWithCategory:@Table#1
withAction:@Select Row
withLabel:label
withValue:[NSNumber numberWithInt:indexPath.row ]];

实际上,您可以根据需要命名类别,操作和标签。但最好给他们方便的名字,这样在你的统计数据中找到它们会更容易。


How to track events using Google Analytics? I can track the screen names but I can't track the events. I have code like this:

[[GAI sharedInstance].defaultTracker trackEventWithCategory:@"UIAction"
                                                 withAction:@"buttonPress"
                                                  withLabel:@"Next button to second page"
                                                  withValue:[NSNumber numberWithInt:1]];

But what are the category, action, label and value in it?

I want to track a row selection in a table. So how can I create an event for that?

解决方案

You need to place your code inside the tableView:didSelectRowAtIndexPath: method to track table row selection. Then you need to name category, action and label properly. I would recommend something like that:

NSString *label = [NSString stringWithFormat:@"Section #%i", indexPath.section];
[[GAI sharedInstance].defaultTracker trackEventWithCategory:@"Table #1"
                                                 withAction:@"Select Row"
                                                  withLabel:label
                                                  withValue:[NSNumber numberWithInt:indexPath.row]];

Actually, you can name category, action and label whatever you want. But it's better to give them convenient names, so it will be easier to find them in your statistics data.

这篇关于如何在iOS中跟踪表中的行选择事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆