How to Setup Google Analytics 4 for WordPress

Looking to get Google Analytics 4 setup for your WordPress site? You’ve come to the right place!

As always, here’s a quick TL;DR version first:

  1. Setup Google Analytics 4 account
  2. Install WPCode Lite Plugin on WordPress
  3. Implement GA4 tracking code
  4. Test and confirm data collection

Setup Google Analytics 4 account

Use your Google Account to setup a Google Analytics 4 account and web property for your WordPress website. Simply follow setups 1 & 2 of this GA4 setup guide to get your GA4 account, property and web data stream ready to go.

Install WPCode Lite plugin on WordPress

WPCode is a plugin that allows you to add code snippets to the header and/or footer of your webpages without modifying PHP templates.

WPCode WordPress Plugin

Once you’ve installed the plug-in you can easily implement your Google Analytics 4 tracking code without any programming or coding skills.

Create data stream & implement the GA4 tracking code

From the admin menu click Data Streams and then click on the web data stream you made earlier. Once you’re viewing the web stream details screen look at the bottom to find the View tag instructions link.

Copy and paste your tracking code from the Google Analytics 4 installation instructions page into the Header section of WPCode tab in WordPress and click save changes. Now you should be ready for testing!

Test and confirm data collection

Once you’ve copied the Google tag from GA4 into WPCode and saved the changes you can go back to Google Analytics for testing. Below the tracking code on the installation instructions page is the option to test your website. Simply click the test button and wait for a green check to appear next to your website domain.

Test Your Website in Google Analytics 4

It’s also recommended to check the realtime report to ensure data is being collected. But it’s worth noting that it may take 24-48 hours for data to begin showing up in the realtime report.

Using Google Tag Manager (GTM)?

Are you using Google Tag Manager (GTM) to implement your Google Analytics 4 (GA4) tag? No problem, I do too and the steps are virtually the same! Simply setup your Google tag in GTM and copy the GTM code into the header and body sections of WPCode. Once the tracking code is implemented you can test using GTM’s debugger, GA4 or both!

Want to view GA4 from your WordPress dashboard?

If you want to view your Google Analytics 4 in the WordPress dashboard you should definitely check out the Monster Insights plugin. There’s two version of the Monster Insights plugin, lite and paid (or premium). The lite version provides a lot of great features. But there’s three major reasons I don’t personally use Monster Insights:

  1. I prefer to use Google Tag Manager (GTM) for all my analytics tags
  2. Some features that are available in GA4 aren’t in Monster Insights without a paid subscription e.g., the Realtime report
  3. Some users (i.e., on Reddit and other forums) have reported performance issues
Scroll to Top