How to integrate a Google Analytics tracking code into Divi?

Updated on 19/06/24

797 words

3 minutes of reading

This article contains affiliate links recognizable by the percentage icon (%) → I am an affiliate link

Google Analytics allows you to monitor your site traffic closely. It is a free service made available by Google. By creating an account and connecting it to your website, you can start to analyze traffic data thoroughly. Only, here, to follow these data, you must insert a Google Analytics tracking code into your site...

Good news, the theme Divi allows you to do this easily and quickly without installing additional plugins. Let's see how...

  1. Usefulness of Google Analytics
  2. Why do you need to integrate a tracking code inside your site?
  3. Create a Google Analytics account
  4. Get Google Analytics tracking code
  5. Where to integrate the tracking code in Divi
  6. Check that the tracking code works

To start with Divi, discover all the articles to start calmly!

1 – Usefulness of Google Analytics

Connect your website to Google Analytics is not an obligation. However, Google provides us with a great tool that allows us to track ROI (return on investment) on our site.

What do you want to lose it for? That would be a shame!

The analysis of figures and statistics is rich in information. You will know which pages are most visited, how many pages are visited by the same internet user, what is the time spent on the site and more!

Google Analytics data is very comprehensive 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 simple, for a security issue, Google wants to make sure that you are the owner of the site you want to track the data from.

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 checks 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 do it quickly at Next address.

Google Analytics registration
  1. Click "Start Free".
  2. You will be redirected to connect to your Google Account. If you don't have one, you can create it during this step.
  3. Click "Register"

4 – Get your Google Analytics tracking code

Get Google Analytics tracking code
  1. Choose « Websiten»
  2. Give your account a name
  3. Give your site a namen. For example "My site".
  4. Enter the URL address of your site, not forgetting to choose the option http:// or https://
  5. Define the sectoral theme of your site among the proposals,n
  6. Choose the time zone according to the country
  7. Click "Get a tracking ID"
  8. Accept the general conditions of use.

You will then be directed to the page dedicated to your property.

You'll only have to copy Google Analytics tracking code present in the dedicated field. Be careful to copy the entire code without forgetting anything.

Google Analytics tracking code looks like the following:

< ! -- Global site tag (gtag.js) - Google Analytics -- >
< script async src=" »>< / script >
< script >
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-XXXXXXXX-X’);
< / script >

Do you know you can test Divi for free? See you on this page and click on "TRY IT FOR FREE"

5 - Where to integrate the tracking code in Divi

Once you have copied the code obtained in the previous step, go to the administration of your site, tab: Divi > Theme option > Integration

Read this article to understand all the settings in the "Integration" tab of Divi.

  1. Check that all buttons are enabled
  2. The first window corresponds to the HEAD section of your site
  3. The second window corresponds to the section BODY

It is in one of the two fields that you can paste your Google Analytics tracking code. Google advises to stick it in the HEAD section (pastille 2), while Divi proposes to paste it in the BODY section (pastille 3). Both work: choose one of the two. Remember to save your changes before you leave.

6 - Check that the tracking code works

To make sure that Google Analytics tracking code has been taken into account, I advise you to browse your site as an Internet user lambda would and to view in parallel the numbers of your Google Analytics account. You should see real-time views: yours (at least).

Need more resources on Divi? Visit ElegantThemes blog full of ideas and tutos!

where to insert Google Analytics tracking code
where to insert Google Analytics code in Divi

Get Divi

Divi training

Ebook Divi PDF

Free tips

Divi Quiz

Live coaching

icon 256x256
Discover my wpLingua plugin, which makes your websites multilingual in just a few clicks! SEO-Friendly / Automatic / Editable


  2. Lycia Diaz
  3. Patrick Lecouffe
  4. Lycia Diaz
  5. Deb
  6. Isabelle BLOSSE
  7. Pat
  8. Lycia Diaz
  9. Pat
  10. Quartero
  11. Lycia Diaz
  12. Tara Quartero
  13. Hugues
  14. Lycia Diaz

Submit a comment

Your email address will not be published. Required fields are indicated with *

This site uses Akismet to reduce undesirables. Learn more about how your feedback data is used.