Tutorials

How to Install Google Analytics on a WordPress Site?

When we start a website, our primary goal is to get traffic from different sources to make it successful. You may have different objectives such as getting more organic traffic or traffic from some specific countries, or traffic for some highly searched keywords, etc. Whatever the case might be, you always need a tool that can report you the traffic stats along with the details like traffic channels, keywords that brought traffic, countries from where traffic came, website and their pages from where traffic is coming, and other details.

In short, you need to have every detail related to the traffic that comes to your site so that you can analyze everything and plan how you can multiply that traffic and most importantly how you can get traffic from a particular keyword or a specific country. When you have an idea about the current traffic on your site, you can plan further accordingly.

There may be hundreds of tools that give you the traffic stats, but Google Analytics is the most used online tool for it. Very few people would be there who are not using it.

If you ask me, I am using Analytics on all my sites because I find it easy to keep track of traffic of the sites. Hardly any free tool offers the features that Analytics offers.

You can install Analytics on all types of websites as it gives you a code that you have to intsert into your site’ code in a way that it gets loaded whenever a page of the site is opened.

Since this blog is dedicated to WordPress, I am going to show you how you can install Google Analytics on a WordPress site in simple steps.

First of all, visit Google Analytics using this link.

Login using your Gmail credentials, and click on Sign up

Once you click Signup, you will see the page below where you need to enter your site name, account name, and site’s URL.

Just fill them all, and at the bottom, you will see “Get Tracking Id”.

Click that button. You will get TOS agreement, select the country, and click I Accept. On the next page, you will see the tracking code.

All you need to do is to copy the code and paste into your site’s code. I will show you how. For now, copy this code.

Go to your WordPress site’s dashboard by visiting the admin area. There, go to Appearance >> Editor

You will be on the theme editor page. You will see the style.css page is already opened.

You don’t have to do anything with the style.css page. You have to click either on footer.php or header.php. I recommend clicking on header.php as it loads at first when any page of the site loads.

Enter the code just above </head> as you can see in the below screenshot

Note: (i). We have to put the code in header or footer because these are the segments which loads on every page which means analytics code loads whenever any post or page is accessed, and hence traffic is recorded for every page.

(ii). There is no rule of pasting the code just above </head>; you can place it anywhere between <head></head>. Some people even enter the code in between <body></body> but I would recommend keeping in the head tag only.

That’s it.

Google Analytics is installed on your WordPress site. Now, after some time you can go back to Google.com/Analytics, and check the traffic stats.

The first part of signing up to Analytics will be same in any case but the other part of installing the code into site’s code can be done in easier way because not everyone feels comfortable putting anything in the code pages. For such people, a Google Analytics Plugin can be used as well.

Google Analytics Dashboard for WP (GADWP) is a nice plugin for Google Analytics. You can authorize your Analytics account in this plugin’s setting to use it.

When you install and activate Google Analytics Dashboard for WP (GADWP) plugin, you will see these new options displaying in your dashboard.

Just click on General Settings where you will see a button “Authorize Plugin”.

Click that button, and you will see the next screen as shown below:

Click “Get Access Code”, and it will ask you to choose your Google Analytics Account.

Select the account and you will be directed to another page where you will be given an access code, which you need enter in the Plugin’s setting where access code was asked. Enter that code, and save.

Now, you will be able to check the traffic stats right there in the WP dashboard in this plugin. You won’t need to visit Google Analytics to check the stats now as the plugin is authorized and everything you can check in the dashboard.

Note: Before using the plugin, you must have to sign up to Analytics which I have discussed in the first part of the post. That step is mandatory. The plugin is there just to bring all the data from google.com/analytics to your WP dashboard. However, when you use the plugin and authorize it, you don’t need to install the tracking code manually as when it is authorized, it installs the code automatically.

Conclusion

Google Analytics is one of the most important tools to use if you are having a website as it helps you track your traffic. If you understand your audience, you can make most of your traffic to get more benefits from your site.

If you still have any problem understanding the above guide, do ask your question in the comment section.

Atish Ranjan

Atish Ranjan is a blogger from India who has been blogging since 2010. He loves to learn, implement, and share online. He is a full-time blogger, and managing his popular blog - www.techtricksworld.com for years.

Leave a Reply

Your email address will not be published. Required fields are marked *