How To Set Up Google Analytics On WordPress For Complete Beginners
When starting your blog, one of the most important things to learn is how to set up Google Analytics on WordPress so that you can see exactly where your visitors are coming from.
This is so important to do early on because Google can only track your website traffic from the moment their code is installed on your site.
And don’t worry. If this is all new to you, I will show you exactly how to do this, step-by-step.
Before we go through the steps, I want to explain how we will use Google Analytics and what you’ll need to prepare so that you can easily follow along with the steps.
Google Analytics can be installed through various WordPress plugins. This means you’re going to use a plugin like Rankmath to connect your site to your Google Analytics property.
There’s also a popular plugin called Monster Insights, which will show you your number inside of your WordPress Dashboard.
Then there’s Google Tag Manager, which is a plugin to connect different Google services to your website.
In this case, I’m going to show you how to install your Google Analytics on your WordPress blog by simply adding a piece of code into a plugin. I want you to use Google Analytics itself to view your traffic, and not use a tool like Monster Insights, because most tools don’t show you the correct numbers.
And in case you prefer to watch this on video, I recently uploaded a step-by-step video tutorials on setting up Google Analytics on WordPress.
And when you’re visiting my Youtube channel, I’d appreciate it if you would like the video and subscribe to the channel, because more videos will come.
Click here to watch the video directly on YouTube or watch it below.
What you need before we’re going to set up Google Analytics.
In order to create your Google Analytics account, you need a Gmail account.
If you don’t already have a Gmail account, you can simply create one specifically for your website and solely use it for that purpose.
Click here to create a new Google account
For you to install the Google Analytics tracking code, you need to install a plugin called WPCode Lite. This is one of my favorite WordPress plugins I always install when setting up a new site and it allows you to add different tracking codes for your WordPress website.
This is not scary. Don’t worry. When you need it, I will show you exactly what to put in, and where.
By the way, if you really don’t want to bother with all this and instead, start focusing on your content, I do offer a service where I’ll set up Google Analytics as well as your Google Search Console for you. If you would like me to set up Google Analytics for you, just see more on this service here.
Do this to install the WPCode Lite plugin:
- Log into your WordPress dashboard.
- On your lefthand side, go to Plugins -> Add new plugin.
- In the search bar, type in WPCode and you’ll see WPCode – Insert headers and footers. (see screenshot from my website below)
- Click on install and once that’s done, click activate.
That’s all you need to do on your website for now, so let’s set up your first Google Analytics property.
Creating Your Google Analytics Property
To create your first Google Analytics property, click on the main Google Analytics setup page.
Here you will find some information and the option called: Get Started Today.
Here on the next screen, you can log in with your Google/Gmail account that you created.
And if you haven’t set up your Google account already, this is the time to do it. You need this to use Google Analytics for your blog.
In these next few steps, you have to fill in your information and describe your business.
If you’re running your blog all by yourself, just like me, just fill in that you’re running a small business and select your industry.
If you’re a travel blogger, pick travel for example.
These things aren’t super important. Just keep it as relevant as possible.
Keep in mind that when filling in your reporting time zone, you want this to be your timezone.
I live in the Netherlands, so I want it to be the Netherlands. This way, I will see page views, sessions, and more, reported in my own time zone, even though I focus on a worldwide audience.
On this next section, you’re going to select the types of reports you want to see. I always go with: “Get baseline reports” because that will give me a more broader selection and this is more of a summary of the other ones combined.
Within your Google Analytics dashboard, you can always create more custom reports, which I will create a separate blog post about soon.
Setting Up Your Google Analytics Tag For Your Website
Now that you filled in all of your basic information for your account, it’s time to set up your first Google Analytics tag.
This will be a tracking code for either a website, Android App, or IOS App. In our case, we want to create a website tracking tag.
So like shown in the image below, you want to click on the button that says Web.
In the next part, you want to fill in your domain. Make sure that HTTPS:// is selected and you fill in your main domain right after that and name your property.
To keep this simple and organized, I would just name it after your blog name, since you’re probably not going to make an app.
The enhanced measurements you don’t have to pay attention to. These are already pre-selected based on the report selection from the previous steps.
Once you’ve done this, click next.
Now a new window will pop up, which will show you a code and you’ll need to paste this code into the header section of your WordPress website.
On the right part of this code, you see a copy symbol. When you click this, this entire code will be copied.
Installing the Google Analytics Code to WordPress
Now that you copied your verification code you want to head over to your WordPress blog. Make sure to log in so that you’ll see your backend dashboard.
Remember the plugin you installed at the beginning? WPCode Lite? If you installed and activated it, a new option will show up on your left sidebar, called Code Snippets.
Hover over the Code Snippets and click on Header & Footer, as shown in the image below.
Now all you have to do is click in the header section of this page.
Press Command + V on a Mac, or Control + V on Windows, or simply right-click here and click on paste.
Now your Google tag code will be placed in the header section of your WordPress website. Simply click save and just in case, clear your cache if you’re using a caching plugin.
This will make sure your site is refreshed right away and Google can actually see your code now.
Now, if you head back to the tab with Google Analytics and click on the blue button saying: Test Installation and if everything went as planned, it will show you a green success bar saying your Google Tag was correctly detected on your website, as shown on the image below.
Congrats! You did it.
At this point, you created a Google Analytics property, installed it on your website and it’s actually working.
It can take a bit of time for it to collect your date.
Filtering Out Your Own Page Visits From Google Analytics.
As you are visiting your own blog more than anybody else, your visits will be counted within your analytics data.
And if you want to see your actual page views and sessions, you want to set up a filter to exclude your own page views.
In order to do this, you need to do 2 things.
- Figuring out your IP address and setting this inside of your Google Analytics Property.
- Setting up a data filter that will ignore your own visits.
So let’s start with configuring your IP data.
As shown in the image below, you need to click on the Admin button to go to the admin area.
Now it’s showing you the admin area. Please, don’t get overwhelmed by all of the options.
I will show you what to choose and what to fill in. You got this!
I want you to go over the area on the right that says, Data Collection and modification and click on Data Streams.
Then on the next page, click on the data stream you just created.
A new window will popup and I want you to go to the bottom of this page, where you will see the Google Tag area and click on the first option: Configure Tag Settings.
On your next screen, you go to the bottom, where it gives you the option to click Show more. then click this and click on Define Internal Traffic.
Here it will be empty and you need to create your first rule. So click on the blue Create button.
You can give this a name that makes sense to you. I named this Wifi home and mobile phone IP.
This way, I know that this rule is for my own IP addresses.
In the field, Traffic_type value, it already is filled with Internal.
The most important things to fill in are the IP addresses fields.
If you don’t know what an IP address is, this is a specific number that identifies each device inside of a network.
At your house, when using wifi, each device gets its own IP Address and when you leave your house and use your mobile data plan, your phone will have a different IP address.
So you want to set up 2 different IP addresses here. 1 from your home wifi and 1 for your data plan, if you use that.
How To Find Your IP Address
In order to fill in your IP address, you first need to figure out what it is.
The easiest way to do this is by visiting the website Whatismyip.com
Whatismyip does just what it says it does, it will show you your IP address that you’re currently using to connect to their site. And this is a line of numbers, divided by points
For example 12.345.678.90. It’s the number right on next to My Public IPv4.
Now I want you to copy this number. Make sure to copy the entire number, including the points.
Now paste this number in the field value from the image below. So where the red box is with the number 2.
I would recommend to only paste in the first 3 groups of numbers, since sometimes your device can get a new end number. But the first 3 values will usually always remain the same.
On the left side, you then want to select IP address contains. This will make sure that everybody from your home network will be excluded from your traffic.
If you’re going to visit your blog from your mobile device, outside of your home wifi, You want to go turn off wifi on your mobile now, visit the whatismyip website again from your mobile device and it will give you your current IP address from your mobile phone plan.
You can add a condition and fill in the same thing, but this time, fill in the IP from your mobile device.
Once you’ve done these steps, click on the blue create button at the top and you have set your internal traffic conditions.
Excluding your internal traffic from your analytics data
Now that you’ve set up your internal traffic conditions, it’s time to set up the actual filter that will exclude yourself from your Google Analytics data.
Go back to the Admin screen, by clicking on the admin button on the bottom left side of your screen, and this time, under the Data Collection and conditions tab, click on Data Filters.
If there is no filter yet, click on the blue button, Create Filter, then select internal traffic.
Here, you can give it a name, but most importantly, in the filter operation, click exclude and in the field traffic type, it needs to say internal.
In the bottom area, it gives you the option to put this filter in testing mode, activate it, or put it in inactive mode.
I would first set this in testing mode and click on Create. And let this run for a few days. That way, you know for sure it works.
Especially since it can take a bit of time to go into effect.
Just know that when you visit your site right after this, it will still show you as a visitor, but within 48 hours, this filter will work and exclude your own visits from your blog.
I know this is a lot to go through, but I wanted to make this as clear and easy as possible. Hence all of the images.
I know you got this and if there’s anything that you still need help with, know I’m only 1 message away.
On my contact page, you will find my number for Whatsapp as well as my email address and I’m always willing to help you out.
I will also offer this as a service for you, in case you just want to outsource this and focus on your content. But my services page will be coming soon.
If you want to work with me in the meantime, feel free to reach out through WhatsApp or email.
Now that you have Google Analytics set up and running, your next step would be to set up Google Search Console. Click here to learn how to do that now.
I hope you have found this helpful and if you know of anybody who might need this, help them out by sharing this article with them. I would really appreciate that. And of course feel free to pin this to your Pinterest account.
Talk to you soon,
Chris