我尝试通过Google Analytics实施自定义维度。在我的调试会话期间,我会将所有内容都放入正确的数组中,但在GA中它并没有显示出来。
任何人都可以帮我解决这个问题吗?
(void)initGoogleAnalyticsWithSettings:(NSDictionary *)profileDict {
NSString *trackingCode = [profileDict valueForKeyPath:@"settings.trackingCode"];
if (trackingCode == nil) {
trackingCode = @"UA-xxxx-1";
}
NSString *organisation = [profileDict valueForKeyPath:@"settings.organisation"];
if (organisation == nil) {
organisation = @"Unkonwn organisation";
}
NSArray *unitArray = [profileDict valueForKeyPath:@"settings.unit"];
NSString *unit = [unitArray firstObject];
if (unit == nil) {
unit = @"Unknown unit";
}
NSString *userIDString = [NSString stringWithFormat:@"%@ | %@", organisation, unit];
GAI *gai = [GAI sharedInstance];
gai.trackUncaughtExceptions = YES; // report uncaught exceptions
self.tracker = [gai trackerWithTrackingId:trackingCode];
self.tracker.allowIDFACollection = YES;
[self.tracker set:kGAIUserId value:userIDString];
[self.tracker set:[GAIFields customDimensionForIndex:1] value:userIDString];
}
我是否还需要实现跟踪器发送事件?
[tracker send:[[[GAIDictionaryBuilder createScreenView] set:@"premium"
forKey:[GAIFields customDimensionForIndex:1]] build]];