This past month I have been busy with a new WordPress theme known as Divi. Whenever you build a new website it’s a great idea to add Google Analytics. Divi makes it super easy to add Google Analytics to your Divi theme.
Here are the simple steps to install Google Analytics tracking code on your WordPress website using a Divi theme.
- Step 1: You need to get the Google Analytic tracking code. (See Setting Up Google Analytics).
Note: If you have already setup Google Analytics for the website, simply log into your Google Analytics account, click on the “Admin” tab and choose your website. Under the Property column there is an option for “Tracking Info”. Select “Tracking Code” and copy the website tracking script that is provided.
Click on the Google Analytics “Admin Menu –> Tracking Info”
Click on the Google Analytics “Admin Menu –> Tracking Info –> Tracking Code”
Copy the Website Tracking ID
- Step 2: Log into your website’s WordPress admin “yourdomain.com/wp-admin”.
- Step 3: Select Divi –> Divi Theme Options (Integration) tab
- Step 4: Paste the copied Google Analytics Tracking Code information into the section that says “Add code to the < body > (good for tracking codes such as google analytics)”
- Step 5: Check that you have setup the Analytics Correctly by clicking on the “Send Test Traffic” button from within Google Analytics.
After you added your Google Analytics to your Divi Theme, I have written another really cool article to make your Divi Blog Pop.
Rather than having the boring Divi out of the box blog, you can create a Divi Magazine Blog Layout.
Divi Magazine Blog Layout
Super, super helpful, Tom! Love all of the great screen shots and arrows. http://www.Erinnewman.com
Thanks Erin,
I am still getting to know the Divi theme, but it seems extremely flexible.
I do wish out of the box, the blog portion was a little more robust. You have to use CSS to really make the blog pop.
Here is an example of a blog I did for my brother’s website using Divi
https://chaunceycrandall.com/blog
Obviously I had to use CSS to get it to look this way, but I feel it’s is more engaging than the current blog structure.
Thanks for that, very helpful. It’s always so simple when you know how – and I didn’t!
Love the screenshots! So helpful
Thanks for this article, it helped me!
Hey Melissa, Ellen and Dominic thanks. The Divi Theme is really a fantastic theme to work with and I am always setting up new sites and always need to add Google Analytics to them. I sort of wrote the article as a reminder for me and to help others of course.
I often find that Google Analytics is often overlooked and many times my clients haven’t set it up or haven’t set it up correctly. The Divi Theme makes it easy to add Google Analytics, which is always welcome.
Hey Tom, great article! I’ve had my Google Analytics account set up for 6 months now but it’s showing an inaccurate count of visitors. I know this because I send a monthly MailChimp newsletter and the clicks to the website tracked in my MailChimp reports don’t show up on my Google Analytics reports. Any idea what the issue might be? Thank you!
Hi Haley,
Thanks for the thumbs up!!
This is what I understand might be happening.
E-mails land in inboxes. Offline or online. And those e-mail messages, actually those e-mail campaigns, as they sit in inboxes, are the sources.
They're HTML pages with links in them. If they're offline, in Outlook or another e-mail client, a click on those links is just as a click on a Word document with an embedded link. I believe the clicks then would be reported as direct traffic because browsers do not detect a referring website, so they attribute the click to "direct".
The way to avoid this situation, whenever you create and send out an e-mail campaign, is not to use links such as yourwebsite.com/landingpage.html, but rather yourwebsite.com/landingpage.html?utm .... and so on.
That's your way of telling Google Analytics that the clicks come from an e-mail campaign. Powered by Mailchimp, in your case.
Google Analytics provides a tool, which build the links for you, so that you don't need to care about the syntax.
(Google Analytics URL Builder in a new window)
https://ga-dev-tools.appspot.com/campaign-url-builder/
In this sample we use:
Website URL= Yourwebsite's URL
Campaign Source = Newsletter Name
Campaign Medium = Email
Campaign Name = Your Email Name (June 2017 Newsletter)
Tagged Link Analytics
The tagged link URI is:
mydomain.tld/Yourwebsite's URL?utm_source=Newsletter Name&utm_medium=Email&utm_campaign=June-2017-Newsletter or something like that.
The link contains your website URL, source, medium and campaign, which allows you to measure how many people have clicked on a link in your newsletter.
You can watch the results of your newsletter in Google Analytics under ACQUISITION --> Campaigns.
Hope this helps
Hi, do you know how to do this for an individual page? ie Thank-You page, so i can track conversions?
Hi Mark,
What you probably want to do is implement Google’s tag manager. Unfortunately I don’t have much experience with Tag manager at the moment. Once implemented it should allow you to track conversions you are looking to track and in your case the Thank-You page.
Rather than me writing up an article, here is one that I think will help get you started.
http://www.lunametrics.com/blog/2016/02/15/what-is-google-tag-manager/
Here is an excellent video that walks through Google Tag Manager.
https://youtu.be/hgIcXHnmS3w
One mistake people sometimes make is they implement Google tag manager and then update their theme potentially wiping out the Tag manager code. A way to avoid this issue is to create a child theme. YES this happened to me once when I was working with a client. I updated their theme and their analytics tracking info, which was in the tag manager got erased. It was an easy fix to reapply the tag manager code, but analytics was down for a few days until I realized what had happened.
I wrote an article on creating a Child Theme for Divi, but realistically you could use the same approach for any WordPress theme with a few minor modifications.
https://hangtenseo.com/how-to-create-a-child-theme-for-divi-2017/
Why is the Divi theme set up for the tracking code to go into the body tag when Google specifically tells you to be sure to add it to the head tag, just before the close of the head?
Hi Katie,
I am not exactly sure, but for whatever reason it seems to work without an issues. If you are in doubt you can always add it to the header section instead.
Thanks. FYI, it wasn’t working in the body tags, so I moved it to the header section, and then stats started rendering again. Yay.
Perfect! Another option you can employ is rather than applying Google Analytic code would be to add Google Tag Manager Code instead and then add the Google Analytic Code to the Tag Manager.
I have started using Google Tag manager as a way to keep everything more organized.
Here is the link to the article
https://hangtenseo.com/adding-google-tag-manger-to-your-divi-theme/
Hi Tom
Thank you for that article. I’ve just managed to get my Google Analytics back on track after reading it. They were down for about a month without my noticing which was a shame because I have just been approaching affiliates and advertisers! (Ooops!) I don’t know why it stopped working (there was a problem following a Divi update about a month ago which might account for it).
I was also concerned that because my site doesn’t have www in front of it the traffic would be halved – so far the numbers more or less reconcile with my Word Press stats. Anyway, thanks again.
Jonathan
Hi Jonathan,
You’re more than welcome. Yeah it can be sort of frustrating when the analytic code get messed up. I have certainly been there and done that. 🙂
I wrote another article on implementing Google Tag manager. I have since switched over to using that method. What Google tag manager allows you to do is add other tracking code snippets without having to make them on the website. Once setup, everything is done in the tag manager interface. Things like adding Facebook pixels, Microsoft tracking and other tracking code.
Here is the link to the article
https://hangtenseo.com/adding-google-tag-manger-to-your-divi-theme
thank you so much!
Why does Divi want the code added to the ‘Body’ when Google stipulates it is to the that the code is added?
Hi Fred,
Not sure, but it seems to work.
Hi Tom,
Great tutorial! I accidentally removed the GA code that I had installed years ago last night and thought “oh no, I remember this being a pain in the behind to do” but with Divi and your tutorial it was easy peasy!
Thanks so much!
Stacey
Hi Stacey,
I have had clients who have removed the Google Analytic code as well. It happens. Glad I could help.
Hi Tom!
I read your article but am still having trouble adding my Analytics tracking ID to my website for some reason! I have the Divi theme also, and tried to follow the steps exactly as you listed them in the article, but for some reason I can’t even find the Divi Theme Options (Integrations) tag. When I log in to the admin page and go the Divi theme it just shows me the option to Customize it, but I don’t see anything like what you show in the screenshots. Do you think I have a different version or something, I have been trying to figure this out and can’t get it!
Hey Sam,
Sorry you are having issues adding the Analytic tracking information to your website.
You should have the latest Divi Version, which at the moment is 3.0.86. To check select Appearance –> Themes and then click on the Divi Theme. It should tell you what version of Divi you are running.
2 things might be going on.
When you highlight the Divi Menu item that shows up on the left of your wordpress sidebar menu, select the Role Editor and make sure they are all enabled. Maybe something is disabled that isn’t allowing you to update it.
Another option could be your user settings. If you are not Administrator you might not have access to those screens.
Thanks for this information.. It’s works..
Hi Mas,
Glad you were able to add the Google analytics to your website.
Hi Tom.
That was too easy. Great demo and clear instructions.
Thanks, Marsh
Thanks Marshall!
Hello Tom, I use divi theme on my website, and I would like to connect google analytics, so I have inserted analytics code on section of my theme in this way:
google analytics code
Php code is to exclude my visits on website when I am logged on it, but it doesn’t work. Why?
Can divi theme execute php code on section?If not, is there another method?
Hi Giovanni,
Rather than use PHP code to exclude your visits, you can setup a filter in Google Analytics which will do the same thing without any php code needed.
https://hangtenseo.com/stop-google-analytics-from-tracking-my-visits-2018/
Great article! It was really helpful. Loved the screen shots with the arrows. =)
very helpful article.it’s working.
Thanks i was really getting tensed as i didn’t knew where to the tracking code and i was a bit hesitant to put it into the header as i was scared to mess up the coding of the theme.
Actually your blog is right information share with me. You share the screen shorts are very helpful for me. You explain is very well. I am happy with your blog. Thanks a lot for this beauty Enjoying article with me. I appreciate it very much!
Great article. I’ve used it a couple of times!
thank you tom.
Hi. I wish to add a tracking code to an individual page (or set of pages within a website). How can I do this with divi? My reasons are that within my site I have four different language versions – english is the main section and the tracking code for that is currently attributed globally to the site. However I have different tracking codes for the French, German and Spanish sections – all of which are subsidiary to the
main .com site. I look forward to your reply. Thank you!
I am glad to find it. I found this much useful information. Great info.
Beautiful! Thank you
Thank you for making this nice and clear
Thanks, super helpful article!
I wonder will it be the same result compare to analytics plugin?
I am planning to take off my plugin and set directly in DIVI as you show above.
Thank you so much! This really helped =)
Very helpful – thank you!
Great article. Easy to use.
I just finished listening to to a Podcast called Divi Chat (great talks!) and they made it clear to NOT enter the tracking code to the , but to the . Apparently this was how it was supposed to be done in the past, but now if you do it using the you could get incorrect feedback. By adding it to the you keep any issues from happening. If you are interested in listening to the conversation it is Episode 108 “Google Analytics Basics”. I highly recommend you take a listen. Cheers
Hi there, thanks for this great and clear post! I followed all the steps to the test, but somehow it doesn’t seem to work. When I check users (1 hour later) it still says 0. What may have I done wrong? 🙂
Cheers
ALex
Thank you so much for this post!! About a month ago I substituted the normal Divi theme by the Extra theme (also by Elegant Themes). In the process I lost the tracking code and didn’t even realize it! Thanks again. 😉
This totally helped me!!!
This really helped me. Thank you so much
Thanks Author, exactly got it what I need, some minor changes now due to divi update, but easy to find it using what you’ve written.
Have a great day.
Yes google analytics is very much important for pages which are newly made and with the article you really have made us understand the detail view of it