How do I integrate a Google Analytics tracking code into Divi?

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

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

  1. The 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 a Google Analytics tracking code
  5. Where to embed the tracking code in Divi
  6. 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.

Inscription Google Analytics
  1. Click on "Get started for free".
  2. You will be redirected to sign in to your "Google Account". If you don't have one, you can create one at this stage.
  3. Click on "Register".

4 - Get your Google Analytics tracking code

Obtenir le code de suivi Google Analytics
  1. Choose "Web Site
  2. Give your account a name
  3. Give your site a name. For example "My site".
  4. Enter the URL of your site, don't forget 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 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 || [];
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 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.

  1. Make sure all buttons are enabled
  2. The first window corresponds to the HEAD section of your site
  3. 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!

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

762 words

3

You should like it too:

Utilisez les couleurs globales de Divi pour plus de productivité !

Use Divi's global colours for more productivity!

🚀 Do you create your clients' websites with WordPress and Divi and are looking for productivity?
🥳 Perfect, I explain how to use Divi's global colours to avoid wasting time with multiple actions when you want to change a colour on your entire site...

9 Commentaires

  1. GARCIA

    Merci, c’est très clair !

  2. Lycia Diaz

    Merci à toi Maité 😉

  3. Patrick Lecouffe

    Bonjour,
    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é !

  6. Isabelle BLOSSE

    Merci pour cet article !

  7. Pat

    Salut Lycia.
    Article toujours très intéressant comme toujours!
    Mais désormais on n’a plus la partie Code de suivi dans Analytics, plus de gtag.js…
    MErci !

  8. Lycia Diaz

    Salut Pat ! Oui en effet je vais mettre l’article à jour

  9. Pat

    Pas de soucis merci pour tes tutos toujours précieux !

Soumettre un commentaire

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

Je souhaite recevoir les news du blog Astuces Divi !

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

Shares
Share This