More importantly, how do I fix it?
It\'s as if backgrounding the app doesn\'t end the session.
to end the session when the app goes to background, use
applicationWillResignActive
and maybe put about:blank or something in your webview. (assumption ;))
save the location and reload it in
applicationDidBecomeActive
or read more here
When your app goes into background mode it needs to tell the analytics to stop tracking.
Application Delegate would have something like:
-(void) applicationDidEnterBackground:(UIApplication*)application
{
[[GANTracker sharedTracker] stopTracker];
}
In google's Easy Tracker example, a view controller receives notifications when app state changes. Tracking is stopped when app goes into background (Around line 400).
if ([application applicationState] == UIApplicationStateBackground) {
if (self.state == EasyTrackerStateForeground) {
// Transitioned from foreground to background. Generate the app stop
// event, and stop the tracker.
NSLog(@"Transitioned from foreground to background.");
NSError *error = nil;
if (![[GANTracker sharedTracker] trackEvent:@""
action:@""
label:@""
value:0
withError:&error]) {
NSLog(@"Error tracking foreground event: %@", error);
}
// TODO(fmela): make this time period a constant.
if (![[GANTracker sharedTracker] dispatchSynchronous:2.0]) {
NSLog(@"Synchronous dispatch on background failed!");
}
[[GANTracker sharedTracker] stopTracker];
}
self.state = EasyTrackerStateBackground;
}
This might help: Updating Google Session Tracking
It talks about web, but specifically mentions a 30 minute rule.
It says if the user has an event with in 30
mins it will treat it as the same session. So all it means is if the user came back within 30
minutes of using your app.
https://developers.google.com/analytics/devguides/collection/ios/v2/sessions