Explore the blog:

[Updated 2024 Guide] How To Set Up GA4 Google Analytics For Your WordPress Website

Share on:

Updated March 10, 2024

Note: This post may contain affiliate links; we may earn a commission (at no additional cost to you) if you make a purchase via our links. See our disclosure for more info.

Are you wondering how to set up Google Analytics on your WordPress website? I know it can feel a little intimidating and confusing as there are a number of steps you need to take in order to get the Google Analytics tracking code set up the right way.

Fortunately, I’m going to guide you step-by-step through the entire process! I’ll show you:

  1. How to set up a Google Analytics 4 (GA4) property and Universal Analytics (UA) property and connect them together.
  2. How to insert the tracking code/ script into your website’s head tag. I’ll also show you how to test it to make sure it’s working properly.
  3. How to create a filter to exclude your IP Address so that your activity on the website won’t inflate and/or skew any of the data!

What is Google Analytics & Why Do You Need It?

Google Analytics is a free web analytics tool that provides you with valuable statistics and insights to track and analyze your visitors’ behavior so you can identify what users are doing on your website and make informed, data-driven decisions about your future marketing efforts.

This tool is insanely powerful! For instance, you can track a ton of data in Google Analytics reports that show…

  • The number of people who have visited your site in a specific period of time
  • How many of those users visited your website for first time or are returning visitors
  • Your audience interests and demographics (like age, gender, and location)
  • How your visitors discovered your website – whether they found you on a specific search engine, Facebook, Instagram, Pinterest, YouTube, or even another referring website
  • The pages or blog posts on your website that are the most visited
  • The bounce rate and time someone stays on a specific page on your website
  • Which devices your visitors use the most
  • The number of leads, conversion rates, newsletter signups, and more when you set up goals.
  • And so much more!

Data like this will help you become a strategic marketer and make smart decisions that can lead to more engaged visitors, higher conversions, and, ultimately more customers and sales.

In the next section, I’ll show you how to get your Google Analytics properties set up and installed on your website.

Go Deeper With Google Analytics

If you want to go deeper and learn more about how to utilize Google Analytics for your business… I highly recommend checking out Pavel Brecik’s The Ultimate Google Analytics Course on Skillshare.

The best part is you can start learning for free! You can sign up for Skillshare here and get a free 1-month trial! Beyond Pavel’s course, you can also access thousands of other bite-sized classes on your own schedule, anytime, anywhere on a desktop, or through their mobile app!

How to set up Google Analytics 4 (GA4) property 

To get started, go to Google Analytics: https://analytics.google.com

Gmail Account Login Required

If you are not logged in, you’ll be required to log in with a Gmail account and which will sign you up for Google Analytics.

If you don’t already have a professional email address that matches your business name and domain, this is a good opportunity to sign up for a Google Workspace account that way your business email is connected to your Google Analytics account.

I personally use Google Workspace for my email and also love all of the productivity tools you get for such an affordable price! If you’ve chosen another provider like Microsoft Office365 or are using the mail that came with your hosting provider you can use another Google account instead.

If you are not prompted to log in, you’re most likely already signed in. Just make sure that you’re logged into the correct Gmail account that you want to have associated with your analytics. I would hate for you to be logged into the wrong account and have to delete it and start over on the correct one.

There are two different scenarios I want to guide you through. Scenario #1 is for those of you who have never created a Google Analytics account. If you are setting up a brand new account, follow this tutorial. Scenario #2 is for people that have an old Universal Analytics account and need to convert their old data to the new GA4 property.

Scenario #1 – New Google Analytics Accounts

If you’ve never set up a Google Analytics account before, you’ll see a “Welcome to Google Analytics” screen after you log in. Click the blue start measuring button. This will take you to the setup wizard.

Step 1 – Account Creation

In step 1 of the setup wizard, you’ll begin the account creation process.

  • Enter your account name. If you manage just one website, you can put the brand name of that site. If, however, you’re managing multiple websites, you may want to put your company name.
  • Choose your account data-sharing settings that you’re comfortable with. I like to have all of these checked.
  • Click next.

Step 2 – Property Creation

In step 2 of the setup wizard, you’ll move on to the property creation process.

A property is a website, blog, or mobile app that’s associated with a unique tracking ID.

Keep in mind that a Google Analytics account can contain one or more properties. If you have one website, the setup is pretty simple. Please know that you can also associate one property ID with two websites and data for both websites will appear in the same property in your Analytics account.

  • Enter your property name. If you manage just one website, you can put the brand name of that site. If, however, you’re managing multiple websites, you may want to put your company or organization name. Refer to this graphic for an example of the account structure.
  • Adjust the reporting time zone. Set your country and time zone.
  • Update your currency if needed.
  • Show advanced options – if you click this option, it will allow you to create a universal property (UA) which is the old version of Google Analytics. As of July 1, 2023, UA properties stopped processing data so this is unnecessary.
  • Click next.

Step 3 – Business Details

In step 3 of the setup wizard, you’ll move on to adding your business details.

  • Select your industry category from the dropdown. If you don’t see an option that fits your business, find one that closely relates.
  • Choose your business size from the radio button choices.
  • Click next.

Step 4 – Business Objectives

Next, you’ll fill out your business objectives.

  • Simply check all that apply. This will help makes your reports more relevant to your business.
  • Once you make your selections, click the blue Create Button
  • A Terms of Service agreements pop-up screen will appear. Check off the two I accept checkboxes.
  • Click I accept.

