googleanalytics / autotrack

Automatic and enhanced Google Analytics tracking for common user interactions on the web.
Other
4.93k stars 563 forks source link

Fix extra long pageVisibilityTracker visible time reporting #177

Closed philipwalton closed 7 years ago

philipwalton commented 7 years ago

Version 2.1.0 introduced a subtle bug where, if a user loaded a page and then left before the visibility threshold was met, if they returned to the site at a later date, the visibility time reported was the time since the initial visit.

This PR adds more accurate session expiry checking to ensure the reported visible times are within the current session only.

Note: If this bug is affecting the data in your reports, the best way to get around it is to create a segment that excludes any sessions containing visible metrics (per hit) longer than one day (or the session timeout amount, whichever works best).