For most website owners, it is really vital to track visitors and to monitor usage & visit statistics. This kind of information can be used to improve services offered. One of the most productive and widely used tools is the “Google Analytics”.
Integrate Google Analytics with WordPress blog
Google, undoubtedly is one of the global leaders offering quality services. “Google Analytics” is a free tool offered by Google to track visitors. Google Analytics report provides you with just about every bit of information that you need so that you can understand how people are interacting with your website. For starters, Google Analytics report could be a bit confusing and overwhelming. But once you get the hang of it, you won’t look back.
Here’s a sample of how a part of Google Analytics can look like:
To get started, you would need to get your own free Google Analytics account. Once you have done that, you can follow any of the following 3 methods to integrate Google Analytics code in your WordPress blog.
Here are the 3 ways to Integrate Google Analytics with WordPress blog:
- Add Google Analytics code directly in footer.php file of your WordPress theme.
- Add Google Analytics code in functions.php file of your WordPress theme.
- Use a plugin by installing it in your blog (via Admin panel).
Now I am going to discuss the 3 methods mentioned above.
1. Add Google Analytics code directly in footer.php file of your WordPress theme:
Note: The only thing you would need to remember is that if you change your WordPress Blog theme, you won’t be able to track the stastics until and unless you repeat the same procedure for the new theme. Simply put, this procedure is theme dependant and you will need to repeat this as many times as you change the theme of your website (for the first time). It’s possible that you can tend to forget this & if this happens, Google Analytics won’t be able to perform its duties.
2. Add Google Analytics code in functions.php file of your WordPress theme.
This method is easy too and will hardly take a minute. Simply add the following code in functions.php file of your theme:
//Leave the following untouched
Once you have done this, simply upload the revised functions.php file to your theme and you will be done.
Note: Similar to the Method 1, this method relies on the fact that you will need to add the above code to the functions.php file of every theme you want to use, failing which, you won’t be able to track the statistics.
3. Use a plugin by installing it in your blog (via Admin panel).
A plugin is an installable set of files that lets you achieve your objective without you handling the technical part of it. What I mean by this is that if you use a plugin, you will no longer have to mess around with the footer.php file or functions.php file of your theme. Instead, you can just install the plugin via Admin panel of your WordPress blog and configure it as per the instructions and you will be all set. The biggest advantage is that you can change as many themes as you want and the Analytics statistics will be available for you. Consider this as your best plug-and-play solution.
If you do not know of any plugin, I suggest you try Google Analytics for WordPress by Yoast.
1. Usage of plugins can add to addition of additional overhead thereby increasing the load time by a little percentage. However this difference could be marginal depending upon the way the plugin has been created and the best practices followed while creating the plugin. It is also your safest bet if you don’t want to mess around with the files yourself.
2. Sometimes plugins clash with each other. So if you want to install multiple plugins, please see to it that they don’t clash with each other. You may read about such issues at the respective developers website.
If you have enough technical knowledge to edit the footer.php file and functions.php file and if you are positive that you would not forget to add the code, in an event you change the themes, then you may follow Method 1 of Method 2. In my opinion, Method 2 is a much systematic way as that helps you keep tracking code separate from your theme code and lets you maintain the code easily. If you do not want to risk editing the files yourself, then I highly recommend that you go with Method 3.
Although you have setup your Google Analytics tracking code, it can take up to few days before Google can actually start showing data in your account dashboard. So don’t be surprised if you have added the code today and yet the statistics don’t show up for next few days!
Did you like the above listed ways of adding Google Analytics code to your WordPress blog? Do you know of any other simpler ways to do the same? Can you recommend us of any useful Google Analytics plugin that you may have used/found? If yes, we would love to hear from you. Please share your methods with us, by commenting below.