我在使用 Google Analytics v3.1 的实时数据时遇到问题,用户、事件、电子商务工作正常,但没有显示屏幕跟踪等实时功能。
这是 GAI 初始化程序代码:
[GAI sharedInstance].trackUncaughtExceptions = YES;
[GAI sharedInstance].dispatchInterval = 20;
[[[GAI sharedInstance] logger] setLogLevel:kGAILogLevelVerbose];
[[GAI sharedInstance] trackerWithTrackingId:@"MY-TRACK-ID"];
然后我GAITrackedViewController
通过继承所有的控制器从BaseViewController : GAITrackedViewController
. - (void) viewDidLoad
然后我在方法中为所有需要的控制器设置屏幕名称,如
- (void)viewDidLoad {
[super viewDidLoad];
self.screenName = @"Some Screen Name";
}
没有错误显示,数据发送成功(我想)。我也试图把这条线放到- (void)viewWillAppear:
方法中,但什么也没发生。跟踪 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:@"Some screen name"];
[tracker send:[[GAIDictionaryBuilder createAppView] build]];
和同样的结果。即使手动调用 dispatch 方法。
self.tracker
我注意到我的每个视图控制器中的实例都是奇怪的nil
,但[[GAI sharedInstance] defaultTracker]
按预期返回跟踪器值。
提前致谢!
更新 1
@djabi 这是详细日志:
XXXX[285:31027] GoogleConversionPing: Already sent successful ping with conversion label XXXXXXX.
XXX[285:31091] VERBOSE: GoogleAnalytics 3.10 -[GAIBatchingDispatcher persist:] (GAIBatchingDispatcher.m:497): Saved hit: {
parameters = {
"&_crc" = 0;
"&_u" = ".etnyL";
"&_v" = "mi3.1.0";
"&a" = 1172034152;
"&aid" = "my.app.id";
"&an" = AppName;
"&ate" = "<null>";
"&av" = "2.34";
"&cid" = "Id";
"&ds" = app;
"&ea" = AppOpen;
"&ec" = AppOpen;
"&el" = AppOpen;
"&ev" = "<null>";
"&idfa" = "<null>";
"&sr" = 320x568;
"&t" = event;
"&tid" = "GAI_TRACK_ID";
"&ul" = ru;
"&v" = 1;
"&z" = 272140373952857015;
gaiVersion = "3.10";
};
timestamp = "2015-02-19 17:33:12 +0000";
}
XXXX[285:31027] INFO: GoogleAnalytics 3.10 -[GAIReachabilityChecker reachabilityFlagsChanged:]