Step 5 – Data Collection

In the last and final step in the setup wizard, you’ll need to choose how you want to start collecting data.

  • Under “Choose a platform”, select “Web”.
  • The “set up data stream” screen will slide-out from the right side of your screen. Enter your website URL.
  • Enter your stream name.
  • Click the create stream button.
  • A new window will appear, showing your web stream details.
  • Click the view tagging instructions button (if it doesn’t automatically pull the screen up for you.)
  • On the “Installation instructions” pop-up, click the “Install manually” tab.
  • Click to copy the code
  • Skip down to the section where we add this code to your website to continue the tutorial.

Scenario #2 – Migrating from Universal Analytics (UA) to Google Analytics 4 (GA4)

If you have a Google Analytics account, but it was set up on the old Universal Analytics (UA) Google Analytics account, we need to get you onto the GA4 platform. Keep in mind in July 2023 Universal Analytics stopped reporting. If you didn’t set up GA4, Google likely created a GA4 property for you, but you still need to configure everything. I’ll show you how to get everything set up.

Step 1 – Access the GA4 Setup Assistant

  • Click “admin” from the sidebar in the bottom left-hand corner of your screen.
  • Click on GA4 Setup Assistant in the second column labeled “Property”.
  • When the GA4 Property Setup Assistant pulls up, you’ll either see a tag that says “not connected” or “connected”.
If GA4 is Not Connected
  • Under “I want to create a new Google Analytics 4 property”, click the “Get started” button.
  • A pop-up will notify you that the setup assistant will create a GA4 property. Choose if you want to enable data collection using existing .js and gtag.js tags. I recommend clicking this checkbox so you don’t have to go through the process of adding a new tag to your website.
  • Click Create and Continue.
  • Click the Go to your GA4 property.
If GA4 is Connected
  • Click the “Go to your GA4 property” button.

Step 2 – Getting your Google Analytics tag from the web stream details screen

  • On the next screen, under the Start data collection heading, you’ll see “Collect website and app data” select the arrow next to the words “Not Started”
  • A dropdown will appear. Select “manage data streams”.
  • Click on your property and jump down to the next section to continue.
  • Click the view tagging instructions button (if it doesn’t automatically pull the screen up for you.)
  • On the “Installation instructions” pop-up, click the “Install manually” tab.

How To Manually Insert the GA4 Tracking Code Into Your Website’s Head Tag 

There are a number of ways you can install Google Analytics on your WordPress website. For instance, you can add your Google Analytics tracking ID to the Monster Insights Plugin, Site Kit plugin, or WooCommerce plugin. However, I prefer to insert the tag into my website’s header manually; I’ll show you how to do that next.

First, you need to log in to your WordPress dashboard.

If you’re using the Kadence theme (which is my #1 theme recommendation) and have upgraded to Kadence Pro, you can easily paste these scripts into your site’s header, right after opening the body tag. I’ll show you how to do that.

If you do not have the Pro version of Kadence, you can also insert this script into your site by installing a free third-party plugin. I’ll also show you that option as well.

Insert Your Google Analytics Tracking Code With Kadence Pro

  • First, make sure to have purchased a Kadence Bundle, installed the Kadence Pro plugin, and entered your license details.
  • Then go to Appearance > Kadence and enable Header/Footer Scripts.
  • Click on the “Customize” hyperlink to be taken to the Custom Scripts section in the WordPress Customizer. You can also go to Appearance > Customize > Custom Scripts.
  • Simply paste the tracking code and hit publish. (You should already have the installation code copied to your computer’s clipboard from a previous step.)

Add Google Analytics Tracking Code Using A Free Insert Headers/ Footers Plugin

If you do not have the Pro version of Kadence, you can install the plugin “Insert Headers and Footers by WPBeginner”.

  • Go to Plugins > Add New
  • In the search bar, type insert headers and hit enter
  • On the plugin, Insert Headers and Footers by WPBeginner, click Install now, and Activate.
  • On the left-hand side, hover over settings and click on Insert Headers and footers
  • Paste your scripts and hit save!

Once you’ve completed this step, this will apply the tracking code to every page of your website!

Alternatively, you can also use the Code Snippets plugin as well.

How to verify your Google Analytics Account Is Working Properly

Next, let’s make sure that the tracking code you just added to your WordPress website is functioning.

  • Close out of your website in all browsers.
  • Open an incognito window in your browser and visit your website.
  • Interact with your website by scrolling down and clicking on new pages so the tag manager can track your event based movements.
  • Go back to https://analytics.google.com/ on the Google Analytics dashboard (or the GA4 home screen).
  • On the right side of the screen, under “Users in the last 30 minutes,” you should see 1 user.
  • If you don’t see a user in real time show up, clear your website and browser’s cache. If it still doesn’t show any active users, wait a few minutes and try again. If no users appear after a few minutes, you need to double-check the steps to ensure you set it up correctly.
  • Click the View realtime hyperlink and you’ll even be able to see your location.

That’s it! You’ve successfully added Google Analytics to your WordPress website. You can now track your website visitors and begin making informed, data-based decisions about your blog or business.

Share on:
About the Author

Katy Boykin is a WordPress website designer, marketing strategist and CEO of DIY Dream Site. She and her team have helped hundreds of business owners launch scroll-stopping websites, rank on the first page of Google for targeted keywords, grow engaged email lists on autopilot, create digital products that sell like hotcakes, and book dream clients! Want to create these same results? Shop now or hire us.