Divi makes it super simple to setup Google Analytics on your website. There’s no need to install a plugin, child theme, configure an API integration, or play around with code in theme files.
In this article, we’ll learn how to fully setup Google Analytics on a Divi theme website, in minutes!
Let’s get started:
Table of Contents
Tutorial: Setting up Google Analytics on a Divi Website, Step by Step
If you have a Global Site Tag (gtag.js) and just need to add the tracking code to Divi, skip to Step 5.
Step 1: Login or Create a Google Account
To start, Login or Create a New Google Account.
You’ll need a free Google Account to use Google Analytics. This can be an existing account.
Step 2: Create a Google Analytics Account
Go to the Google Analytics Homepage and select the ‘Start measuring’ button. Google Analytics will now ask for an ‘Account name.’ If you’re going to manage client sites, I suggest setting this as your company name. If not, Google uses the example: ‘My Personal Account.’ Enter your desired ‘Account name’ and select ‘Next.’
Step 3: Create a Google Analytics Property for Your Website
Google Analytics will ask: ‘What do you want to measure?’
Select ‘Web (Measure your website)’ and then click ‘Next.’
We’re now on ‘Property setup’. In our case, the Property is simply your Divi website. Let’s fill in these fields:
- Website Name – This can be the actual company name or blog name. I prefer using the website hostname for this field. For example, https://www.example.com. (This makes things simpler if you add a subdomain or subfolder later on.)
- http / https– As appropriate.
- Website URL – Repeat the website hostname here excluding http / https.
- Industry Category – As appropriate.
- Reporting Time Zone – As appropriate.
Once your Property fields are filled in, select ‘Create.’
A Google Analytics Terms of Service Agreement will now pop-up. Choose your country/region from the drop-down menu, tick all check boxes, and select ‘I Accept.’
Step 4: Get Your Global Site Tag Tracking Code
You’ll now be presented with the Tracking Code page.
We only need to focus on the Global Site Tag (gtag.js) section.
The Global Site Tag is a snippet of tracking code that will be used to link your Divi website to Google Analytics.
Copy the entire Global Site Tag code snippet:
Step 5: Add Your Global Site Tag to Your Divi Website
With the tracking code now copied, we can finally switch over to your Divi website. Keep Google Analytics open as we’ll need to go back soon.
Go to your WordPress Dashboard and select Divi from the sidebar:
The Divi Theme Options page will open. From the Divi Theme Options header tabs, select ‘Integration.’
Paste your copied code snippet into the head block. This is the first code block on the page and has the caption ‘Add code to the < head > of your blog.’
Then, hit the ‘Save Changes’ button at the top. If you have a page speed plugin, clear the sitewide cache at this point for good measure.
And that’s it! We’ve just added Google Analytics to our Divi theme website.
Step 6: Verify that Google Analytics is Working
But is our Divi and Google Analytics setup actually working?
Let’s check:
Go back to the Tracking Code page that we left off on Google Analytics. If Google Analytics was closed, go to: Admin > Tracking Info > Tracking Code.
Under the ‘Status’ heading, hit the ‘Send test traffic’ button.
Google will now send test traffic to your website. This may take up to 30 seconds to reflect on the Google Analytics dashboard.
FAQ on Divi and Google Analytics
Q. Will Google Analytics continue to work after WordPress, Divi, and plugin updates?
A. Yes. If the Global Site Tag is added via Divi > Theme Options > Integrations, updating WordPress, Divi, and plugins will not remove the tracking code. Therefore, Google Analytics will continue to work as normal.
Q. Will changing the WordPress theme remove the tracking code?
A. Yes. If you uninstall Divi and install another theme, the tracking code will be removed. This means that Google Analytics can no longer track and report on your site. This also applies to the Extra Theme by Elegant Themes.
Q. Will changing the Divi child theme remove the tracking code?
A. No. If you change the child theme used on your Divi website, the tracking code will not be removed. Therefore, Google Analytics will continue to work as normal.
Q. Does this enable Google Analytics Event Tracking for a Divi website?
A. No. This tutorial does not setup Google Analytics Event Tracking features for a Divi website, such as button click tracking, email clicks, contact form submissions, etc. I hope to write on Divi and Event Tracking in a seperate post.
Q. Should I use both Divi and a plugin simultaneously for the tracking code?
A. No. Although it is possible to run multiple analytics on a single website, doing so simultaneously will cause duplicate data in Google Analytics. The stats for site visitors, number of views, etc. will be inflated. Remove all Google Analytics tracking codes and tracking IDs from plugins and theme files before adding it via Divi. Check if your website already has Google Analytics installed if you’re unsure.
Q. Why should I add the tracking code via Divi, and not use a plugin?
A. Every plugin has its own effect to overall page speed and website security. More plugins means there’s more work for the webserver and more for your site visitors to download. Thus slowing down your website and curbing SEO. Plugin updates may have compatibility issues or break your Analytics tracking entirely.
Adding your tracking code via the Divi Theme Options gets in on your site somewhat directy. Because you’re already using Divi itself, there’s nothing else involved or to worry about.
Admittedly, plugins like MonsterInsights and Analytify are specfically lightweight. However, it’s still something I avoid because of how easy it is, as above, to get setup with Google Analytics on a Divi website.
You may also be interested in:
How to Add Meta Descriptions in Divi with an Easy, No Plugin Method
thank you for this guide.
You welcome.