2

We use the v3 Google Analytics iOS SDK. We are currently using google's automatic session management in production. Every screen on the app is tracked. My average session time is 25 minutes. Session time is skewed either very low or very high. 30% of sessions are 0-10 seconds and 60% are 181+ seconds.

Google's documentation says that they count each screen view, even if the user comes back to the same screen after the app is in the background. I verified that is true based on testing in a controlled environment. First I added manual session tracking to the app using this. I opened the app for the first time in a brand new Google Analytics app-id at 12:36pm. Then I put it in the background. Then opened it again and backgrounded it again. After 15 minutes I had a correct session count of 2 and a screen count of two. Then I removed the manual session counting and did two more sessions at 12:55pm. After about 10 minutes, my session count was 3 and my screen count was an accurate 4. The session count with the automatic tracking seemed to be off by one, but on the low side. Given this test, I can't understand what's going on in production.

Logically, each session necessarily requires at least one screen view. So how could the session count be greater than the screen count in production? What I'm seeing is that the session count is about double the screen count. How could this be?

1 Answer 1

1

So it turns out that if you're using background fetch or background location services, thedidFinishLaunchingWithOptions AppDelegate method is called - and the Google Analytics libraries tell you to put the session startup code there. If you gate that code around the UIApplicationState, you can avoid the phantom sessions. (See more here: http://mikethinkingoutloud.com/issues-with-google-analytics-and-ios-7-background-fetch/)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.