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(plugin): load SSR events before container loaded #51

Merged
merged 2 commits into from
Jul 23, 2020

Conversation

1ed
Copy link
Contributor

@1ed 1ed commented Jul 4, 2020

before:
image

after:
image

This can be useful when migrating from a legacy site and want to add some data from server side before the gtm container loads. I didn't find any other way to do this with the current code and Google also states that the dataLayer vaiable should be defined before the container script https://developers.google.com/tag-manager/devguide#adding-data-layer-variables-to-a-page

@1ed
Copy link
Contributor Author

1ed commented Jul 16, 2020

Could someone have a look at this, please? Does it need more work?

lib/plugin.js Show resolved Hide resolved
lib/plugin.js Show resolved Hide resolved
@pi0 pi0 changed the title Load SSR events before "Container Loaded" fix(plugin): load SSR events before container loaded Jul 23, 2020
@pi0 pi0 merged commit 498f9bd into nuxt-community:master Jul 23, 2020
@1ed 1ed deleted the dataLayer-before-container-loaded branch July 23, 2020 08:24
@1ed
Copy link
Contributor Author

1ed commented Jul 23, 2020

Thank you!

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