Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Avoid double-counting pageviews when navigating with loading spinner #23107

Merged
merged 1 commit into from Aug 15, 2023

Conversation

davidtaylorhq
Copy link
Member

104baab fixed double-counted pageviews for the initial page load. Under the default 'loading slider' implementation, that resolved all the known problems.

However, under the 'loading spinner', there is an additional problem. In 'spinner' mode, each navigation within the JS app involves transitioning to an intermediate 'loading' route. Previously, this intermediate state was being treated as a separate page by the app, and so any ajax requests fired during it would be counted as a distinct pageview. One known case of this is the /presence/get request which is made when logged-in users visit a topic.

This commit updates the logic to ignore 'intermediate' transitions, and introduces regression tests for both the 'spinner' and 'slider' modes.

…nner

104baab fixed double-counted pageviews for the initial page load. Under the default 'loading slider' implementation, that resolved all the known problems.

However, under the 'loading spinner', there is an additional problem. In 'spinner' mode, each navigation within the JS app involves transitioning to an intermediate 'loading' route. Previously, this intermediate state was being treated as a separate page by the app, and so any ajax requests fired during it would be counted as a distinct pageview. One known case of this is the `/presence/get` request which is made when logged-in users visit a topic.

This commit updates the logic to ignore 'intermediate' transitions, and introduces regression tests for both the 'spinner' and 'slider' modes.
Comment on lines +73 to +76
// Ignore intermediate transitions (e.g. loading substates)
if (transition.isIntermediate) {
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I should maybe use this in chat at various places 🤔

@davidtaylorhq davidtaylorhq merged commit f3cc294 into main Aug 15, 2023
13 checks passed
@davidtaylorhq davidtaylorhq deleted the page-tracking-spinner branch August 15, 2023 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants