How to implement Google analytics in Wordpress blogs

Good marketing tactics involve a form of analysis. There is the need to find out how much visitors come to your site, what were they looking for and how they behave on your site. This will indeed help you to alter your site contents and structure in order to suit those visitors. So how do you do that?

You will need a tool that will allow you to track your website visitors. There are many tools available on the net but in this article we will be focusing on the one offered by Google.

First you will need to register with Google analytics . If you already have a Google account (if you use Gmail for instance) this should be quick. Otherwise you will need to go through the sign up process.

Google analytics sign up page

Once this registration process is done you will be prompted to enter your site’s information (URL, name of site etc). After that you will need to accept Google Terms of Service and this part should be over.

Once finished, you will be taken to a page where you will be given some code. This is where things get interesting. For Google analytics to work you will need to implement the code in your wordpress site.

Analytics Tracking Code

Inserting code in Wordpress site

In my opinion it is better to implement the code in the footer.php file.  There are two ways to do this.

If your footer.php file is writable you can modify it from within wordpress. From your dashboard, go to presentation and theme editor. Choose footer.php

Editing the footer.php

Click once in the box on the Google analytics page. Everything will be automatically selected. Copy everything and paste it in the footer.php file. You can put it anywhere you want provided it comes before the </body> tag. Once finished click on the Update file button and voila.

  • If your file is not writable

Open your FTP client and navigate to the location of your footer.php file on your host. Edit the file and insert the Google analytics code just before the </body >tag. Save the file and overwrite the file if necessary.

Now return to the Google analytics page and you will find whether Google is detecting the code. A warning sign will be displayed on the Tracking Status.

Hope that this tutorial will help.

Other resources

Loading time: 30 (0) ms