Today, I am going to show how to add Google Analytics to WordPress blog in less than 5 minutes. But before sharing the tutorial, let me tell you in Brief about Google Analytics and why Google Analytics for wordpress is important.
Well, Google Analytics is a free online tool that can be used by webmasters/bloggers for better understanding how people are using their website or blog. In other words, with the help of Google Analytics, you can easily track how much traffic you are generating and from where your traffic is coming i.e. search engines, direct traffic, social networks or referring sites. You can also track what keywords were used by visitors in the search engines to get into your website and on which pages they are landing on your website, where they live, their age, the browser they are using and so on. So if you want to expand and grow your business on internet, then adding google analytics to wordpress is highly recommended.
How to Add Google Analytics to WordPress?
1. Sign Up For Google Analytics Account
First of all you will have to signup for Google Analytics account. To do this, simply visit Google Analytics signup page and log in with your Google account login details. After clicking on Sign in button,you will be redirected to Google Analytics main sign up page.
Google Analytics sign up page will look something like this:
2. Adding Website In Google Analytics
Now you will be given two options (Website Or Mobile APP) to track, make sure you select “Website“. After clicking on Website , enter account name, website name,website URL,industry category and reporting time zone. Don’t worry about any discrepancy, you may change all these information later.
4. Add Google Analytics Tracking Code To WordPress blog
There are various ways in which you can install Google Analytics for WordPress.
- Adding Tracking Code in Header.php and footer.php file
- Adding Google Analytics Using Functions.php
- Adding Tracking Code Using Third Party Plugins
Adding tracking code in header.php and footer.php file
Copy GA tracking code and go to WordPress Dashboard-> Appearance-> Editor. Open either your theme header.php file or footer.php file. If you want to add the tracking code in header.php (recommended by Google), then add it before </head>Tag and if you want to add it in your footer.php file (for improving peformance) ,then add it before </body> tag. Save the changes and update the file. Google Analytics should be installed.
Adding Google Analytics Using Functions.php
Copy the PHP code given below and paste it at the end of your functions.php file. Now replace “UA-XXXXX-X with your property ID” in line 5 with your GA Tracking ID. If you want to follow this method,then make you are good in PHP as a small error in functions.php file can breake your complete website.
Adding tracking code using WordPress Plugin:
If you are finding difficult to add tracking code in WordPress theme files, then you can install Google Analytics for WordPress. It is user friendly and is developed by “Joost de Valk” the guy behind WordPress SEO plugin. The only disadvantage of this plugin is that you will have to deal with one extra plugin and it might affect your page speed to some extent.
Adding Google Analytics in Gensis Framework:
Nowadays many WordPress themes are providing inbuilt Google Analytics functionality. For example, if you are using Genesis framework,then you can add Google analytics directly in your Theme options. Go to WordPress Dashboard->Genesis->Theme Settings->Header and Footer script and paste the tracking code. Click “Save settings” and you’re done.
How to Check if Google Analytics Is working?
If you want to confirm that Google Analytics is installed on every page(Posts,pages,archives) of your WordPress website, then right click on any page and select view source code.You will see your ga.js code right above the closing header tag on every page.
You can also check it directly from Google Analytics account. Go to your Google Analytics Account and click on “Admin” at the at the top of the page and under “Property” choose your site and then click “Tracking Info”. If the Google Analytics code is installed properly, this section will displays the words “Receiving Data“.
If you find this tutorial useful,then do share it with your friends on Facebook and Twitter & if you have any questions or need help regarding installing Google Analytics In WordPress,then do leave your comments in the comment box given below.
He is the guy behind AffiliateNova and have been working in the Internet Marketing field for past seven years. He lives in New Delhi,India and loves to educate the masses on WordPress, SEO and Affiliate Marketing. You can hire him for blog consultancy or web development services.