我刚刚在一直在开发的应用程序上安装了iOS版Google Analytics(分析)。我只是对3个视图进行简单的屏幕跟踪。目前,除了iPad设备之外,我已经能够获得所有发送Google数据(iPhone模拟器,iPad模拟器,iPhone设备)的信息。我需要做一些配置才能使iPad设备正常工作吗?
我的代码:
在AppDelegate.h中:
#import <GoogleAnalytics-iOS-SDK/GAI.h>
在AppDelegate.m中:
// Optional: automatically send uncaught exceptions to Google Analytics.
[GAI sharedInstance].trackUncaughtExceptions = YES;
// Optional: set Google Analytics dispatch interval to e.g. 20 seconds.
[GAI sharedInstance].dispatchInterval = 5;
// Optional: set Logger to VERBOSE for debug information.
[[[GAI sharedInstance] logger] setLogLevel:kGAILogLevelVerbose];
// Initialize tracker. Replace with your tracking ID.
[[GAI sharedInstance] trackerWithTrackingId:@"XXXXXXX"];
在所有UIViewControllers的.h文件中:
#import <GoogleAnalytics-iOS-SDK/GAITrackedViewController.h>
#import <GoogleAnalytics-iOS-SDK/GAIDictionaryBuilder.h>
#import <GoogleAnalytics-iOS-SDK/GAIFields.h>
@interface ViewController : GAITrackedViewController
在所有UIViewControllers的.m文件中:
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
// May return nil if a tracker has not already been initialized with a
// property ID.
id tracker = [[GAI sharedInstance] defaultTracker];
// This screen name value will remain set on the tracker and sent with
// hits until it is set to a new value or to nil.
[tracker set:kGAIScreenName
value:@"iPhone Main Screen"];
// New SDK versions
[tracker send:[[GAIDictionaryBuilder createScreenView] build]];
}
任何帮助表示赞赏!
编辑:我正在使用3.10版的Google Analytics(分析)SDK,如果有帮助的话
终于知道发生了什么事。在Google Analytics(分析)信息中心的“实时”标签中,(默认情况下)顶部有一个“移动设备”标签。删除此选项后,我可以看到正在发送的iPad设备消息。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句