我在我的应用程序上使用 Google Analytics iOS SDK V3,如下所示:
AppDelegate.m
- (void)setupGoogleAnalytics
{
[GAI sharedInstance].trackUncaughtExceptions = YES;
[GAI sharedInstance].dispatchInterval = 20;
[[[GAI sharedInstance] logger] setLogLevel:kGAILogLevelVerbose];
self.tracker = [[GAI sharedInstance] trackerWithTrackingId:@"myUAID"];
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
[GAI sharedInstance].optOut =
![[NSUserDefaults standardUserDefaults] boolForKey:kTrackingPreferenceKey];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[self setupGoogleAnalytics];
return YES;
}
视图控制器.m
- (void)viewDidLoad
{
[super viewDidLoad];
[[GAI sharedInstance].defaultTracker set:kGAIScreenName value:@"Home View"];
[[GAI sharedInstance].defaultTracker send:[[GAIDictionaryBuilder createAppView] build]];
}
我让应用程序在模拟器中运行,但在 Google Analytics(分析)仪表板上什么也没得到。我错过了什么吗?请注意,我使用的是最新的 SDK v3。