Question about Google Analytics code insert
See original GitHub issueHello!
Please, tell me. If I want to insert Google Analytics code to my site, then I should use Google Analytics Plugin, or create a custom component?
Why I can’t just insert Google Analytics code to header.js, or footer.js component? This is isn’t work? For example, on simple HTML-sites (Jekyll or Wordpress) I just insert Google Analytics code to before </body>
close tag, and it’s enough.
Sorry for the noob question, I’m still learning Javascript + React…
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Where to Put Google Analytics Tracking Code - Optimize Smart
Standard Google Analytics code should always be placed in the <head> tag of the page. Let's suppose you placed your analytics code at...
Read more >Where is the Google Analytics Code & How to Track Your ...
Sign in to your Google Analytics account. · Click 'Admin.' · Next, click on the 'Tracking info' and from the drop-down menu. Select...
Read more >How to Set Up Google Analytics: A Step-by-Step Guide
Enter in your website's name and click Add. Follow the directions to add the HTML code to your site. Once you're done with...
Read more >Best place to insert the Google Analytics code - Stack Overflow
Show activity on this post. As google says: Paste it into your web page, just before the closing </head> tag. Worth mentioning that...
Read more >How To Insert Google Analytics Code - Question - JoomShaper
I´m using google analytics and google tag manager. In fact of this I have to insert in the head-section of each site addtitional...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The plugin is an abstraction to make working with Google Analytics easier to control from a gatsby-config without having to go deep into other files. But that makes sense why you’d want to have more fine-grained control over it: you could insert it yourself by creating an html.js file: https://www.gatsbyjs.org/docs/custom-html/
Thank you for opening this!
We’re marking this issue as answered and closing it for now but please feel free to comment here if you would like to continue this discussion. We also recommend heading over to our communities if you have questions that are not bug reports or feature requests. We hope we managed to help and thank you for using Gatsby!