2011-03-15 9 views
0

グリーティング、 私はiPhone用のGoogleアナリティクスについて少し苦労しており、10秒のdispatchPeriodが無視されていることに気付いています。私が追跡しているすべてのイベントは、Googleアナリティクスのサイトでうまくいきますが、データがアップロードされるのは、アプリが再起動されたときだけだと思います。私は派遣スケジュールが待ち行列に入れられた出来事を世話することを望んでいた。GoogleアナリティクスのiPhone SDK(dispatchPeriod)

私はそうのように私のトラッカーを開始します。

-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    NSLog(@"App Delegate: applicationDidFinishLaunching"); 

    [[GANTracker sharedTracker] startTrackerWithAccountID:@"UA-xxxxxxx-x" 
              dispatchPeriod:10 
               delegate:self]; 

    NSError *error; 

    if (![[GANTracker sharedTracker] trackEvent:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"] 
             action:@"launch" 
              label:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"] 
              value:-1 
             withError:&error]) { 

     NSLog(@"GANTracker - %@", [error localizedDescription]); 
    } 

    [window addSubview:self.navigationController.view]; 
    [window makeKeyAndVisible]; 

    return YES; 
} 

    -(void)trackerDispatchDidComplete:(GANTracker *)tracker eventsDispatched:(NSUInteger)eventsDispatched eventsFailedDispatch:(NSUInteger)eventsFailedDispatch 
    { 
     //The delegate method only gets called once at launch 

     NSLog(@"Google Analytics: Events Dispatched = %i | Events Failed Dispatched = %i", eve 

ntsDispatched, eventsFailedDispatch); 
} 

と私はそうのようなイベントを追跡:

if (![[GANTracker sharedTracker] trackEvent:@"preview" 
               action:@"preview" 
                label:@"preview" 
                value:-1 
               withError:&error]) { 

       NSLog(@"GANTracker - %@", [error localizedDescription]); 

     } 

答えて

0

はそれを考え出しました。 detachedトレッドからtrackEventメソッドを呼び出す際の問題でした。

関連する問題