How to Install Google Analytics on a WordPress Blog
If you are interested in finding out statistics about visitors to your blog, the best free way of adding tracking to your blog is to install Google Analytics. Google provides a free Analytics service – you create a new account with Google and they give you some code to place on your website which lets Google track visitors to your site. You can log into your Analytics account on Google and see stats such as the number of visitors from different countries, the number of times specific pages were viewed and so on.
You can sign up for Google Analytics here. The instructions for signing up and enabling tracking are fairly easy to follow if you are capable of adding a HTML file to your webhost account. Placing the tracking code on a WordPress blog though is not as obvious as it might be with a static website. However, the method is similar – all you need to do is place the tracking code just before the </body> tag in your WordPress theme.
To find the </body> tag in your current theme, follow these steps:-
- Log into your WordPress blog as an administrator.
- Under the Appearance menu on the left, click the Editor option.
- Click on the Theme files options on the right to find one that contains the </body> tag.
The </body> tag may be in the footer.php file on your theme but on mine I found it in a file called end.php.
- Paste your tracking code into the theme file just before the </body> tag and then save the file.
Your Google Analytics account should now show stats for visitors to your blog. It may take up to 24 hours for the first visitor stats to appear in your account.