How To Implement Google Analytics Tracking in WordPress Website

Google Analytics is powerful and free tool which provides all possible information about website audience.

To install Analytics tracking code on WordPress website, there are two basic ways:

Use Google Analytics Plugin

The method is to use specialized plugin. One very popularĀ is plugin Google Analytics by Yoast. It has a lot of options, and even a payable Premium edition. Yoast is integrated with Google Analytics and provides a lot of data inside WordPress backend.

If you are not technical person, their free version is probably method you should choose. Just install plugin from Plugins section of Dashboard, set Analytics login information and you’re done.

Insert Google Analytics tracking code directly in theme code

For me, it’s a little too much to install big plugin just to place few lines of tracking code. Yoast has additional features, like showing of Analytics data directly in WordPress Dashboard. But, I prefer to load directly to Analytics website since there I see more information.

One option is to insert tracking code to footer.php or header.php file of WordPress theme. Go to Dashboard -> Appearance -> Themes -> Editor page and click on Header on file list on right side. Place Google Analytics code just before ending </head> tag. Click Update File button to save the changes.

This option is also pretty easy and fast, and there is no additional plugin involved. However, there is one flaw. Since you edit theme file, if you update theme later to new version, that will remove tracking code too. So, you can either not update theme after you install Analytics tracking code, or add it again on same way after theme update.
Sometimes this is good enough, like when you use custom theme and have full control over update process.

Finally, I found Super Simple Google Analytics. It’s small plugin which only inserts Google tracking code on right place and nothing else. On this way you can avoid huge plugin and also Analytics tracking code will survive theme update.

Share on FacebookShare on LinkedInEmail this to someoneTweet about this on TwitterShare on Google+