---
title: How Do I Add Google Analytics (GA4) to My Wordpress Site?
description: If you need help adding GA4 to your WP site, here's how.
---

[Skip to content](https://knowledgebase.diib.com/how-do-i-add-google-analytics-ga4-to-my-wordpress-site#main-content)

English

Show submenu for translations

[![Frame 1707478394.png\]](https://knowledgebase.diib.com/hs-fs/hubfs/Frame%201707478394.png?height=40&name=Frame%201707478394.png)](https://www.diib.com/)

Open main navigation

Close main navigation

- English
  
  Show submenu for translations
- [Go to diib.com](https://www.diib.com/)

[Go to diib.com](https://www.diib.com/)

 Welcome to diib's Knowledge Base!

- There are no suggestions because the search field is empty.

1. [Knowledge Base](https://knowledgebase.diib.com/?hsLang=en)
2. [FAQs and Troubleshooting](https://knowledgebase.diib.com/faqs-and-troubleshooting?hsLang=en)
3. [Google Analytics](https://knowledgebase.diib.com/faqs-and-troubleshooting?hsLang=en#google-analytics)

# 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](https://www.wpbeginner.com/beginners-guide/ultimate-guide-to-ga4-in-wordpress-for-beginners/) 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](https://analytics.google.com/) 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](https://www.monsterinsights.com/). 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](https://tagmanager.google.com/) and create a container for your site.
- **Add GTM to WordPress:**  
  Use a plugin like [WPCode](https://wpcode.com/) 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](https://www.wpbeginner.com/beginners-guide/ultimate-guide-to-ga4-in-wordpress-for-beginners/). Happy tracking!

If you’re a Pro member and need help adding Google Analytics to your site or syncing it with diib, join our Google Analytics diibLive session.

- [Getting Started](https://knowledgebase.diib.com/getting-started?hsLang=en#main-content)

    - [Get Started Here](https://knowledgebase.diib.com/getting-started?hsLang=en#get-started-here)
    - [How to Use diib's Features](https://knowledgebase.diib.com/getting-started?hsLang=en#how-to-use-diibs-features)
    - [Dashboard Widgets](https://knowledgebase.diib.com/getting-started?hsLang=en#dashboard-widgets)
- [Boosts and Services](https://knowledgebase.diib.com/boosts-and-services?hsLang=en#main-content)

    - [LocalBoost](https://knowledgebase.diib.com/boosts-and-services?hsLang=en#localboost)
    - [diib Handshake](https://knowledgebase.diib.com/boosts-and-services?hsLang=en#diib-handshake)
    - [CityBoost](https://knowledgebase.diib.com/boosts-and-services?hsLang=en#cityboost)
- [Billing and Account Management](https://knowledgebase.diib.com/billing-and-account-management?hsLang=en#main-content)

    - [Billing](https://knowledgebase.diib.com/billing-and-account-management?hsLang=en#billing)
    - [Your Account](https://knowledgebase.diib.com/billing-and-account-management?hsLang=en#your-account)
- [FAQs and Troubleshooting](https://knowledgebase.diib.com/faqs-and-troubleshooting?hsLang=en#main-content)

    - [Dashboard](https://knowledgebase.diib.com/faqs-and-troubleshooting?hsLang=en#dashboard)
    - [General SEO](https://knowledgebase.diib.com/faqs-and-troubleshooting?hsLang=en#general-seo)
    - [Website Traffic](https://knowledgebase.diib.com/faqs-and-troubleshooting?hsLang=en#website-traffic)
    - [Google Analytics](https://knowledgebase.diib.com/faqs-and-troubleshooting?hsLang=en#google-analytics)
    - [Website Errors](https://knowledgebase.diib.com/faqs-and-troubleshooting?hsLang=en#website-errors)
    - [Core Vitals](https://knowledgebase.diib.com/faqs-and-troubleshooting?hsLang=en#core-vitals)
    - [Google Business Profile](https://knowledgebase.diib.com/faqs-and-troubleshooting?hsLang=en#google-business-profile)
    - [Sitemap](https://knowledgebase.diib.com/faqs-and-troubleshooting?hsLang=en#sitemap)
    - [Backlinks](https://knowledgebase.diib.com/faqs-and-troubleshooting?hsLang=en#backlinks)
    - [YouTube](https://knowledgebase.diib.com/faqs-and-troubleshooting?hsLang=en#youtube)
    - [Local Businesses & Local SEO](https://knowledgebase.diib.com/faqs-and-troubleshooting?hsLang=en#local-businesses-local-seo)
    - [Keywords](https://knowledgebase.diib.com/faqs-and-troubleshooting?hsLang=en#keywords)
    - [AI](https://knowledgebase.diib.com/faqs-and-troubleshooting?hsLang=en#ai)
    - [Content](https://knowledgebase.diib.com/faqs-and-troubleshooting?hsLang=en#content)
    - [Website Speed](https://knowledgebase.diib.com/faqs-and-troubleshooting?hsLang=en#website-speed)
- [diib Dashboard Widgets](https://knowledgebase.diib.com/diib-dashboard-widgets?hsLang=en)

[![Chill listening crop-3](https://knowledgebase.diib.com/hs-fs/hubfs/logo-Nov-15-2024-07-22-54-5317-PM.png?width=44&height=24&name=logo-Nov-15-2024-07-22-54-5317-PM.png "Chill listening crop-3")](https://diib.com/)

diib.com Knowledge Base

Copyright © 2026, diib.com