First, we’ll set up our GA4 property!
Log into your Google Analytics account or create one if needed.
In the left sidebar, at the very bottom, click on Admin, then Create Property.
Choose a property name (I went for Kind Blogger – GA4) and fill out the reporting time zone and currency fields according to your situation.
Under advanced options, there’s no need to also set up a UA property, so leave this unchecked. Universal analytics will be sunsetted on July 1, 2023.
In the next step, enter your business information, then choose Web as your Data Stream platform.
Keep the default settings and click create stream.
That’s it — GA4 is set up, and you should see a window with your web stream details.
Keep this browser tab open; we’ll need it for later.
Set up Google Tag Manager
If you already have a GTM account, you can skip this step. Otherwise, here are the steps to create one.
Head over to Google Tag Manager and enter your Google details.
Add a new Tag Manager account and choose an account name that best represents your Website (I chose Kind Blogger).
Use your domain name for the container name and select Web as the target platform.
After you’ve agreed to Google’s terms, you should be greeted with some code to install GTM on your website.
Embed the GTM code on your website
We’re using the WordPress theme GeneratePress, which makes it super easy to install that code.
In your WordPress dashboard, head to Appearance » Elements.
Add a new Element and choose Hook. Give the Element a name such as GTM (Head), and paste the GTM code that’s supposed to go in the <head> section into the field.
Choose Settings » Hook » wp_head as well as Display Rules » Location » Entire Site and hit Publish.
Next, create a new Element and name it GTM (Body) or something along those lines.
Same procedure here: Paste your GTM body code and choose Settings » Hook » wp_body_open as well as Display Rules » Location » Entire Site.
Another easy option to insert the code is to use the plugin Head, Footer and Post Injections.
Set up GA4 in Google Tag Manager
Head to GTM and select the account you want to set up GA4 for.
Go to Tags » New and name the tag (e.g. GA4 config.)
In the next step, select Google Analytics: GA4 Configuration in the Tag Configuration field and enter your Measurement ID (head back to your GA4 browser tab and grab it from there.)
Leave all other settings on default and select Triggering » All Pages.
Click Save, then Preview.
If you have an ad blocker running in your browser, it’s time to disable it at this point, otherwise debugging might not work.
GTM is trying to connect to your site, and you will hopefully get a message that it has successfully done so.
Browse your site a bit, then head back to GTM and see if those clicks got tracked.
Debugging GA4
Lastly, we want to make sure that those clicks were also picked up in your GA4 dashboard.
In GA4, go to Admin » Debug View and see if your page views appear here as events. You might want to click on some of the events and see if page_location corresponds with the pages you just browsed.
When all things are looking good, it’s time to head back to GTM » Tags and hit Submit.
Google prompts you to enter a version name, so simply enter something like GA4 installed, and you’re good to go.