本文介绍了是否有可能使用iOS模拟器中的Google Analytics跟踪应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试使用Google Analytics(分析)来追踪我的应用,但没有看到它何时以实时模式打开。我使用 Google Analytics for Mobile Apps iOS SDK v3
。
在 Delegate.m
:
$ b $
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
/ /可选:自动将未捕获的例外发送给Google Analytics。
[GAI sharedInstance] .trackUncaughtExceptions = YES;
//可选:将Google Analytics派送间隔设置为例如20秒。
[GAI sharedInstance] .dispatchInterval = 20;
//可选:将记录器设置为VERBOSE以获取调试信息。
[[[GAI sharedInstance] logger] setLogLevel:kGAILogLevelVerbose];
//初始化跟踪器。
[[GAI sharedInstance] trackerWithTrackingId:@UA-MYTRACKID-HERE];
返回YES;
}
也许,在IOS模拟器中不可能?
$ b $ Google Analytics(分析)也适用于iOS模拟器。只需要一点时间就可以显示实时数据(通常为5-10秒)。模拟器唯一的问题是Google Analytics可能会将iPad模拟器报告为iPhone,但这并不是什么大问题。I tried to track my app using Google Analytics but didn't see when it opened in "real-time mode".
I'm using Google Analytics for Mobile Apps iOS SDK v3
.
In Delegate.m
:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
// 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 = 20;
// Optional: set Logger to VERBOSE for debug information.
[[[GAI sharedInstance] logger] setLogLevel:kGAILogLevelVerbose];
// Initialize tracker.
[[GAI sharedInstance] trackerWithTrackingId:@"UA-MYTRACKID-HERE"];
return YES;
}
Maybe, it's not possible in IOS Simulator?
解决方案
Google Analytics work in iOS Simulator too. Just give it a little time in order to appear in real time data (usually 5-10 secs). The only issue with the simulator is that Google Analytics may report the iPad simulator as an iPhone but this is not such a big deal.
这篇关于是否有可能使用iOS模拟器中的Google Analytics跟踪应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!