5
現在我使用谷歌分析在我的iPad應用程序,用於跟蹤瀏覽量和事件我有下面的代碼來實現我所有的viewController和按鈕單擊事件,但是當我的視線中消失我的應用程序停止/ crash.I已經在viewWillDisappear推杆stopTracker代碼[[GANTracker sharedTracker] stopTracker];
方法。谷歌分析[[GANTracker sharedTracker] stopTracker];
[[GANTracker sharedTracker] startTrackerWithAccountID:@"UA-12345678-1"
dispatchPeriod:kGANDispatchPeriodSec
delegate:nil];
NSError *error;
if (![[GANTracker sharedTracker] setCustomVariableAtIndex:1
name:@"iPad3"
value:@"iv1"
withError:&error]) {
// Handle error here
}
if (![[GANTracker sharedTracker] trackEvent:@"my_category"
action:@"my_action"
label:@"my_label"
value:-1
withError:&error]) {
// Handle error here
}
if (![[GANTracker sharedTracker] trackPageview:@"/app_entry_point_prashant"
withError:&error]) {
// Handle error here
}
[[GANTracker sharedTracker] stopTracker];