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

[with-google-analytics] Should Use next/script component #26507

Closed
matamatanot opened this issue Jun 23, 2021 · 7 comments · Fixed by #29061
Closed

[with-google-analytics] Should Use next/script component #26507

matamatanot opened this issue Jun 23, 2021 · 7 comments · Fixed by #29061
Labels
bug Issue was opened via the bug report template. examples Issue was opened via the examples template.

Comments

@matamatanot
Copy link
Contributor

What example does this report relate to?

with-google-analytics

What version of Next.js are you using?

11

What version of Node.js are you using?

14

What browser are you using?

chrome

What operating system are you using?

mac

How are you deploying your application?

Vercel

Describe the Bug

The Script Component is not used in this example. Google Analytics is used very often and is mentioned in the Script Component documentation. This example should be updated.

Expected Behavior

Use Script Component.

To Reproduce

None.

@matamatanot matamatanot added bug Issue was opened via the bug report template. examples Issue was opened via the examples template. labels Jun 23, 2021
@matamatanot matamatanot changed the title [with-google-analytics] Should User next/script component [with-google-analytics] Should Use next/script component Jun 23, 2021
@morganfeeney
Copy link
Contributor

I was wondering how to go about implementing global scripts for use with GTM. I think the example given in the next.js docs doesn't specifically deal with global cases, I'm assuming the way to go about it is to apply <Script/> tags in _app.js to achieve this.

@igormartimiano
Copy link

I was wondering how to go about implementing global scripts for use with GTM. I think the example given in the next.js docs doesn't specifically deal with global cases, I'm assuming the way to go about it is to apply <Script/> tags in _app.js to achieve this.

Doing the same thing and seems to be working fine, although there really wasn't any up to date docs.

@morganfeeney
Copy link
Contributor

It's almost like we need to create this example, and possibly add a section in the docs with how to do it. @igormartimiano out of curiosity could you share an example of what you did?

@smakosh
Copy link
Contributor

smakosh commented Aug 2, 2021

#27674 👀

@matamatanot
Copy link
Contributor Author

https://github.com/vercel/next.js/tree/canary/examples/with-google-tag-manager

The same is true of with-google-tag-manager.

@morganfeeney
Copy link
Contributor

There was some recent activity around using <Script /> and it causing duplicate tags when navigating between pages, so for the moment I'm sticking to using _document and <script> tags: #27218

@kodiakhq kodiakhq bot closed this as completed in #29061 Sep 13, 2021
kodiakhq bot pushed a commit that referenced this issue Sep 13, 2021
…` component (#29061)

Updates the `with-google-tag-manager` to use Next.js' Script component with strategy set to `afterInteractive`

CC @janicklas-ralph 

Closes: #26507
@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. examples Issue was opened via the examples template.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants