Google Analytics 4 (GA4) is the latest generation of Google’s powerful web analytics platform. Designed to be more privacy-centric while offering advanced tracking capabilities, GA4 is increasingly important for anyone managing a website. If you’re using the popular Divi theme in WordPress, adding GA4 might seem a bit daunting at first—especially if you’re new to the game. But don’t worry! This guide will walk you through the process step-by-step, ensuring your website is tracking visitors accurately and efficiently.
What Is GA4 and Why Should You Use It?
Google Analytics 4 is a significant departure from its predecessor, Universal Analytics. Instead of focusing solely on sessions and pageviews, GA4 emphasizes event-based tracking, giving you a more detailed picture of how users interact with your website.
- Enhanced cross-device tracking
- Improved data privacy features (great for GDPR compliance)
- More granular metrics and event tracking
- Future-proofed analytics as Universal Analytics is being phased out
If your goal is to understand visitor behavior and improve site performance, GA4 is not just an option—it’s a necessity.
Overview of the Divi Theme
The Divi theme by Elegant Themes is one of the most versatile and user-friendly WordPress themes on the market. With its drag-and-drop builder and wide range of customization options, Divi enables both beginners and experienced developers to build stunning websites. However, its unique page structure sometimes throws beginners off when they try to integrate external tools like GA4.
This guide assumes you already have a Google Analytics 4 property set up in your Google Analytics account. If you haven’t done that yet, we recommend visiting the Google Analytics portal to create your account and get your Measurement ID.
Step-by-Step Guide to Adding GA4 to Divi
Step 1: Get Your GA4 Measurement ID
Before integrating anything with Divi, you need your unique GA4 Measurement ID. Here’s how to get it:
- Go to analytics.google.com
- Select your newly created GA4 property or create a new one
- Navigate to Admin > Data Streams
- Click on your web data stream
- Copy the Measurement ID that starts with
G-XXXXXXX
Step 2: Insert the GA4 Tracking Code in Divi
There are a couple of simple ways to add the GA4 tracking code to your Divi site. Let’s go over the most straightforward one—using the Theme Options panel.
Using Divi Theme Options
- Log in to your WordPress Dashboard
- Navigate to Divi > Theme Options
- Click on the Integration tab
- Find the box labeled: “Add code to the <head> of your blog”
- Paste in the GA4 tracking script
Your GA4 global site tag (gtag.js) should look like this:
<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>
Replace G-XXXXXXX
with your own Measurement ID.

Click “Save Changes”
Once you save your changes, the GA4 tag is now active on your website. Congratulations! You’ve successfully integrated GA4 with Divi.
Alternative Method: Using a Plugin
If you’re uncomfortable editing theme options or plan to switch themes later, using a plugin may be a better option. Plugins ensure that your GA4 tracking remains consistent regardless of theme changes.
Recommended Plugins
- GA Google Analytics by Jeff Starr
- Site Kit by Google: Official plugin from Google
- MonsterInsights: Feature-rich and user-friendly, but requires a premium version for advanced tracking
After installing a plugin, simply paste in your Measurement ID in the plugin settings, and it will handle the rest for you.
Testing Your GA4 Installation
After adding the tracking code, you’ll want to confirm that your site is actually sending data to Google Analytics. You can easily check this inside the GA4 dashboard:
- Go to your GA4 property
- Click on “Realtime” in the left-hand navigation
- Open your website in a separate browser tab
- After a few seconds, you should see your visit registered under Realtime
Still not seeing data? Common issues include:
- Incorrect Measurement ID
- Code placed in the wrong section
- Website caching interfering with script execution
Consider using browser extensions like Google Tag Assistant or GA Debugger to troubleshoot your setup.

Tips for Maximizing Your GA4 Data
Now that GA4 is tracking your Divi site, here are some tips to get even more out of your analytics:
- Set up conversion tracking: Identify key actions (form fills, purchases, etc.)
- Enable enhanced measurement features: Track scrolls, outbound clicks, video views, and more
- Link your GA4 account with Google Ads: Enable better reporting and remarketing
- Use custom events: Track specific interactions, like banner clicks or PDF downloads
Maintenance and Future Updates
Google Analytics 4 is still evolving. Keeping your plugin updated, routinely checking your tracking code, and monitoring your data is essential. If you ever redesign your site or switch to a child theme, double-check that your GA4 tracking code is still in place.
Bookmark crucial tools like Google Tag Manager and the GA4 dashboard. These resources are invaluable for troubleshooting and advanced tracking implementations in the future.
Conclusion
Adding GA4 to a Divi-powered WordPress site might feel intimidating at first, but with the right guide—and a little patience—it becomes a straightforward task. Whether you use built-in theme options or opt for a plugin, the most important thing is to get started. Tracking user behavior is crucial for optimizing your website’s performance, improving user experience, and making informed business decisions.
By following the steps in this guide, you’ve taken a critical step toward understanding your audience better and enhancing your site’s capabilities. Happy analyzing!