2011-03-11 12 views
6

मैं कुछ उपयोगकर्ताओं द्वारा पेजव्यू और सत्र ट्रैक करने के लिए Google Analytics का उपयोग करना चाहता हूं। ऐसा करने के लिए मैं (कस्टम करना चाहते हैं) एक कस्टम चर का उपयोग करें जो नवीनतम (v1.1) GANTracker संस्करण द्वारा समर्थित हैं। समारोह एक पृष्ठ मैं मैं इस डाल ट्रैक करना चाहते हैं खुलती मेंआईफोन एसडीके कस्टम चर के लिए गैन्ट्रेकर त्रुटि देता है 1 9 5 9 4640 9

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.)" 

:

[[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); 
} 

जब मैं अपने अनुप्रयोग शुरू मैं इन त्रुटियों को मिलता है:

मेरी appHeader में

मैं इस कोड है :

NSError * error; 
if(![[GANTracker sharedTracker] trackPageview:@"/pagename"] 
            withError:&error]){ 
     NSLog(@"%@", error); 
} 

इस कोई त्रुटि देता है

0,123,

अगर मैं setCustomVariableAtIndex फ़ंक्शन को छोड़ देता हूं तो पृष्ठदृश्य एनालिटिक्स में लॉग होता है लेकिन कस्टम वर्र्स के साथ मुझे कुछ भी नहीं मिलता है।

क्या किसी को यह पता है कि मैं इस समस्या को कैसे हल कर सकता हूं?

+0

मामले में कुछ Googles इस, मैं इसे हल की जरूरत है 0 और 1 – Weptunus

उत्तर

6

मैंने एक ही समस्या को मारा और Google's sample code में उत्तर पर ठोकर खाई।

यदि आप इंडेक्स को शून्य पर सेट करते हैं तो कस्टम चर एक त्रुटि फेंक देते हैं। आपका पहला चर (मुझे लगता है कि) 1 और 2 में सूचकांक की स्थापना करके सूचकांक 1. उपयोग करने के लिए यह इस तरह देखने के लिए ऊपर कोड स्निपेट बदल जाएगा ...

[[GANTracker sharedTracker] startTrackerWithAccountID:@"UA-xxxxxxxx-x" 
             dispatchPeriod:10 
              delegate:nil]; 

NSError *error1; 
if(![[GANTracker sharedTracker] setCustomVariableAtIndex:1 
                name:@"userSession" 
                value:@"username" 
                scope:kGANSessionScope 
               withError:&error1]){ 
    NSLog(@"error1 %@", error1); 
} 

NSError *error2; 
if(![[GANTracker sharedTracker] setCustomVariableAtIndex:2 
                name:@"userSession" 
                value:@"username" 
                scope:kGANPageScope 
               withError:&error2]){ 
    NSLog(@"error2 %@", error2); 
} 
+0

के चरण में मैंने अनजाने में एक शून्य मूल्य पारित करके (या बहुत समान) परिणाम प्राप्त करने में कामयाब रहे। –