How to integrate a Google Analytics tracking code into Divi?

Updated on 14/05/2019 | Published on 11/03/2019 | 5 comments

Google Analytics allows you to closely monitor your site's traffic. It is a free service provided by Google. By creating an account and connecting it to your website, you can start to analyze traffic data in a comprehensive way. However, to track this data, you must insert a Google Analytics tracking code into your site....

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

  1. The usefulness of Google Analytics
  2. Why do you need to integrate a tracking code into your site?
  3. Create a Google Analytics account
  4. Get a Google Analytics tracking code
  5. Where to integrate the tracking code into Divi
  6. Verify that the tracking code is working

Advertisement: This article contains affiliate links that you will easily recognize. The classic links are in purple and sponsored links are in pink.

To get started with Divi, discover all the articles to start serenely!

1 - The usefulness of Google Analytics

Connecting your website to Google Analytics is not a requirement. However, Google provides us with a great tool that allows us to track the ROI (return on investment) of our site.

Why deprive yourself of it? That would be a shame!

The analysis of figures and statistics is 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!

The data from Google Analytics is very complete and will allow you to better plan your future marketing actions.

2 - Why do you need to integrate a tracking code inside your site?

The reason is quite simple, for security reasons, 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 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 created yet, you can do it quickly at the following address.

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

4 - Get your Google Analytics tracking code

Obtenir le code de suivi Google Analytics
  1. Choose "Site Web
  2. Give a name to your account
  3. Give your site
 a name. For example, for example "My site".
  4. Enter the URL address of your site, without forgetting to choose the option http:// or https://
  5. Define the sectoral theme of your site among the proposals,

  6. Choose the time zone according to the country
  7. Click on "Get a tracking ID"
  8. Accept the general 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 sure to copy the entire code without forgetting anything.

The tracking code of Google Analytics looks like the one below:

< ! -- 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 >

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 into Divi

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

Read this article to understand all the settings of 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 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 (tablet 2), while Divi suggests pasting it in the BODY section (tablet 3). Both work: choose one of them. Remember to save your changes before leaving.

6 - Verify that the tracking code is working

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

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

où insérer le code de suivi Google Analytics
où insérer le code Google Analytics dans Divi
adding a google analytics code in Divi

You should like it too:

8 fonctionnalités du Divi Visual Builder que vous devriez utiliser !

8 Divi Visual Builder features you should use!

Are you using all the features offered by the Divi Visual Builder? Some of them are little known and yet so effective! Discover now the 8 Divi options that will save you a lot of time! A great user experience in perspective!

Divi Layout Block : des modules Divi au sein de Gutenberg !

Divi Layout Block: Divi modules within Gutenberg!

Good news! Version 4.1 of Divi allows Divi Builder modules to be inserted into the WordPress Gutenberg editor. Your imagination knows no bounds! Can you imagine how much you can achieve with Divi and WordPress?

5 Commentaires


    Merci, c’est très clair !

  2. Lycia Diaz

    Merci à toi Maité 😉

  3. Patrick Lecouffe

    Je découvre Divi et inévitablement je suis à la recherche de divers trucs et astuces pour mettre en route un nouveau site.
    Curieusement je me retrouve souvent sur « Astuces-Divi »
    Merci pour le boulot.

  4. Lycia Diaz

    Merci Patrick 😉

  5. Deb

    Merci !! super bien rédigé !

Soumettre un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.

Pin It on Pinterest

Share This