这是indexloc提供的服务,不要输入任何密码
Skip to content

🐛 [Story analytics] Fix prerender analytics not firing #37975

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

Merged
merged 27 commits into from
Mar 31, 2022

Conversation

mszylkowski
Copy link
Contributor

@mszylkowski mszylkowski commented Mar 29, 2022

Fixes #37971

The story fires events like story-content-loaded and story-page-visible even in prerender mode because the active page loads and is seen. However, the analytics config doesn't get loaded until the page changes the visibilityState, which can happen after 10s or more. Given that 10s after amp-analytics is initialized the buffer of events is cleared, these events get discarded, which we don't want to discard. Ideally these events are kept in the buffer for when the page becomes active, and at that point the events will be sent.

@mszylkowski mszylkowski self-assigned this Mar 29, 2022
@mszylkowski mszylkowski requested a review from calebcordry March 29, 2022 17:07
@mszylkowski mszylkowski requested a review from gmajoulet March 29, 2022 21:46
@amp-owners-bot
Copy link

amp-owners-bot bot commented Mar 29, 2022

Hey @gmajoulet, @newmuis! These files were changed:

extensions/amp-story/1.0/story-analytics.js
extensions/amp-story/1.0/test/test-amp-story-embedded-component.js
extensions/amp-story/1.0/test/test-amp-story-share.js
extensions/amp-story/1.0/test/test-story-analytics.js

Copy link
Member

@calebcordry calebcordry left a comment

Choose a reason for hiding this comment

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

Can we add a test that tries to send events before visible and checks that triggerAnalyticsEvent is not called?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[AMP-STORY][analytics] StoryPageVisible does not trigger sometimes
4 participants