In this video, we’ll show you how to add Google Analytics to your WordPress website.
For this, we’ll share three easy options.
These include:
How to add Google Analytics to WordPress using a plugin
How to install Google Analytics in WordPress by adding the code via your WordPress theme,
and; How to install Google Analytics via the header.php
file of your child theme
We’ve created a post that accompanies this video on the ohklyn blog (we’ll add a direct
link in the description below).
From there, you can pick the option that’s best for you and follow along with the step
by step instructions.
You can also check the timestamp in the description below to skip to the method you want to use.
So, let’s get started.
Google Analytics is a freemium website traffic analysis tool by Google that allows you to
monitor your website traffic and gain insights on everything from how users find your website,
to the types of content users find most engaging.
If you’re serious about growing your website traffic, or improving your website engagement,
Google Analytics is a must have tool.
To get the most from your Google Analytics account, you’ll need to understand some
of the core metrics.
On the OHKLYN post, we’ve provided a few definitions that you can review to help get
you up to speed.
Regardless of which method you use to install Google Analytics on your WordPress website,
the first thing we need to do is set up your free Google Analytics account.
First, you need to have a Google (or Gmail) account.
You can then head over to Google Analytics by following the link on the OHKLYN post,
and click the ‘Sign Up For Free’ button in the top right corner.
You will then need to enter some basic information such as a username, your site’s name, your
site’s URL, the industry your site falls under, and timezone.
You can then check or uncheck the boxes that establishes what data you are willing to share
with Google Analytics.
This is generally used to improve the Google Analytics services.
You can read more about it by following the link here.
Click the ‘Get Tracking ID’ button and then accept the Terms of Service.
Congratulations!
You are now in your Google Analytics dashboard.
Remember to copy your Tracking ID in the middle of the screen for future use.
Once you have your WordPress website up and running and you’ve created your Google Analytics
account, you can add Google Analytics to your site.
The first option we’ll explore is how to add Google Analytics to your WordPress website
using a plugin.
This will be the simplest option that anyone will be able to use regardless of which WordPress
theme you’re using.
However, if you’ve followed one of our free WordPress tutorials using either the Divi,
Ultra or Olsen theme, you won’t need to use a plugin as you can add your Google Analytics
code directly to your website via the theme options area, which we’ll cover in the next
section.
To install Google Analytics using a plugin, we’d recommend using either Google Analytics
for WordPress plugin by MonsterInsights, or the Google Analytics Dashboard for WP plugin.
Firstly, we’ll install Google Analytics with the Google Analytics for WordPress plugin
by MonsterInsights If you haven’t done so already, head over
to your WordPress admin dashboard.
In the menu to the left of your screen go to Plugins > Add New.
In the search bar, type in ‘monsterinsights’ and wait for the results to load.
As you will see, the Google Analytics plugin should be among the top results.
Hit the “Install” button, wait for the ‘Installing’ action to finish, then hit
the ‘Activate’ button.
On the next page, you will immediately see a prompt under ‘Plugins’ asking you to
‘Please configure your Google Analytics settings!’
The first thing we need to do is authenticate our Google account.
So, click on the very first button.
A pop-up window will appear to guide you through the process.
Click ‘Next’.
Then click on the box that says ‘Click to get Google Code’.
Another window will pop-up where you have to log into your Google account and allow
the plugin to take certain actions.
You will then be presented with a code that you will need to select and copy.
Paste in the code and click ‘Next’.
In the drop-down on the next page select the ‘All Web Site Data’ Analytics Profile
and click ‘Next’.
The next page should say ‘Done’.
You should now see ‘Profile Active: All Web Site Data…’ above the button.
It’s up to you whether you are comfortable sharing usage data with Google.
Now, click ‘Save Changes’.
You will now see ‘Insights’ along with some other options below it in the admin menu
on the left.
Congratulations!
You have just successfully installed Google Analytics via the MonsterInsights plugin.
Don’t be alarmed if there is no data, the first reports will show after 24 hours of
data collection.
Next, we’ll show you how to install Google Analytics using the Google Analytics Dashboard
for WP plugin.
Just like before, log into your WordPress admin dashboard and go to Plugins > Add New.
Type ‘google analytics dashboard’.
Once again, it should be among the top results once they load.
Click on the ‘Install Now’ button next to the Google Analytics Dashboard for WP plugin,
and then ‘Activate’ once it has finished installing.
There should now be a Google Analytics tab in the admin menu.
Hover over it and click on General Settings.
From here, we will set up the plugin.
Click on the ‘Authorize Plugin’ button.
Just like before, you will now log into your Google account, authorize it with some permissions,
and then be presented with a code that you should copy.
Paste it into the ‘Access Code’ text field and click ‘Save Access Code’.
You will now be back at the general settings page.
In the middle of the screen, it should load all the information you entered when you signed
up for Google Analytics, such as your website name, your Tracking ID, URL, and time zone.
Note: if you have multiple websites, you should select the one you are currently working on
in the drop-down.
Click on ‘Save Changes’ and you’re done!
If you navigate to your dashboard, there should now be a new panel named Google Analytics
Dashboard that shows your most important metrics.
You can collapse, expand or move it around just like your other dashboard panels.
And that’s it.
The next thing we’ll show you is how to add your Google Analytics tracking script
to your WordPress website via your WordPress theme without needing to use a plugin.
Depending on what theme you use, the process might look slightly different.
We will show you how to do this using Divi and Ultra as these are two very popular themes.
We have created free tutorials on how to make a website using these themes that you can
access via our Free WordPress Tutorials page.
First of all: Log into your Google Analytics account.
Make sure that you are currently working with the website that you want to add Google Analytics
tracking to.
In the bottom left of the screen click on ‘Admin’.
A page full of options will open up.
We want the ‘Tracking Info’ option which you will find in the middle of the screen.
Expand it and then click on ‘Tracking Code’.
Now, under the heading ‘Website Tracking’ and ‘Global Site Tag’ (gtag.js) there
will be a text box with some script in it.
Copy the whole piece of script.
Make sure that you copy everything.
Go back to your WordPress Admin Dashboard.
Firstly, let’s look at how to add your Google Analytics tracking code using the Divi theme:
Select the ‘Divi tab in the admin menu, then navigate to the ‘Integration’ tab.
There will be a big text box with the label ‘Add code to the < head > of your blog’.
Paste the tracking code you copied from Google Analytics into this box.
Save changes.
Now, let’s look at how to add your Google Analytics tracking code using the Ultra theme:
Similar to Divi, hover over the ‘Themify Ultra’ tab in the admin menu and select
‘Themify Settings’.
Under the ‘Settings’ tab, click on the ‘General’ sub-tab.
Scroll down to the text box labelled ‘Header Code’, then paste the tracking code for
Google Analytics here.
Save changes.
As you can see, both processes are only slightly different.
You should be able to replicate it on whichever theme you’re using provided it has a section
to add code to the head tag of your website.
The last thing we’ll do is show you How to install Google Analytics via the header.php
file of your child theme.
Before you attempt this, we recommend you backup your WordPress site just in case something
goes wrong.
However, if you follow the steps exactly you shouldn’t face any problems.
For the more advanced WordPress user, child themes have many advantages.
You can safely modify and edit the code of your child theme without tampering with your
theme’s core files, allowing you to update to newer versions of your theme, without losing
your changes.
There are two ways that you could add your Google Analytics tracking script directly
to your WordPress theme’s header.php file.
These include adding it to your child theme via the WordPress editor, or via SFTP using
a tool like Filezilla.
For this example, we’ll show you how to add your Google Analytics tracking code via
the WordPress Editor, however, check out our post for the steps on how to do this via SFTP:
From your WordPress dashboard, hover over appearance > Editor.
Within your child theme, navigate to the header.php file.
Copy the Google Analytics tracking code, and paste it before the tag.
Be cautious not to overwrite any characters or existing code.
Then, select ‘update file’, and you’re all set.
There you have it!
No matter which method you choose, you should now have access to the power of Google Analytics
on your WordPress site.
Please leave a comment and tell us if you found this guide useful.
We hope this brings you another step closer to creating your perfect website.
If you liked this video hit the like button, and remember to subscribe to our YouTube channel
for more videos related to WordPress, digital marketing and how to run a successful website.
To get access to exclusive discounts, free tutorials, and to stay in the loop on the
latest updates, sign up for our newsletter at OHKLYN o-h-k l-y-n.com, and until next
time, happy building.