How to Add Google Analytics to Your Netlify Website or Web App

By: Ativ Patel || 10/14/2020


Install google analytics on netlify instructions with arrows



To get started, make sure you have set up your property in Google Analytics and have the code copied to your clipboard or have it handy. To get the Google Analytics code into Netlify, we will be using the snippet feature in the Netlify dashboard. The snippet feature in Netlify is a great user experience because it will allow you to add Google Analytics and other javascript code snippets before closing your </head> or </body> tag in ALL of your html files in a few simple steps.

 

Here are the steps to follow to get Google Analytics (a javascript snippet) into all of your html files on Netlify:

 

  1. Open Netlify dashboard
  2. Click on your website URL/project
  3. In the header, go to “Site Settings”
  4. On the left navigation, click “Build and Deploy”
  5. Scroll the page down to the section titled “Snippet injection”
  6. Now click, “Add Snippet”
  7. Change the top dropdown menu to “Insert before </head>
  8. Enter in a Script name that you can reference later - I use “Google Analytics” to keep it explicit for reference later if I need to
  9. In the HTML section, simply paste your Google Analytics Script
  10. Click Save
  11. El Fin - You’re all set! 🥳

 

If you want to learn more, check out Netlify docs on Snippet Injection: https://docs.netlify.com/site-deploys/post-processing/snippet-injection/



Install google analytics on netlify meme showing thumbs up




📧 Get an email alert when a new blog post is released 📧




-------------------

Bored?

Discover live streams accross the intenet 👇

Avatar