Iphone Google Analytics GANTracker-如何在IOS应用程序中使用setCustomVariable?
因为这些值是URL编码的,所以在GA站点中16:30变成了16%3A30。我想把它原样展示出来,即16:30。我该怎么做? 我从其他控制器设置的自定义变量也没有得到更新。 例如: 这不会得到更新。我知道数据需要一天才能在网站上反映出来。但只有自定义变量(键1)有数据。其他键显示“此视图没有数据”,尽管我使用的是索引2(请参阅上面的代码)。 有人能帮我吗 因为这些值是URL编码的,所以在GA站点中16:30变成了16%3A30。我想把它原样展示出来,即16:30。我该怎么做Iphone Google Analytics GANTracker-如何在IOS应用程序中使用setCustomVariable?,iphone,ios,google-analytics,analytics,Iphone,Ios,Google Analytics,Analytics,因为这些值是URL编码的,所以在GA站点中16:30变成了16%3A30。我想把它原样展示出来,即16:30。我该怎么做? 我从其他控制器设置的自定义变量也没有得到更新。 例如: 这不会得到更新。我知道数据需要一天才能在网站上反映出来。但只有自定义变量(键1)有数据。其他键显示“此视图没有数据”,尽管我使用的是索引2(请参阅上面的代码)。 有人能帮我吗 因为这些值是URL编码的,所以在GA站点中16:30变成了16%3A30。我想把它原样展示出来,即16:30。我该怎么做 谢谢大卫,但在我这方面
谢谢大卫,但在我这方面,我只得到16:30的字符串。当我使用GANTracker的“setCustomVariableAtIndex”方法将其传递给google服务器时,它会在站点上更新为16%3A30。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[GANTracker sharedTracker] startTrackerWithAccountID:kAnalyticsAccountId
dispatchPeriod:kGANDispatchPeriodSec
delegate:nil];
NSError *error;
NSCalendar * calendar = [NSCalendar currentCalendar];
NSDateComponents * components = [calendar components:NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSSecondCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit
fromDate:[NSDate date]];
NSString * stringTime = [NSString stringWithFormat:@"%d:%d",components.hour, components.minute];
if (![[GANTracker sharedTracker] setCustomVariableAtIndex:1
name:@"TIME"
value:stringTime
withError:&error]) {
NSLog(@"error in setCustomVariableAtIndex");
}
[self.window addSubview:navigationController.view];
[self.window makeKeyAndVisible];
return YES;
}
- (void)viewDidLoad {
[super viewDidLoad];
UIDevice *device = [UIDevice currentDevice];
NSError *errorMsg;
if (![[GANTracker sharedTracker] setCustomVariableAtIndex:2
name:@"DEVICE"
value:device.model
withError:&errorMsg]) {
NSLog(@"error in setCustomVariableAtIndex2");
}
}
NSString *testme = @"16%3A30";
testme = [testme stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSLog(@"testme = %@", testme); //16:30