自定义变量不显示为kGANPageScope?

时间:2012-09-01 18:10:14

标签: ios google-analytics-api

我正在使用三个不同的范围在我的应用中跟踪自定义变量,如下面的代码所示。但是,当我在Google Analytics中查看我的报告时,只会显示“访问者”和“会话”范围变量。页面变量似乎没有被记录(即“myCustomVariable1”和“myCustomVariable2”从未出现过。这是我第一次实现这个API,所以我必须遗漏一些东西。

NSString *deviceModel = [[UIDevice currentDevice]model];
NSString *systemVersion = [[UIDevice currentDevice]systemVersion];

if (![[GANTracker sharedTracker] setCustomVariableAtIndex:1
                                                         name:@"DeviceModel"
                                                        value:deviceModel
                                                        scope:kGANVisitorScope 
                                                    withError:&error]) {
        NSLog(@"error in setCustomVariableAtIndex");
    }

if (![[GANTracker sharedTracker] setCustomVariableAtIndex:1
                                                         name:@"SystemVersion"
                                                        value:systemVersion
                                                        scope:kGANSessionScope 
                                                    withError:&error]) {
        NSLog(@"error in setCustomVariableAtIndex");
    }

NSString *myCustomVariable1 = @"myCustomVariable1";

if (![[GANTracker sharedTracker] setCustomVariableAtIndex:1
                                                         name:@"myCustomVariable1"
                                                        value:myCustomVariable1
                                                        scope:kGANPageScope
                                                    withError:&error]) {
        NSLog(@"error in setCustomVariableAtIndex");
    }

NSString *myCustomVariable2 = @"myCustomVariable2";


    if (![[GANTracker sharedTracker] setCustomVariableAtIndex:2
                                                         name:@"myCustomVariable2"
                                                        value:myCustomVariable2 
                                                        scope:kGANPageScope
                                                    withError:&error]) {
        NSLog(@"error in setCustomVariableAtIndex");
    }

0 个答案:

没有答案