I am currently using Google Analytic in my iPad application to track pageviews and events that I have executed under the code for all of my viewController and button click events, but when my view has disappeared, my application stops / crashes. I put the stopTracker code [[GANTracker sharedTracker] stopTracker];in viewWillDisappear.
[[GANTracker sharedTracker] startTrackerWithAccountID:@"UA-12345678-1"
dispatchPeriod:kGANDispatchPeriodSec
delegate:nil];
NSError *error;
if (![[GANTracker sharedTracker] setCustomVariableAtIndex:1
name:@"iPad3"
value:@"iv1"
withError:&error]) {
}
if (![[GANTracker sharedTracker] trackEvent:@"my_category"
action:@"my_action"
label:@"my_label"
value:-1
withError:&error]) {
}
if (![[GANTracker sharedTracker] trackPageview:@"/app_entry_point_prashant"
withError:&error]) {
}
[[GANTracker sharedTracker] stopTracker];
Nitin source
share