How to Add Google Analytics in Wordpress

Add Google Analytics in wordpress
Asynchronous tracking is an improvement to Google’s previous tracking code. It takes advantage of browser support for asynchronous JavaScript to enhance the speed in which the tracking code is loaded.
• Faster tracking code load times for your web pages due to improved browser execution
• Enhanced data collection and accuracy
• Elimination of tracking errors from dependencies when the JavaScript hasn’t fully loaded

It's better to put the asynchronous code just above </head> since it doesn't slow down your site in any way and your tracking request time will be more accurate.
This post will explain How to Google Analytics in Wordpress blog correctly.
There are two ways to install Google Analytics tracking code in Wordpress theme.
1. Editing Theme in Word press
*Login in through wordpress admin panel
*Go to Appearance Editor (theme editor)
*Select the footer.php or index.php
**Select header.php
*Find the </body> (closing body tag) html tag
**Find the </head> tag^ (closing head tag)
*Copy and paste the Google Analytics code before the < /body>tag i.e just above < /body> .
**Copy and paste it into your web page, just before the closing </head> tag^.
*Click Update File to save changes.
* Now open your blog and view source to see Google Analytics code in wordpress
^One of the main advantages of the asynchronous snippet is that you can position it at the top of the HTML document. This increases the likelihood that the tracking beacon will be sent before the user leaves the page. It is customary to place JavaScript code in the </head>section, and Google recommend placing the snippet at the bottom of the </head> section for best performance.
Read detail HERE
*If you have changed your wordpress blog theme, you need to repeat above process.
*Make sure you select ga.js Google Analytics Code

2. Using a Plugin in Wordpress Blog to Add Google Analytics Tracking Code
Use this Add Google Analytics in Wordpress guide-tipsplugin WP Google Analytics
There are many plugins that can help you do this.
Search for More Google Analytics Wordpress Plugin here (external Link to wordpress)- simply type Google analytics and click seach plugin

Important Note:
*Don’t accidentally have Google Analytics code in more than one section on your side, always view Source and make sure you don’t see two GA code snippets on same html page, if you do, this will definitely break reporting to Google Analytics
Manual Installing of Google Analytics vs Using Plugin
The only problem with the manual installation is that if you change wordpress themes you will loose your Google Analytics tracking. That is why it is better to handle the Google Analytics tracking code within a plugin. The selected plugin is a simple plugin which remain same even when you change the theme

However if you are not much aware of wordpress Plugin then use manual installing of Google Analytice code. When you change the wordpress theme you can again follow manual procedure for adding Google Analytics Code in your wordpress blog

My advice is to add Google Analytics Code wordpress blog manually. One important reason to do this is, when you update your wordpress version, it may not support that plugin immediately.

Still having confusion with How to install Google Analytics in Wordpress, Check the video tutorial below.

Recommended Reading:
White Hat Seo


W.Tyler mod

This post was very helpful in understanding about procedure to add Google Analytics in Wordpress blog.

SEO Vicky mod

Good information. It is very important to add Google Analytics in Wordpress very carefully and correctly. Hope this guide on how to install Google Analytics in wordpress will be helpful to others.
Thank you for sharing.

Mohan thakur mod

This post have made easy understanding on process to Add Google Analytics in Wordpress.

Thank you :)

Samantha mod

I too successfully added Google Analytics code in my wordpress and its working fine.

Thanks for posting the correct process of adding analytics code in wordpress blog.


The tutorial is quite simple and perfectly explained :) . Google analytics is one such thing that we all check hundreds of time .And having it installed in Wordpress is very helpful and essential too :) . Even I have to install it it now . Hope your guide will a help a lot of people.


Post a Comment