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

Update a third-parties docs, GoogleTagManager example #63448

Merged
merged 2 commits into from
Mar 19, 2024
Merged

Update a third-parties docs, GoogleTagManager example #63448

merged 2 commits into from
Mar 19, 2024

Conversation

LuiGeeDev
Copy link
Contributor

@LuiGeeDev LuiGeeDev commented Mar 19, 2024

What?

If I follow the example in docs then use GTM, it doesn't work when I send an event in page when mounted using useEffect. It logs a warning: @next/third-parties: GTM dataLayer dataLayer does not exist

Why?

window.dataLayer does not exist when children is rendered, because children runs faster than GoogleTagManager component. It works in dev mode, but doesn't work when built, so it can be easily missed.

How?

It works fine when the order is changed. As you see in example, GoogleTagManager should come first, higher than children.

Makes GoogleTagManager comes before children
@LuiGeeDev LuiGeeDev requested review from a team as code owners March 19, 2024 02:41
@LuiGeeDev LuiGeeDev requested review from manovotny and leerob and removed request for a team March 19, 2024 02:41
Copy link
Member

@samcx samcx left a comment

Choose a reason for hiding this comment

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

Thank you for submitting a :pr:!

:lgtm:

@ijjk
Copy link
Member

ijjk commented Mar 19, 2024

Allow CI Workflow Run

  • approve CI run for commit: d72c250

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

@samcx samcx enabled auto-merge (squash) March 19, 2024 21:41
@samcx samcx merged commit 2bb65ca into vercel:canary Mar 19, 2024
29 checks passed
@LuiGeeDev LuiGeeDev deleted the patch-2 branch March 20, 2024 01:13
@github-actions github-actions bot added the locked label Apr 3, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants