2011-03-15 48 views
0

问候, 我一直在为iPhone分析一下iPhone的谷歌分析,我注意到10秒的dispatch周期被忽略。我所追踪的所有活动在Google Analytics(分析)网站上都很顺利,但我相信数据上传的唯一时间就是重新启动应用程序的时间。我希望派遣时间表能够照顾任何排队的事件。谷歌分析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

想通了。从分离的花纹中调用trackEvent方法是个问题。