> I hope it's help you.
// Call this on didFinishLaunchingWithOptions
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[self startGoogleAnalyticsTracking];
[self performSelector:@selector(sendGoogleAnalyticsStartup) withObject:nil afterDelay:3];
// --------- Enter your code here
----------//
return YES;
}
- (void)startGoogleAnalyticsTracking {
@try {
// self.googleAnalyticsTracker = [[GAI sharedInstance] trackerWithTrackingId:”PASTE YOUR TRACKING ID HERE”];
// 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 = 10;
// Optional: set debug to YES for extra debugging information.
[GAI sharedInstance].debug = YES;
// **** REPLACE Tracking Id with your own GA Tracking Id **** //
// Create tracker instance.Tracking Id
id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:@"Tracking Id"];
[tracker sendView:@"Application Loaded"];
}@catch (NSException *exception) {
NSLog(@"exception:%@",exception);
}
}
- (void)sendGoogleAnalyticsStartup {
@try {
[self.googleAnalyticsTracker sendEventWithCategory:@"Application Events" withAction:nil withLabel:@"Tracking Starts" withValue:nil];
}@catch (NSException *exception) {
NSLog(@"exception=%@",exception);
}
}
- (void)stopGoogleAnalyticsTracking {
@try {
[self.googleAnalyticsTracker sendEventWithCategory:@"Application Events" withAction:nil withLabel:@"Tracking Suspended /Stopped" withValue:nil];
}@catch (NSException *exception) {
NSLog(@"exception=%@",exception);
}
}
谢谢你的快速回答,但我已经找到了“问题”,这不是一个真正的问题。我确实设置了一切。但Google Analytics需要一些时间来分析数据。它需要很长的时间才会出现在Web界面中,因此对于每个遇到类似问题的人:耐心等待! – OutOfBounds
它没有问题 –