The Google Analytics 4 Script For Blogs

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-xxxxxxxxx"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'G-xxxxxxxxx');
</script>

In this short video, I explain how to add Google Analytics to your website without using Google Tag Manager. I start by explaining why I prefer not to use Tag Manager for my niche websites and how it can be a bit over the top to have an extra tool in there when you can just go directly.

To get started, I click on “New Account,” select “Web,” and create a stream. This gives me the measurement ID that I otherwise would use in Google Tag Manager. To add this measurement ID to my website, I simply need the basic code, which I share in the description of the video.

Then, I log into my WordPress backend and go to the theme file editor. I look for the header_php file and insert the script code in the head tag. Finally, I click “Update File,” and I’m good to go.

For those who don’t want to mess with the theme file editor, I suggest using a plugin such as Head Footer and Post Injection. It’s easy to install and use, and I explain how to do so in the video.

In conclusion, adding Google Analytics to your website without using Google Tag Manager is a straightforward process that can be done directly. With the basic code and either the theme file editor or a plugin, you can have your website ready to track data in no time.