In this video, I'm going to show you the best method on how to install Google Analytics on your
WordPress website. All and more coming up.Hey, there measuregeeks! Julian here back with
another video teaching you the data-driven way of digital marketing. Now, today we want
to talk about how to install Google Analytics on a WordPress website. And as always, there's
not just one way of doing things. So today, I'm going to show you actually three ways
on how to install Google Analytics on to your WordPress website. And later on, you can pick
which one suits you best. I will also give you my recommendation at the end of this video.
Now, we've got lots to cover so let's dive in.All right, welcome to our demo software
we want to install Google Analytics on. Now, in order to do this, we need to have two things
in place already. First of all, we need to have access to the admin area which we can
reach under our domain name slash WP admin login and now be able to install Google Analytics
on your website. Be sure to have access to the back end. Second part would be to have
an actual tracking ID. And this is what you can get at analytics.google.com login with
your Google account, and then navigate to the account that you want to install. If you
don't have an account set up, you will be greeted with setting up a new account. Let's
quickly go through this. First of all, we want to track a website. Let's choose an account
name. Normally, you would choose your company name, then you can give your web property
or the web tracking code a name. So for example, for us, it would be our demo shop. And then
you enter your website URL.In our case would be right here. Now, be sure to not have the
HTTP part up here at the beginning. You can choose if you're on HTTP or SSL in this drop-down
menu. And then you can choose your industry and also your reporting timezone. Now, this
is very important because you want to ensure that the timezone matches up with the timezone
on your website to be able to compare data later. So make sure that this is set correctly.
And you can choose if you want to take part in some more data options that Google Analytics
provides. I'll just leave them tick for now. And we can now click on Get our tracking ID.
We need to agree to the data processing terms. This might differ from where you are located
at. And I'll accept this. And now we should get our tracking code. We jump right into
the section. Now if you already have an account set up, you can simply go here to the admin
section. And then on the property section, you find the tracking info that you can open
up and go to the tracking code.So you get to the same place here. And here's where we
get our tracking ID that we will utilize to install Google Analytics on our website. Let's
get to installing it. And I'm going to show you three methods here. The first method is
through a plugin. So we'll go down here to our plugins section and add a new plugin.
And we simply type in Google Analytics. There are different plugins out there that will
help you to install Google Analytics or choose the most popular option which is the Google
analytics dashboard plugin for WordPress by monster insights. So let's install this and
activated and will put us in this setup screen. And we simply follow along with our Setup
Manager here will connect monster insights to our Google Analytics. It will authenticate
us to Google, we allow the settings and then we can choose our account. In our case, we
had our tracking ID already available here, just going to copy this. And we'll find here
our view that we want to connect. And we will complete the connection. We can choose different
tracking options. I will leave them untouched for now. But this is really about the customization
of your tracking code. And that should do it we exit our wizard. And we should have
now Google Analytics installed as easy as that. How can we verify that this is actually
working?Well, one is an extension by Google that you can install to your Chrome browser
which is the Google Tag assistant. And we see here that Google Analytics is installed,
but there is no HTTP response. And this is because Google Analytics is actually blocked
for people who are admins and logged in to WordPress at the moment. So let's open up
a private browsing mode here. And I'm just going to navigate to my page. And now we are
not logged in. And we can see here, Google Analytics is now deployed. Now depending on
if this green or blue, this doesn't really matter. But it seems like Google Analytics
has been deployed correctly. We can also test this by going into our Google Analytics here.
And here we see the status. And what we can do is test our implementation by going into
the real-time traffic reports through this link. And here you can see that a page view
was just generated. So this means that the user that is right now on the website which
is us has generated a page view. So if we would go to the next page here should have
another page view enter the picture. So Google Analytics is correctly installed. And this
is our first method of how we can install Google Analytics via a plugin. I'd recommend
this for everyone who doesn't want to get technical and install Google Analytics in
a very easy way. But the downsides might be that you have to install an additional plugin.
This can potentially bog down your WordPress installation and slow down your page. So I
want to show you another method of how you can install Google Analytics on your website.
And this is through the installation in the theme files directly. So let's head back into
our WordPress back end. And I'm going to deactivate our plugin.And now let's go ahead and install
Google Analytics again through the theme files. For that will go over to appearance, then
theme editor. Now as it says here, it's recommended that you have a child theme already set up
that will let you install these codes into your child theme so that don't get overwritten
next time your theme updates. So definitely have a child theme set up first, then we can
go ahead and proceed here. Click on I understand, select your child theme. And then find the
header.php. Now, this needs to be set up in your child theme in order to edit this. So
we're going to click on it. And now we have access to the theme that governs our website,
and especially the header of that theme. Now, we go back to Google Analytics and click back
into our tracking information to get our tracking code. And here we have the global site tag,
we can just simply copy. And it says here that we should install this in the head section.
So with our theme open right here, we can add our information.And I'd suggest to put
this right under the meta tags right here. Just paste this in. The earlier the Google
Analytics code will fire, the more likely it is to send data of so even if the user
navigates on before the site has ended loading, you'll be able to capture information. So
now that we have this setup, let's update our file and head back to our page. Now, we
should see in our tag assistant, the global site tag is installed and Google Analytics
so it's already sending data over. Let's look into our real-time reporting inside of Google
Analytics. And here, we also see that there are page views already generated. If we go
on to another page here, we should again see data coming in right here we see a new page
view. So Google Analytics is installed correctly for our page. And this was also an easy method
to install. If you are comfortable with copy-pasting code into your theme file if you have a child
theme set up and don't want to use a plugin to install your Google Analytics on your page.
Now let's go on to the last method that I want to show you. And this is installing Google
Analytics through Google Tag Manager. Now Google Tag Manager is a tag management tool.
So it manages all your tracking in one central place. And this is a Google Tag Manager container.
To get started with Google Tag Manager, head over to tagmanager.google.com and create a
new account, you can follow the steps as we've done before in our Google Analytics set up.
So we had your company here, and then your website.You're going to go with web, and create
this and then we're entering our Google Tag Manager container. Now the first thing that
we need to do, we also need to install a container snippet onto our page into our theme files
just like we did before. So let's get go ahead and follow again the steps that we just did
earlier, I'm going to copy the first code that needs to be in the head section. We're
going to go into to our theme settings and our theme editor, choose our child theme here,
go into our theme header PHP. And this time, I'm going to get rid of our global site tag
that we have installed right here. Instead, paste our code of Google Tag Manager. Then
there is a second code that we need to place beneath the opening body tag. So we're going
to look for the body where it starts right here. And right underneath going to post our
Google Tag Manager, no script tag. Let's update this file.Now we can head back to our page,
reload that. And in our tagging system, we see that we have Google Tag Manager now installed.
But Google Analytics is actually not yet part of this implementation. We will need to deploy
Google Analytics through Google Tag Manager. How do you do this? Well, in Google Tag Manager
now, you have access to the website itself through that central snippet that we've installed
on all the pages. We just need to deploy the tracking tool that we want to install through
this Management Console. And you do this by going into Google Tag Manager and clicking
on new tag and give this all a name. So we'll be able to recognize this later. And then
when we click on tag configurations, we can see all the different tools that you can install
through Google Tag Manager onto your page. Now, we are interested in Google Analytics,
which is right on the top right here. So I'm going to click on that. And we want to set
over a page view, Now, we need to specify the account which we can do by setting up
a new Google Analytics settings variable.Here, we need to implement our tracking ID. Go over
to Google Analytics, go into our tracking information and copy the tracking ID right
here. Go back to Google Tag Manager, paste it in here. I'll also take this as a name
here. So I will be able to recognize this later. Let's save this. And this is really
what we would need, we just need to define a trigger right here. And there's already
one available which is the all pages trigger. So it will be deployed on all the pages. Let
me fix this typo up here. And we are good to go. Let's save this. And now we have implemented
one tag into our tag manager. We can try this all out by going into the preview mode. This
will put our browser into a special mode. So we will be able on our page when we reload
our page to see a debug console down here which will show us which tag have fired on
our page. Very practical to see if your tracking is actually deployed. And he will see our
Google Analytics is deployed, we can also cross check this in our tag assistant. Here
we go. The tag assistant shows that Google Analytics is deployed. And also in our real-time
reporting. There's one user right now. And here we go our page was sent and received
by Google Analytics.Now be aware once we're in the preview mode, this is actually only
deployed for you on your browser. This is not yet live on your website. In order to
push this live to the website, we will need to submit a version. This is what this big
Submit button is for click on here and we can give our version a name. So you'll be
able to see all the changes we have done to our container later on. Let's publish this
and it's should be now live on our website. So if I go back here and leave the preview
mode, reload our page, you now see Google Analytics is installed and Google Tag Manager.
Now, don't worry if those are not green. This just means that it's a nonstandard implementation
since you have done it through Google Tag Manager. But your data is still safely sent
and received by Google Analytics.Now you have seen that we have gone through quite some
steps in order to set this up with Google Tag Manager. The big advantage to this setup
is that you will be more flexible once you want to do customization and really get into
advanced tracking techniques. Because not only can you deploy easily Google Analytics,
but also your facebook pixel, Google Ads tracking, conversion tracking, or even set up certain
triggers that trigger on interactions such as a button click or when something comes
into view, or form Submit. So very versatile when it comes to expanding your tracking beyond
the scope of just deploying a tracking code like Google Analytics onto your page. It also
decouples what you set up in your WordPress installation. So if you ever wonder what tracking
code is firing where you would be able to look this up in your central tracking tool
which is in this case, Google Tag Manager. So for me, setting up Google Analytics through
Google Tag Manager is the best way to set up Google Analytics as it brings a lot of
advantages of expanding our tracking later on.All right, so there you have it. This is
how you can install Google Analytics onto your WordPress website. I showed you three
ways. One is the plugin. One is to install and hard code, essentially, the code onto
your theme file, and then the deployment through Google Tag Manager. Now, I made it already
clear that I prefer the more hard way of doing things, which is the deployment through Google
Tag Manager just because it makes me more flexible later on. If I want to install the
Facebook pixel or Google Ads tracking later on, then I'd be able to do this seamlessly
through Google Tag Manager. There are a lot of advantages. And if you want to find out
more about Google Tag Manager, we actually have a Google Tag Manager for beginners course
up right here that you can view and learn more about now. I'd love to hear from you.
Which implementation method did you pick? Or will you change your implementation method
right now onto your WordPress website? Let me know in the comments down below. And as
always, if you liked this video, why not give us a thumbs up and also subscribe to our channel
right over there because we bring you new videos just like this one every week. Now,
my name is Julian till next time.