How to Install Google Analytics on a WordPress Site

The web for the first time in human history has enabled the consumers to spill out what actually they are looking for in shape of keyword search. Moreover, it has provided consumer industry insights into the consumer’s behavior while they surf online.

In the business perspective, the industry experts now have the ability to tailor products according to the consumer’s actual needs as asked by the consumers.

Google analytics is one such tool which helps you track and analyze the user’s behavior visiting your website. Moreover, the tool also provides meaningful insights into your user’s activity, presented in an easy to understand and visually appealing way.

In this short guide, we will introduce you with two widely used methods to integrate Google Analytics into your WordPress site. More importantly, however, you will need to sign up for your Google Analytics account. So, let’s discuss those steps first.

Sign Up for Google Analytics Account

In order to start collecting user information for your site. You will need a free Google Analytics account which you can easily create by using Google Gmail ID.

Simply head to Google Analytics site and go through easy to follow steps, including information of your site, to create the account using Gmail or any other email ID. Google Analytics not only stores all the information for your site but also it provides a user-friendly dashboard to make sense of all the information in a more presentable and less scary way.

Once you have successfully completed all the required steps and fill in the information. You will be presented with an interactive dashboard showing analytics tools and information including a unique tracking ID, and a tracking code for your site.

Google Analytics generates a unique code for each site which needs to be embedded to your site to enable analytics service to verify and start collecting data from your site.

Integrating Google Analytics Using WordPress Plugins

As we have mentioned earlier, there are two ways to integrate Google Analytics to your website. One such method and probably the easiest one is using an integration plugin for your site.

These plugins not only help you to embed tracking code to your site. But it also provides you with the convenience to shows analytics information within your WordPress dashboard. So, that you don’t have to leave your site for such information.

You can find a range of these integration plugins upon running a simple query on the WordPress Plugin Directory. However, to give you a head start. Following is the list of some of the widely used integration plugins you can choose from.

Integrating Google Analytics Manually

Integrating Google Analytics manually requires tinkering with your WordPress Theme files. So, unless you know what you are doing or won’t change your theme anytime soon. In that case, you should not use this method or use it with caution as it is not a recommended way.

Now the caution behind us, in particular, there are two ways you can embed the tracking code in your site which are discussed separately below.

Embed Code via header.php File

This is a pretty straight forward way to embed code into your site. Simply paste the tracking code in its entirety right after the <body> tag. Save the file and Google Analytics will verify and start tracking your site visitors.

Embed Code via functions.php File

Every WordPress theme comes with a functions file to expand the functionality of the theme. You can paste the following code snippet in your functions file after embedding the tracking code within the following code snippet to enable analytics for your site.

We hope you will find this post a useful resource for yourself. Finally, if you like this guide, don’t forget to share your feedback, subscribe and spread the word. In fact, we will greatly appreciate it by saying… Thank you!