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 ga.tsxUpdate ga.tsx to support standalone usage of sendGAEvent #70804

Open
wants to merge 1 commit into
base: canary
Choose a base branch
from

Conversation

LorenzoGalassi
Copy link

The current implementation prevents the sendGAEvent function from being used if Google Tag Manager is imported with a custom script and not with the GoogleAnalytics function, this is because the currDataLayerName variable is initialized to undefined and initialized to “dataLayer” (or a string passed in as prop) only in the GoogleAnalytics function and, in the sendGAEvent function, it is checked to see if that value is undefined and, if so, a warning is triggered. By using the sendGAEvent function standalone, it is impossible for the currDataLayerName variable to be initialized and so the warning always starts, preventing its use.

The current implementation prevents the sendGAEvent function from being used if Google Tag Manager is imported with a custom script and not with the GoogleAnalytics function, this is because the currDataLayerName variable is initialized to undefined and initialized to “dataLayer” (or a string passed in as prop) only in the GoogleAnalytics function and, in the sendGAEvent function, it is checked to see if that value is undefined and, if so, a warning is triggered. By using the sendGAEvent function standalone, it is impossible for the currDataLayerName variable to be initialized and so the warning always starts, preventing its use.
@ijjk
Copy link
Member

ijjk commented Oct 4, 2024

Allow CI Workflow Run

  • approve CI run for commit: 7711dde

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

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

Successfully merging this pull request may close these issues.

2 participants