Hello!
I’m developing a Flutter app and I’m trying to do some pretty simple use case of tracking screen views and counting time spent by user on those pages using custom reports with a dimension - “Time on page”.
I use a trackScreen method whenever a user opens some page. I also have an ability to disable tracking at any time, at which point I use the optOut method. I also differentiate between authenticated and unauthenticated user. If the user is logged in I send his userId using setUserId as well as tracking a custom dimension for that purpose. If the user is logged out I set their userId as ‘N/A’ instead. I use dispatch method after all of the above mentioned calls to make sure they are sent immediately.
A scenario I am testing is the following:
- Enter the Test page as an authenticated user and stay there for 1 minute
- Disable tracking and wait on the page for 30 seconds
- Log out, go back to the page and wait 90 seconds
While the screens are tracked correctly and separately for the authenticated and unauthenticated user the times on page are wildly off. I get 1 minute and 54 seconds for the authenticated user and 0s for the logged out user.
It’s especially concerning, because I can’t find any possible reason why that would be the time tracked. If the optOut method didn’t stop the tracking then the time shouldn’t be more than 1 min 30s. If the unauthenticated user time was added to the authenticated user’s time it should be at least 2min 30s. I can’t make any sense of it.
I’d appreciate any help and suggestions.