How to add Google analytics to WordPress

When you add Google Analytics to your WordPress site, you get the ability to track whoever has been visiting your site, exactly what they were interested in from the site and how they got there. Using a plugin such as the Analytics + is the easiest way, giving you full access to the analytics dashboard in the WordPress admin. At times, keeping things a little simpler might seem to be the best way. It involves inserting the analytics tracking code directly into the site on your own. Google will instruct you to insert it to the head section of all pages of your site. However, with WordPress, you will not have to do this. You only need install a simple plugin that inserts the code automatically to every page that was created on your site.
There are only a few things needed for inserting the Google Analyticson your blog. They include;
- An installation of WordPress that is live and running the desired theme.
- A text editor or code editor
Steps to follow
- Start by checking the ‘header.php’ file of the active theme and ensure that it contains the ‘wp_head’ hook. You only need to be concerned with the active theme. You can ignore any other theme that you may have installed on the same site.
- Visit the Google Analytics site and obtain the tracking code from there. This code is always given when a site is added to a Google Analytics Account. It is supposed to be inserted into the pages of the site for Google to use it to track visitors to each page. If you had not previously added your website to your Google Analytics Account, you will need to do so first in order for you to get the code.
- Insert the obtained code
Google Analytics Plugin
- Go to plugin directory and search for Google Analytics plugin.
- Activate the plugin to get started.
- Insert your Google Analytics site ID here.
- Visit the Google Analytics site and verify that your code is working.