Tôi muốn sử dụng phân tích google để theo dõi số lần xem trang và số phiên của một số người dùng nhất định. Để làm điều này tôi (muốn) sử dụng một biến tùy chỉnh được hỗ trợ bởi phiên bản GANTracker mới nhất (v1.1).Biến tùy chỉnh GANTracker cho SDK SDK cung cấp lỗi 195946409
trong appHeader của tôi, tôi có mã này:
[[GANTracker sharedTracker] startTrackerWithAccountID:@"UA-xxxxxxxx-x"
dispatchPeriod:10
delegate:nil];
NSError *error1;
if(![[GANTracker sharedTracker] setCustomVariableAtIndex:0
name:@"userSession"
value:@"username"
scope:kGANSessionScope
withError:&error1]){
NSLog(@"error1 %@", error1);
}
NSError *error2;
if(![[GANTracker sharedTracker] setCustomVariableAtIndex:1
name:@"userSession"
value:@"username"
scope:kGANPageScope
withError:&error2]){
NSLog(@"error2 %@", error2);
}
khi tôi bắt đầu ứng dụng của tôi tôi nhận được các lỗi này:
error1: Error Domain=com.google.googleanalytics.GANTrackerError Code=195946409 "The operation couldn’t be completed. (com.google.googleanalytics.GANTrackerError error 195946409.)"
error2: Error Domain=com.google.googleanalytics.GANTrackerError Code=195946409 "The operation couldn’t be completed. (com.google.googleanalytics.GANTrackerError error 195946409.)"
trong hàm mở ra một trang Tôi muốn theo dõi tôi đặt này :
NSError * error;
if(![[GANTracker sharedTracker] trackPageview:@"/pagename"]
withError:&error]){
NSLog(@"%@", error);
}
trả về này không có lỗi
nếu tôi bỏ qua hàm setCustomVariableAtIndex, lần xem trang được ghi lại trong phân tích nhưng với các vars tùy chỉnh, tôi không nhận được gì.
Có ai có ý tưởng về cách tôi có thể giải quyết vấn đề này không?
trong trường hợp một số googles này, tôi đã giải quyết nó (tôi nghĩ) bằng cách đặt chỉ mục ở 1 và 2 thay cho 0 và 1 – Weptunus