Home » Aron Govil- Details of Linking Google Analytics to WordPress

Aron Govil- Details of Linking Google Analytics to WordPress

In this article, we will learn how to add Google Analytics code via a plugin on WordPress explains Aron Govil. We will also add it on the actual page using opening and closing HTML <script></script> tags.

This article has been updated to cover the March 2013 changes in Google Analytics tracking code. If you are looking for information on how to add Google Analytics to WordPress using PHP, please see my other article here.

There are many great analytics tools available today including the built in statistics package that comes with your domain name. However, I still prefer to use Google Analytics because of its outstanding features for larger websites such as the number of page views and unique visitors over time, geographical location data of visitors and their landing pages etc. It also allows you to track external links (Paid search URLs, affiliate URLs etc) which cannot be done using internal WordPress stats packages like stat or WP-Stats.

If you would like to sign up for a Google Analytics account, please go here first. Please note that as of March 2013, Google is now allowing custom variables and user ID tracking by default. If you wish to opt-out of the latter feature (recommended), please read this article first on how to do it.

Now let us learn how we can add the code snippets to your WordPress blog so that it will start tracking visitors and page views on your website:

1) Ensure that you have a working installation of WordPress on your hosting server and you are logged in as admin.

2) Navigate to Plugins -> Add new from left hand navigation menu in WordPress Admin panel.

This will show all available plugins which you can add to your blog.

(a)    Google Analytics for WordPress by Yoast

(b)    Google Analytics Dashboard for WP by Monster Insights

(c)    Google Analytics+ by Thirsting Media

Please note that all these three plugins work fine with WordPress but I prefer to use the official plugin from Google itself. Because it updates frequently and 100% compatible with latest versions of WordPress. Unlike some other 3rd party plugins which don’t always support newer versions or might not have been update due to lack of funds says Aron Govil. So if you have a Google Analytics account already, please go ahead and install this plugin.

Please note that I have taken screenshots of all screens from my own blog so that you can see how it looks in our example. In case your blog might look different, just use your common sense to navigate through the plugin options by pressing the links shown in blue color.

Before you start putting code snippets on your WordPress pages or posts, make sure they are only visible to you as an administrator or editor/contributor. You can verify this using a simple trick found here. If a post is as private, you won’t be able to see the post URL in your browser address bar while viewing a draft. So if you have trouble seeing code snippets being add on a private or draft post/page. Please set it as public temporarily and save after adding the snippets.

5) Now let us start adding the Google Analytics code snippets to your website. The following screenshots show how it should look like after you have added all 3 tracking codes:

(a) First is the main tracking snippet which loads the external file containing ga.js script for tracking asynchronously? It will also pass on necessary arguments such as user’s cookie ID and other information required by GA servers to track your visitors dynamically without requiring page refresh so that you can see who is visiting your blog in real time explains Aron Govil.

Conclusion:

It does its job perfectly!

You will have to add this tracking code on all your pages/posts. So that visitor information can be track from each and every page.

Leave a Reply

Your email address will not be published.