How to Add Google Analytics to Divi
Tracking what happens on your website is one of the most important things you can do to grow your business, and Google Analytics is the tool for the job. Connecting it is the first step to understanding who your visitors are, where they come from, and what content they love. This guide will walk you through two simple and effective methods for adding Google Analytics to your Divi theme, so you can start making data-backed decisions.
Why You Need Google Analytics on Your Divi Site
Before jumping into the "how," it’s helpful to understand the "why." You’ve spent time and effort building a beautiful site with Divi, but without data, you’re flying blind. Connecting Google Analytics helps you answer critical questions like:
- Who is visiting your site? See demographic data like age, gender, and geographic location to better understand your audience.
- How did they find you? Discover whether visitors are coming from Google searches (organic), social media, email campaigns, or other referral sources.
- What pages are most popular? Learn which pages and posts get the most traffic, helping you identify what content resonates with your audience.
- Are your marketing efforts working? Track the performance of specific marketing campaigns to see what drives traffic and conversions.
- What actions are visitors taking? Monitor goals like contact form submissions, email signups, and e-commerce purchases to measure success.
In short, Google Analytics turns gut feelings into hard data, helping you optimize everything from your Divi page layouts to your overall content strategy.
First Step: Finding Your Google Analytics 4 Tracking Code
No matter which method you choose, you first need to grab your tracking code from Google Analytics. We’ll be using Google Analytics 4, which is the current standard.
Your GA4 property uses a "Measurement ID" which looks like G-XXXXXXXXXX and a full script called the "Global Site Tag" (gtag.js). You'll typically need the entire script for a manual installation.
Here’s how to find it:
- Log into your Google Analytics account.
- Click the Admin gear icon in the bottom-left corner.
- Make sure you have the correct Account and Property selected in the first two columns.
- In the Property column, click on Data Streams.
- Select your website's data stream (it will usually be named after your domain).
- Under the Google tag section, click on View tag instructions.
- A popup will appear. Click the Install manually tab. Here you will see your Global Site Tag. It looks like this:
<pre><code><,!-- Google tag (gtag.js) -->, <,script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX">,<,/script>, <,script>, window.dataLayer = window.dataLayer || [], function gtag(){dataLayer.push(arguments),} gtag('js', new Date()), gtag('config', 'G-XXXXXXXXXX'), <,/script>,</code></pre>
This entire chunk of code is what you need. Click the copy icon in the top right to copy it to your clipboard. Now you’re ready to add it to Divi.
Method 1: Using Divi's Built-In Theme Options
For most users, this is the quickest and easiest way to install your Google Analytics code directly within Divi itself, without needing any extra plugins.
Step 1: Go to Your WordPress Dashboard and Navigate to Divi
Log in to your WordPress admin panel. On the left-hand menu, find and click on Divi.
Step 2: Open the Divi Theme Options
From the dropdown menu under Divi, select Theme Options. This will take you to the main Divi settings panel.
Step 3: Click the Integration Tab
Look for the tabs at the top of the Theme Options panel (General, Navigation, Builder, etc.). Click on the Integration tab.
Step 4: Paste Your Google Analytics Code
Inside the Integration tab, you'll see several boxes for adding code to different parts of your site. Scroll down to the field labeled “Add code to the <,head>, of your blog”.
Paste the complete Global Site Tag (gtag.js) script you copied from your Google Analytics account into this box. Make sure 'Enable header code' is turned on (it should be green).
Step 5: Save Changes
Don't forget this last step! Scroll down and click the big green "Save Changes" button. That’s it! The Google Analytics tracking code is now active across your entire Divi website.
Pros and Cons of This Method
- Pros: Insanely simple, no plugins required, and keeps your site lean. It’s a clean and direct solution included with your theme.
- Cons: The tracking code is tied directly to the Divi theme. If you ever decide to switch themes in the future, you'll need to remember to migrate this code to your new theme or a plugin, otherwise you will lose tracking.
Method 2: Using a Plugin (Recommended for Flexibility)
Using a plugin is a more robust and future-proof method. The code is managed by the plugin, so it remains active even if you change themes. The recommended plugin for this is Site Kit by Google, as it's official, free, and incredibly easy to set up.
Step 1: Install and Activate Site Kit by Google
From your WordPress dashboard, go to Plugins > Add New. In the search bar on the top right, type "Site Kit by Google" and press Enter. The official plugin should be the first result. Click Install Now, and once it's done, click Activate.
Step 2: Begin the Setup Process
Once activated, you'll see a prompt at the top of your dashboard to start the setup. Click the blue "Start Setup" button.
Step 3: Connect and Verify Your Google Account
Site Kit will now guide you through connecting your Google account. You'll need to sign into the same Google account you use for Google Analytics.
It will ask for a few permissions. The first step is to verify you're the owner of the site by connecting to Google Search Console. This is a huge benefit in itself! Just click through and allow permissions as prompted. Once verified, Site Kit will declare it’s a success.
Step 4: Connect Google Analytics
After verifying ownership, Site Kit will prompt you to connect to other services. Click the "Next" button, and on the next screen you'll see a card for Google Analytics. Click "Connect Service."
Again, you'll need to select your Google account. Site Kit will then automatically find your existing Google Analytics accounts. Simply select the right Account, Property, and Data Stream from the dropdown lists. They should be auto-filled if you only have one.
Click "Configure Analytics" and you're done! Site Kit will automatically add the GA4 tracking code to your website. No copying or pasting required.
Pros and Cons of This Method
- Pros: Tracks data independently of your theme, making future theme changes seamless. Site Kit provides you with easy-to-read Analytics and Search Console data directly within your WordPress dashboard.
- Cons: Adds another plugin to your site which technically adds a bit of overhead, although Site Kit is very well-optimized.
How to Check If Google Analytics is Working
After you’ve implemented either method, it's wise to double-check that everything is working. The easiest way to do this is with the Real-Time report.
- First, if you have a caching plugin (like WP Rocket or W3 Total Cache), clear your site cache.
- Open your website in a new Incognito or private browser window. This ensures you're counted as a new visitor.
- Go back to your Google Analytics account. In the left navigation, go to Reports > Realtime.
- You should see at least one user active on your site - that’s you! You can also click around to different pages and watch your activity appear in the report.
If you see your visit appear in the Real-Time report, congratulations! You have successfully added Google Analytics to your Divi site.
Final Thoughts
Properly setting up website analytics is a non-negotiable step for any serious website owner, and both the Divi Theme Options and a dedicated plugin like Site Kit provide excellent ways to get it done. By following this guide, you've equipped your site to collect the crucial data you need to understand performance and fuel your growth.
Once you start collecting data, the new challenge becomes making sense of it all. Instead of getting lost inside the dozens of complex reports in Google Analytics, you can simplify the process entirely. We built Graphed to connect directly to platforms like Google Analytics, allowing you to create dashboards and get insights just by asking questions in plain English. For example, simply ask, "Show me a line chart of my website traffic from the last 90 days, broken down by channel" and we'll build it for you instantly on a live dashboard.
Related Articles
How to Connect Facebook to Google Data Studio: The Complete Guide for 2026
Connecting Facebook Ads to Google Data Studio (now called Looker Studio) has become essential for digital marketers who want to create comprehensive, visually appealing reports that go beyond the basic analytics provided by Facebook's native Ads Manager. If you're struggling with fragmented reporting across multiple platforms or spending too much time manually exporting data, this guide will show you exactly how to streamline your Facebook advertising analytics.
Appsflyer vs Mixpanel: Complete 2026 Comparison Guide
The difference between AppsFlyer and Mixpanel isn't just about features—it's about understanding two fundamentally different approaches to data that can make or break your growth strategy. One tracks how users find you, the other reveals what they do once they arrive. Most companies need insights from both worlds, but knowing where to start can save you months of implementation headaches and thousands in wasted budget.
DashThis vs AgencyAnalytics: The Ultimate Comparison Guide for Marketing Agencies
When it comes to choosing the right marketing reporting platform, agencies often find themselves torn between two industry leaders: DashThis and AgencyAnalytics. Both platforms promise to streamline reporting, save time, and impress clients with stunning visualizations. But which one truly delivers on these promises?