How Do I Add Google Analytics (GA4) to My Wordpress Site?

If you need help adding GA4 to your WP site, here's how.

Adding Google Analytics 4 (GA4) to your WordPress site is a great way to track your visitors and understand how they interact with your content. Don’t worry—it’s easier than it sounds! Here’s a friendly step-by-step guide to get you started. You can also check out this helpful guide from WPBeginner for more details.


Step 1: Set Up GA4 in Google Analytics

  1. Sign Up or Log In to Google Analytics:
    Head over to Google Analytics and log in with your Google account. If you’re new, you’ll need to create an account.

  2. Create a New GA4 Property:

    • In the Analytics dashboard, click the Admin gear icon at the bottom left.
    • Under the Property column, click Create Property and fill in your website’s name, time zone, and currency.
    • Select Web as your platform.
  3. Set Up Your Data Stream:

    • Enter your website’s URL and name the data stream.
    • You’ll get a Measurement ID (looks like G-XXXXXXXXXX)—keep this handy for the next step.

Step 2: Add GA4 to WordPress

There are a few ways to connect GA4 to your site. Choose the method that works best for you:


Option A: Use a Plugin

If you like simple, plugins are your friend!

  • Install a Google Analytics Plugin:
    Use a plugin like MonsterInsights. Go to your WordPress dashboard, click Plugins > Add New, search for MonsterInsights, and install it.
  • Connect Google Analytics:
    Follow the plugin’s setup wizard to log in to your Google account and select your GA4 property. The plugin takes care of the rest!

Option B: Manually Add GA4 Code

This method requires copying and pasting some code.

  • Get the GA4 Global Site Tag:
    In your GA4 account, go to Admin > Data Streams, click your data stream, and find the Global Site Tag (gtag.js). Copy the code.
  • Paste it into WordPress:
    • In your WordPress dashboard, go to Appearance > Theme Editor.
    • Open the header.php file and paste the code just before the closing </head> tag.
    • Be careful when editing theme files—back up your site if needed!

Option C: Use Google Tag Manager (GTM)

If you’re already using Google Tag Manager, this is a great option.

  • Set Up GTM:
    Sign up at Google Tag Manager and create a container for your site.
  • Add GTM to WordPress:
    Use a plugin like WPCode to add the GTM container code to your site’s header and body.
  • Configure GA4 in GTM:
    In GTM, create a new tag, select Google Analytics: GA4 Configuration, and add your Measurement ID. Set the trigger to All Pages to track everything.

Step 3: Verify Your Setup

  1. Test Your GA4 Integration:
    Use the Google Analytics Debugger Chrome extension to ensure data is being sent correctly.
  2. Check Real-Time Reports:
    In your GA4 dashboard, go to Realtime and see if your visits are being tracked.

By following these steps, you’ll have GA4 set up on your WordPress site in no time. Remember, this is just a quick overview—if you want more in-depth instructions, check out this guide from WPBeginner. Happy tracking!