How to install your Google Analytics 4 tracking code – and check it works! [2024]
I may get paid commission for purchases made after clicking a link in this post.
Have you set up a new Google Analytics 4 property and are now wondering how to install the Google Analytics 4 tracking code? This tutorial is for you! I show you where to find your GA4 tracking code, how to put your GA4 tracking code onto your website and how to check it’s working.
How to find your Google Analytics 4 tracking code
To find your Google Analytics tracking code, first click on the gear icon in the bottom left hand corner to access ADMIN.
Under the PROPERTY column, check the correct website property is showing. (Use the drop down menu next to the property name if not.) Then, select DATA STREAMS.
Click on the name of your website, and you should see a screen like this.
Scroll down and click on VIEW TAG INSTRUCTIONS. And you should see a screen like this.
If you have either the MonsterInsights or SiteKit plugin, you can click on these options and you will get detailed instructions on how to install your Google Tag using via the plugin.
If you prefer to install your tracking code manually, select the INSTALL MANUALLY option and copy the tracking code.
How to add your Google Analytics 4 tracking code to your site
There are basically 3 ways of adding your Google Analytics 4 tracking code to your WordPress blog: you can add it directly into your code (don’t do this unless you know what you are doing!), you can use a plugin, or you can use your theme settings.
Let’s look at each of these in turn…
1. Using your theme settings
Many themes will have a place where you can put your Google Analytics tracking code. Check your theme documentation to see if this is possible for you. If it is, it’s by far the easiest way. (If you are not sure ask your theme developer or ask in your theme’s support group.)
If you decide to go for this option, simply select the INSTALL MANUALLY option and copy the tracking code. Then, paste the tracking code wherever your theme documentation tells you to. (You may also need to click SAVE, depending on your theme.)
2. Placing your tracking code directly into your code
DO NOT DO THIS UNLESS YOU KNOW WHAT YOU ARE DOING! If you do something wrong here, you can crash your entire site. If you decide to use this method, proceed with caution and make sure you do a backup of your site first.
If you decide to go for this option, simply select the INSTALL MANUALLY option and copy the tracking code.
Then, log in to your WordPress dashboard and navigate to APPEARANCE => EDITOR. Now click the header.php file on the right-hand side below the TEMPLATES section. Paste in the tracking code you copied from your Google Analytics account just before the closing </head> tag. Then click UPDATE FILE.
3. Using a plugin
If you are not confident in placing code into your theme files and you do not have the option to add the code via your theme settings, then the best way for you to place your Google Analytics tracking code onto your website is using a plugin.
There are many plugins that you can use to do this, but one that seems particularly good is the Monster Insights plugin. You can find details on how to do this on the Monster Insights website => How to connect Monster Insights to Google Analytics.
I have not used this plugin myself as I was able to use my theme settings, so I cannot personally recommend it, but from a quick bit of research into this type of plugin, this one seemed the best to me – there is both a free version and a premium version.
Please note, it’s really important that you only have the Google Analytics 4 tracking code added to your website ONCE per property. If you place the tracking code for the same property more than once on your website, you will get very bizarre and inaccurate statistics. So, before you use one of these methods, it’s important to check whether the tracking code for your Google Analytics 4 property has already been added to your website. If it is, you don’t need to do it again!
How to check your Google Analytics 4 tracking code is working
Your tracking code should now be set up correctly and Google Analytics should be collecting data. However, it can take up to 48 hours for the data to start flowing.
To check if everything is working correctly, go to analytics.google.com and ensure the correct website property is selected from the dropdown menu in the top left. (You only need to worry about this if you have more than one website property – for example an old Universal Analytics property or a Google Analytics 4 property for a different website.)
Next, go to REPORTS >>> REAL TIME in the menu on the left. If the tracking code is correctly installed, you will be able to see visitors to your website in real time.
Congratulations
Congratulations on setting up a Google Analytics 4 property for your website! Now it’s time to discover how to actually use Google Analytics 4 in my Beginner’s Guide to Google Analytics 4.
- How to set up Google Analytics 4 from scratch (step by step with screenshots)
- How to set up Google Analytics 4 (if you already have a Google Analytics account)
- Beginner’s Guide to Google Analytics 4
Don’t miss a thing!
Follow me on Twitter, Facebook and Instagram. Or why not subscribe to Productive Blogging and get blogging and productivity tips straight to your inbox every week?
Thanks
You’re welcome!