Google Analytics for WordPress Websites

This guide will show you how to easily track your website customers and visitors. 

Google Analytics (GA) is a free service that provides valuable insights to help website owners shape a successful strategy for their business. 

It’s important to know what content is driving engagement, where visitors are coming from, and what devices they are using to view the content.

I highly recommend having analytics set up the day you launch your website, even if you’re not going to look at the data right away.

This guide only covers the newer, GA4 technology, and not the older tracking scripts from Google.

Google Analytics Account Setup

The steps in this section should be followed if all you need to track is simple website traffic. 

If you need to track additional entities such as Ads, please refer to the Google Tag Manager section.

  1. Sign into the Google Account you will use to manage your Google Analytics.
  2. Visit Google Analytics website.
  3. Click ‘Start Measuring’.
  4. Enter an account name and click ‘Next’.
  5. Property Name > Enter a property name, using something like your business name and ‘GA4’ appended to it.
  6. Adjust the other ‘Property’ settings as desired and click ‘Next’.
  7. Adjust the other ‘Business Information’ settings as desired and click ‘Create’.
  8. Accept the terms.
  9. Click ‘Save’.
  10. Choose a Platform > Click ‘Web’.
  11. Enter your domain.
  12. Stream Name > Enter a stream name, using something like your business name and ‘GA4 Stream’ appended to it.
  13. Click ‘Create Stream’.
  14. Leave this browser window open as we will reference it shortly.

Integrate Google Analytics with WordPress

I’m going to give you two, easy options here, so there is no fiddling with WordPress theme files.

Perfmatters would be my top recommendation here because it allows you to configure your analytics in more of a more performance-optimized manner.

Hosting Google Analytics locally, as Perfmatters does, can help speed up your site by reducing extra DNS lookups and resolving any “leverage browser caching” issues from their script.

Whatever you decide, be sure you are only using one, not both, of these options.


  1. WordPress Dashboard > Settings > Perfmatters > Analytics.
  2. Enable Local Analytics > Toggle ON.
  3. Tracking ID > Copy your Measurement ID from the ‘Google Analytics Account’ section above and paste it here.
  4. Script Type > gtag.js v4


  1. WordPress Dashboard > SEO > Analytics > Toggle ON.
  2. Enable Google Analytics Tracking > Check the box.
  3. Enter Your Measurement  ID > Copy your Measurement ID from the ‘Google Analytics Account’ section above and paste it here.
  4. Exclude User Roles > Check the boxes for all user roles except Subscribers and Customers, to avoid diluting your statistics.

Verify Tracking

  1. Google Analytics Dashboard > Close the ‘Web Stream Details’ from the ‘Google Analytics Account’ section above.
  2. Click on the ‘Reports’ icon, located in the far left-hand menu.
  3. Click the ‘Realtime’ menu item.
  4. Open a different browser where you are not logged into the website and browse around the website.

At this point, if things are set up correctly, you should see at least one active user on your website.

Analytics-Based Optimization

Let’s say you discover that a large majority of your website visitors are using mobile devices. While you should be optimizing your website for mobile already, learning this information should light a fire under you to ensure your website is delivered quickly, and beautifully over mobile devices.

Check out the Optimize WordPress Websites for Outstanding Performance guide for ways to help with things like faster delivery on mobile devices.

Another example would be if you learn that certain posts/pages are not getting the views that you would have hoped or that people are quickly bouncing out of your content. 

This could mean that the value is just not there for these particular assets and the content either needs to be enhanced or possibly rolled into other existing content.

Implement Google Tag Manager with WordPress

If you would like to track multiple tag entities like Google Analytics and Facebook Pixel, please check out the Google Tag Manager for WordPress Websites guide.

Set Up Google Analytics 4

At this point, you are currently using a Universal Analytics property, and to join the future of Analytics, we need to set up a Google Analytics 4 property.

The Universal Analytics property remains unchanged and will continue to collect data.

  1. While logged into Google Analytics, click on the Admin menu link (bottom left).
  2. Under the Property column, click GA4 Setup Assistant.
  3. Click the ‘Get Started’ button, within the ‘I want to create a new Google Analytics 4 property’ section.
  4. Click on the ‘Create Property’ button.

You should receive a ‘You have successfully connected your properties’ message.

  1. You will now want to jump over to the Google Tag Manager for WordPress Websites guide, to add your GA4 tag.

Grant Team Access

  1. Google Analytics Dashboard > Click on the ‘Admin’ icon (i.e. gear icon), located in the far left-hand menu, at the very bottom.
  2. Account Access Management > Click the ‘+’ icon.
  3. Click ‘Add Users’.
  4. Enter the team member’s email address. (Note: You must use a Google Email account here.).
  5. Choose the desired role for the team member. (Note: You’ll typically want to grant the Editor role here, since you are typically granting access for management/maintenance, of your GA account.).
  6. Click Add.