Just having an attractive website is not enough. There are many more things that need to be done after that.
And tracking your visitors is one of them. It is one of those important things that you CANNOT ignore; otherwise, you would not get to know what is the source of your traffic and how content is performing.
Visitor tracking is not the most difficult task as it can be done with the help of Google Analytics.
However, adding Google Analytics to your WordPress website can be a bit overwhelming because there is more than one way to do it.
You can do this manually, through a plugin, or with the help of Cloudflare. I will show you the exact steps to add Google Analytics through these different ways, but before that, let me tell you more about why you should install this service. 🙂
Why do you need Google Analytics?
First things first, Google Analytics is a service that helps you identify what is driving traffic to your website and also better understand your customers. You have tools within the service that allow you to deepen your knowledge and evaluate the performance of your website , after which you will be able to provide better service to users.
Without a tool like Google Analytics, you would not know data such as the countries that generate the most traffic, the device used, the pages they visit, the time until they stay on your website, etc. Not being able to identify if your SEO results are paying off or not.
Although there are also many other tracking tools, you may not want to use any of them because Google Analytics is the most accurate, hands down. And on top of that, it’s completely free.
Let’s see how to add them …
There are a few ways to add Google Analytics to your WordPress site, which are discussed below, along with step-by-step instructions.
Create Google Analytics account
First things first, let’s prepare the Google Analytics settings. You need the tracking code no matter which option you choose. So this is a prerequisite.
Step 1: Set up your Google Analytics Account
Go to their website and log in with the desired Gmail account.
After that, press the “Start Measuring” button to continue.
Here, you need to enter your account name. It can be the name of your website, your personal name, or whatever you prefer.
Just know that you can handle analytics for multiple websites from a single account, so enter a name that doesn’t confuse you. Once you’ve done that, keep the boxes checked as they are and hit the “next” button.
Since you will be tracking your website, you must choose the “web” option.
In this step, you need to enter information such as your website name, report time zone, etc.
Now, you will see this “Terms of Service” pop-up window. Just give it a quick read and click “I agree” after checking the boxes.
And we are done with the account setup process.
Step 2: Get the Analytics tracking code.
Assuming you are logged into your Google Analytics dashboard, click on the “Admin” tab on the left side.
After that, click on Tracking Information> Tracking Code. Now all you have to do is copy the huge code that is provided in “website tracking”.
Great, now you have Google Analytics ready to go.
You can then choose your preferred method of adding them to WordPress.
By hand
If you don’t want to install another plugin just to add Google Analytics to your site, doing it manually is a good option.
Keep in mind though, it’s not as feasible as doing it with a plugin, and you might also lose code when you change / update your theme in the future. If that’s okay with you, continue with the steps below.
Once you’ve copied the tracking code, head over to your WordPress dashboard and click on “Theme Editor” under “Appearance.”
You should go to the “header.php” section and paste your tracking code just before the closing “</head>” tag.
NOTE: Don’t forget to make a backup before continuing with this step, in case something breaks.
Once you’ve pasted the code, hit “Update File” and you’re done.
Using the plugin
If you don’t want to risk adding Google Analytics to your site manually, you can use a plugin to do it easily and safely. This is personally my favorite method and I totally recommend it. In fact, I think most people use this method and you should too if you want to eliminate unnecessary hassle.
In this method, you can use any plugin of your choice, but I’ll show you two of my favorites.
The first plan one is the ” Insert Headers and Footers ” plugin. These are the steps to do so:
Step 1: Install the plugin.
Head to your WordPress dashboard, then Plugins> Add New and type “Insert Headers and Footers” in the search bar.
Click “Install Now” and activate it. I already installed it so you can see that it is active.
Step 2: Copy and paste the tracking code.
In this step, all you have to do is copy the tracking code from your Google Analytics dashboard and paste it into the plugin. To do this, look for “Insert Headers and Footers” on the left side of your WordPress dashboard under the “Settings” tab.
Once you click on that, you will see something like this:
Here, you need to paste the code in the box under “Scripts in header”. All done with this plugin.
The next plan the add-on I was talking about is MonsterInsights. It is quite reliable and widely used. On top of that, you can track visitors and view Analytics information directly from your WordPress dashboard. Follow the steps below to configure it.
Step 1: Install the plugin.
As always, head over to your WordPress dashboard and click Plugins> Add New. After that, type MonsterInsights in the search bar.
Once the plugin appears, click “Install Now” and then press “Activate.”
Step 2: Set it up.
Before you can start using Google Analytics on your WordPress site through MonsterInsights, you must first configure the plugin.
On the left side of your dashboard, find “Insights” and click on “Settings” below it. You will see a page like this.
Click on “Connect MonstersInsights” which will take you to the login page of your Google account. Fill in your information and press “Next”.
Now, you will see the permissions page, for which you need to click “Allow”.
Congratulations! All steps are done and your Analytics should start working.
Cloudflare
The last method is to use Cloudflare Apps . They have a host of third-party integrations that allow you to extend the functionality of Cloudflare services, and Google Analytics is one of them. To configure it with this method, follow the steps below:
Step 1: Get the Google Analytics Tracking ID
You need to log into your Google Analytics account and go to Admin> Tracking Information> Tracking Code. Look for this short code that starts with “UA”.
Copy it for now.
Step 2: Add the code to Cloudflare applications
Get started by logging into your Cloudflare account (or sign up if you don’t have an account) and add your domain name. After that, click on “Applications”.
Type “Google Analytics” in the search bar and click on the application once it appears. Press the “Preview on your site” button and enter the Analytics tracking ID, which you copied.
Conclusions
There you go! Hope you can now easily add Google Analytics to your WordPress website.
Comments are closed.