How To Add Google Analytics To WordPress Without A Plugin | A Thorough Guide
Being one of the leading Content Management Systems (CMSs), WordPress supports huge amounts of plugins. Google Analytics is such a tool that can track the traffic of your website. To get valuable information about every aspect of your WordPress website, Google Analytics can help you a lot. Combining these together is a great idea as both of them can help you to expand your online business. If you are looking for a way to add Google Analytics on your WordPress site, then you have landed on the right page. The passage will thoroughly discuss the process to add Google Analytics to WordPress.
What Should be your Preference to Add Google Analytics to WordPress With or Without a Plugin?
Most of the website owners think that the less there are plugins on their sites the better their sites get. Such perceptions are not essentially always true as they might not affect your site in a bad way. Though it’s true that there are some plugins which can affect it badly as they’ve been coded in such a manner. But with a well-coded and lightweight plugin, you get a lot of flexibilities and much more time.
Whatsoever, it’s all about the quality of the plugins that you are using on your WordPress site. It will decide whether it’s going to impact the site in a bad way or a good one. Before you jump in the process to add Google Analytics to WordPress, let’s take a look at different aspects of adding this tool without using a plugin.
Not as Easy as Using a Plugin
Without using any plugin, if you have decided to add Google Analytics to WordPress site, then you might face some hurdles. It’s not as easy as it were while using the plugin. There are some plugins available that you can use to directly install the Google Analytics on your WordPress site.
Chances of Losing Tracking Code
If you are not using plugins to your WordPress site, then there are chances of losing the tracking code. Whenever you choose to switch to a new theme, you might forget to add Google Analytics again. The moment you forgot and if some visitors visit the page, you won’t be able to track them. Such incidents can be avoided by using plugins while writing the Analytics Tracking Code.
Missing Powerful Analytics Features
Features like events tracking, custom dimensions, file download tracking, and so many others can be missing if you don’t opt for the plugin-based tool. Without such a helpful plugin, you might not get all these features. And it’s time-consuming as well to set such features on your WordPress site yourself.
These are the biggest discrepancies that you might be facing if you want to add Google Analytics to WordPress without using a plugin. You can easily convert these discrepancies into your favor if you opt for a plugin to install Google Analytics on WordPress. If you still want to do so without using a plugin, then go through the following section of the article.
Comprehensive Steps to Add Google Analytics to WordPress
There are certain things you should check before you proceed with the steps as mentioned below. If you haven’t made a backup of the WordPress theme, then do so. And after that, proceed further. This is important because if there is something that goes wrong, you can conveniently revert everything back to their positions.
The process to add Google Analytics to WordPress without plugins incorporates direct editing the codes that will affect your website. So, even a small mistake will also reflect on your website if you visit at that time. A simple comma or a semicolon can destruct the whole structure of the website.
Therefore, to stay out of such situations, make sure that you have made backups of your WordPress site. You can follow the steps to install Google Analytics on your WordPress site without using any plugin.
Step 1: Take the Google Analytics Tracking Code from Google
Before you get to the further processes to add Google Analytics to WordPress, the first thing that you should do is log into your Google Analytics account. Once you are logged into your Analytics account, pick the website for which you need the tracking code. After that, click on Admin that you can find on the left side of the Taskbar.
Now, from the Property Column, click on the Tracking Info which will show you some more options. Finally, from the newly appeared list, select the Tracking Code to open it. As you opened the code, a new page should open from where you have to copy the code. Usually, you can find the code under the Website Tracking section in a text box.
Step 2: Attach the Tracking Code to the header.php File of your WordPress Site
In this step, you have to add the copied tracking code on the most important page on your website. To add the tracking code on your WordPress site, you have to log in to the WordPress dashboard first. Then, you need to navigate to the Appearance section of the CMS that you can locate on the left panel of your computer screen. From there, select the Editor option which usually appears on the list of Appearance.
If you have opened the Editor, then click on the Theme Header from the Templates section. You can find the header file at the bottom section of the Templates items. Now, paste the tracking code that you have copied from your Analytics profile in the header tag of your WordPress site.
However, placing the code in any random place might not work properly. So, when you are adding the code to the header.php file, make sure that you have pasted it before the head tag closes (</thead>). Once you are done with pasting it on your website, click on Update File to save all the changes you have performed.
To Wrap things up
That’s all you need to know about the process to add Google Analytics to WordPress to your site. The article thoroughly discussed all the aspects that you should know about Google Analytics and how you can add it to the WordPress CMS. With the steps mentioned in this article, you can easily add the Analytics tool to your website that you have made using WordPress.