perf: clean up GTM init listeners after first successful initialization#7660
Open
Nsanjayboruds wants to merge 7 commits intolayer5io:masterfrom
Open
perf: clean up GTM init listeners after first successful initialization#7660Nsanjayboruds wants to merge 7 commits intolayer5io:masterfrom
Nsanjayboruds wants to merge 7 commits intolayer5io:masterfrom
Conversation
Signed-off-by: Nsanjayboruds <nishantborude555@gmail.com>
Contributor
|
Preview deployment for PR #7660 removed. This PR preview was automatically pruned because we keep only the 6 most recently updated previews on GitHub Pages to stay within deployment size limits. If needed, push a new commit to this PR to generate a fresh preview. |
Contributor
|
@Nsanjayboruds Thank you for your contribution! Let's discuss this during the website call tomorrow at 5:30 PM IST | 7 AM CST Add it as an agenda item to the meeting minutes, if you would 🙂 |
Contributor
Author
|
Hey @CodexRaunak, could you please review this PR when you get a chance? Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes #7590
This change improves GTM lazy-init behavior in
gatsby-browser.jsby ensuring all interaction listeners are cleaned up immediately after the first successful GTM initialization.What changed
GTM_DELAY_MSconstant for clear delay units.addInitListeners()removeInitListeners()initGTM().window.gtmDidInit) and existingdataLayerpageview push behavior unchanged.Notes for Reviewers
Behavioral outcome:
Validation performed:
npx eslint gatsby-browser.js(passes; only environment-level browserslist update notices)Signed commits