Google Analytics allows you to track your website traffic. It is a free service provided by Google. By creating an account and connecting it to your website, you can begin to analyze traffic data. However, in order to track this data, you need to insert a Google Analytics tracking code into your website...
Good news, the Divi theme allows you to do this easily and quickly without installing any additional plugin. Let's see how to do it...
- The usefulness of Google Analytics
- Why do you need to integrate a tracking code inside your site?
- Create a Google Analytics account
- Get a Google Analytics tracking code
- Where to embed the tracking code in Divi
- Check that the tracking code works
Announcement: this article contains affiliate links that you will easily recognize. The classic links are in purple and sponsored links are in pink.
Getting started with Divi, discover all the articles to start with peace of mind!
1 - The usefulness of Google Analytics
Connecting your website to Google Analytics is not an obligation. However, Google provides us with a great tool that allows us to track the ROI (return on investment) of our site.
Why not? It would be a shame!
The analysis of the figures and statistics are rich in information. You will know which pages are the most visited, how many pages are visited by the same user, how much time is spent on the site and more!
Google Analytics data is very complete and will allow you to better consider your future marketing actions.
2 - Why do you need to integrate a tracking code inside your site?
The reason is quite simple, for a question of security, Google wants to make sure that you are the owner of the site whose data you want to track.
To prove that this is the case, you must have access to the administration part of your site.
By inserting this code, Google will be able to read it. This validates your property and allows Google to start recording visits.
Fortunately, Google verifies that you are the owner of the site, otherwise, anyone could follow the statistics of any site!
3 - Create a Google Analytics account
If you don't have a Google Analytics account yet, you can quickly create one at At the following address.
- Click on "Get started for free".
- You will be redirected to sign in to your "Google Account". If you don't have one, you can create one at this stage.
- Click on "Register".
4 - Get your Google Analytics tracking code
- Choose "Web Site
- Give your account a name
- Give your site a name. For example "My site".
- Enter the URL of your site, don't forget to choose the option http:// or https://
- Define the sectoral theme of your site among the proposals,
- Choose the time zone according to the country
- Click on "Get a Tracking ID
- Accept the terms and conditions of use.
You will then be directed to the page dedicated to your property.
All you have to do is copy the Google Analytics tracking code in the dedicated field. Be careful to copy the whole code without forgetting anything.
The Google Analytics tracking code looks like the one below:
< ! -- Global site tag (gtag.js) - Google Analytics -- >
< script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXXX-X »>< / script >
< script >
window.dataLayer = window.dataLayer || ;
gtag('js', new Date());
< / script >
Did you know that you can test Divi for free? Go to this page and click on "TRY IT FOR FREE
5 - Where to integrate the tracking code in Divi
Once you have copied the code from the previous step, go to your site's administration, to the : Divi > Theme options > Integration
Read this article to understand all the settings in the Divi Integration tab.
- Make sure all buttons are enabled
- The first window corresponds to the HEAD section of your site
- The second window is the BODY section
It is in one of the two fields that you can paste your Google Analytics tracking code. Google recommends pasting it in the HEAD section (pad 2), while Divi suggests pasting it in the BODY section (pad 3). Both work: choose one of them. Remember to save your changes before leaving.
6 - Check that the tracking code works
To be sure that the Google Analytics tracking code has been taken into account, I advise you to browse your site as a normal internet user would and to look at the numbers in your Google Analytics account. You should see real time views: yours (at least).
Need more resources on Divi? Visit the ElegantThemes blog which is full of ideas and tutorials!