在Google AnalyticsAPI跟踪代码中找不到错误
我已经添加了所有框架,并实施其他GA API代码并返回分析。 不知道错误是什么? 我得到“没有已知的实例select器sendEventWithCategory:
(IBAction)didTouchOnInviteButton { ContactListViewController *contactsViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"ContactListViewControllerId"]; contactsViewController.mode = modeInviteToEvent; contactsViewController.event = self.event; [self.navigationController pushViewController:contactsViewController animated:YES]; id <GAITracker> tracker = [[GAI sharedInstance] defaultTracker]; [tracker sendEventWithCategory:@"Contacts" withAction:@"Invite Button Pressed" withValue:1]; }
尝试这个:
[[GAI sharedInstance].defaultTracker sendEventWithCategory:@"Contacts" withAction:@"Invite Button Pressed" withLabel:nil withValue:@1];
你可以试试这个,对我有用
id <GAITracker> tracker = [[GAI sharedInstance] defaultTracker]; [tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"Contacts" action:@"Invite Button Pressed" label:@"Your label goes here..." value:[NSNumber numberWithInt:1]] build]];
由于缺less“ Label
字段,您会收到此错误。 此外, Value
应该是一个NSNumber
,你有一个int
。
请参阅Google的事件跟踪 – iOS SDK doco,其中声明:
一个事件由四个字段组成,您可以使用它来描述用户与您的应用内容的交互:
- NSString类别
- NSString操作
- NSString标签
- NSNumber(可选)值,解释为64位整数
你的代码应该是这样的:
id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker]; [tracker sendEventWithCategory:@"Contacts" withAction:@"Invite Button Pressed" withLabel:@"Your label goes here..." withValue:[NSNumber numberWithInt:1]];
此解决scheme工作。
[[GAI sharedInstance].defaultTracker sendEventWithCategory:@"Contacts" withAction:@"Invite Button Pressed" withLabel:nil withValue:@1];
- 在iOS上使用Google Analytics与Swift
- 在iOS中快速实施Google Analytics
- 谷歌分析电子商务价值并没有在谷歌分析控制台更新
- Google Analytics(分析)iOS广告系列跟踪和url构build器
- 谷歌分析ios sdk V2.0短会话持续时间
- Google Analytics Pod会安装太多的依赖项
- 无法使用带有IDFA的Google Analytics iOS SDKvalidation受众人口统计报告的跟踪代码
- 用户ID在Google Analytics仪表板(iOS)中不显示
- 无法将types为“NSMutableDictionary”的值转换为用于谷歌iOS强制types的“”分析