Setting up GA4 on WordPress without the headaches
Learn the best ways to install Google Analytics 4 on WordPress using plugins like Site Kit, GTM Kit, or Google Tag Manager. Step-by-step instructions included.
WordPress makes GA4 setup relatively , if you choose the right method. There are several ways to do it, and the best choice depends on how much control you need.
Let me walk you through your options.
Choose your installation method
| Method | Best for | Complexity |
|---|---|---|
| Site Kit by Google | Beginners, simple sites | Easy |
| GTM Kit plugin | WooCommerce, e-commerce | Medium |
| Google Tag Manager | Full control, complex tracking | Advanced |
| Manual code | Developers, specific needs | Advanced |
If you're not sure, start with Site Kit. You can always move to GTM later.
Method 1: Site Kit by Google (easiest)
Site Kit is Google's official WordPress plugin. It integrates Analytics, Search Console, AdSense, and more in one dashboard.
Step-by-step
-
Install the plugin
- Go to Plugins → Add New
- Search for "Site Kit by Google"
- Click Install Now, then Activate
-
Connect your Google account
- After activation, you'll see a setup wizard
- Click Sign in with Google
- Grant the requested permissions
-
Connect Google Analytics
- Site Kit will prompt you to connect Analytics
- If you have an existing GA4 property, select it
- If not, Site Kit can create one for you
-
Verify it's working
- Wait a few minutes
- Go to Site Kit → Dashboard
- You should see analytics data starting to appear
What you get with Site Kit
- Analytics right in your WordPress dashboard
- Automatic pageview tracking
- Search Console integration
- No coding required
Limitations
- Limited custom event tracking
- Not ideal for complex setups
- Less flexibility than GTM
Method 2: GTM Kit plugin (recommended for WooCommerce)
GTM Kit is purpose-built for Google Tag Manager and GA4. It's especially powerful if you're running WooCommerce.
Step-by-step
-
Install GTM Kit
- Go to Plugins → Add New
- Search for "GTM Kit"
- Click Install Now, then Activate
-
Get your GTM container ID
- Go to tagmanager.google.com
- Your container ID looks like
GTM-XXXXXXX - If you don't have a container, create one first
-
Configure GTM Kit
- Go to Settings → GTM Kit
- Enter your container ID
- Enable options based on your needs:
- WooCommerce integration (if applicable)
- Contact Form 7 tracking
- Data layer features
-
Set up GA4 in GTM
- In GTM, create a Google Tag with your Measurement ID
- Set trigger to Initialization - All Pages
- Publish your container
WooCommerce e-commerce tracking
GTM Kit automatically pushes WooCommerce data to the dataLayer:
| Event | What it tracks |
|---|---|
view_item | Product page views |
add_to_cart | Add to cart actions |
remove_from_cart | Cart removals |
begin_checkout | Checkout starts |
purchase | Completed purchases |
You just need to set up corresponding GA4 Event tags in GTM to send this data.
Method 3: Google Tag Manager (manual)
For full control, install GTM directly without a plugin.
Step-by-step
-
Create GTM container (if you haven't)
- Go to tagmanager.google.com
- Create a new container for your site
-
Get the installation code
- Click on your container
- Copy both code snippets (head and body)
-
Add to your theme
Option A: Edit theme files (not recommended for updates)
- Add the
<head>snippet toheader.php - Add the
<body>snippet right after<body>tag
Option B: Use a code snippets plugin
- Install "Code Snippets" or similar plugin
- Add the head code to run in
<head> - Add the body code to run in
<body>
Option C: Use your theme's settings
- Many themes have "header scripts" and "body scripts" sections
- Paste the code in the appropriate fields
- Add the
-
Set up GA4 in GTM
- Create Google Tag with your Measurement ID
- Set trigger to Initialization - All Pages
- Add any custom event tags you need
- Publish
Why use GTM directly?
- Maximum flexibility
- No plugin dependencies
- Works with any theme
- Full event tracking control
But requires more technical knowledge.
Method 4: Manual gtag.js installation
If you don't want GTM and don't want a plugin, you can add GA4 code directly.
Step-by-step
-
Get your GA4 tracking code
- Go to GA4 → Admin → Data Streams
- Click your web stream
- Click View tag instructions
- Copy the gtag.js code
-
Add to your site
<!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXX"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-XXXXXXX'); </script> -
Insert into WordPress
- Use a code snippets plugin
- Or add to your theme's header via customizer
- Or edit
header.php(not recommended)
When to use this method
- Simple sites with basic tracking needs
- When you need to avoid GTM for some reason
- Quick testing setups
Verifying your installation
Whichever method you use, verify it works:
Quick check: Realtime reports
- Go to GA4 → Reports → Realtime
- Open your WordPress site in another tab
- You should see yourself as an active user
Thorough check: DebugView
- Install the GA Debugger extension
- Go to GA4 → Admin → DebugView
- Navigate your site
- Watch for
page_viewand other events
For more testing methods, see our GA4 testing guide.
Plugin comparison
| Feature | Site Kit | GTM Kit | Manual GTM |
|---|---|---|---|
| Setup difficulty | Easy | Medium | Advanced |
| WooCommerce e-commerce | Limited | Full | Full |
| Custom events | Limited | Via GTM | Full |
| Dashboard in WP | ✅ | ❌ | ❌ |
| Flexibility | Low | Medium | High |
| Updates/maintenance | Google-managed | Plugin updates | Manual |
Common mistakes
Installing multiple tracking methods
Pick one. Don't use Site Kit AND GTM Kit AND manual code. You'll get duplicate data.
Forgetting to exclude internal traffic
Set up internal traffic filters in GA4 after installation:
- Go to Admin → Data Streams → [Your Stream] → Configure tag settings
- Define internal traffic with your IP
- Enable the filter in Data Settings
Not testing before launch
Always verify tracking works in DebugView or Realtime before assuming it's done.
Using outdated plugins
Check that your chosen plugin supports GA4 (not just Universal Analytics). Many older plugins don't.
Next steps
Once GA4 is installed on WordPress:
If you want an easier way to see your WordPress analytics, try Analayer. We connect to your GA4 data and give you insights that actually make sense.
See your analytics clearly
Stop struggling with Google Analytics. Connect your account and get a cleaner, simpler view of your data in seconds.