How to Set Up Google Analytics in WordPress

When I first started blogging, I had no intention of monitoring the stats and how my blog was performing in terms of how many visitors, repeat visitors, pageviews etc. But as I became more active in the blogging community I was suggested by many to monitor the performance of my blog.

Google Analytics tool is one of the best tools to analyse the traffic to your blog. That can in the end help you grow your blog.

Next question, how do I make it work on my blog? As I figured out one step at a time, it became less and less confusing. MyFriend helped me with installing the code on my blog, and basically helped me set it up.

I asked him to write step by step tutorial to help fellow bloggers. So here it is …..

As a blog owner it is important to know how your visitors interact with your website. The interaction means to know about how many people are coming to your website, from where, how long they stay and where they enter or leave your site, which keywords attract most visitors and the overall traffic stats including total visitors and page views of your website, in a particular range of time. Knowing these factors will surely help you in boosting your website performance.

Related: How To Increase Website Or Blog Traffic

All these stats are provided by Google Analytics for FREE. This post is all about the reasons of using Google Analytics and how you can install it yourself on your website in an easy way.

Why Install Google Analytics?

Google Analytics makes it easy for anyone managing a site to track and analyze this data. As a powerful tool it can answer a wide variety of questions like:

Who are your visitors:

This section includes information about the demographics (age, gender) of your audience, Geo location (their language and from which country they visit), their interests, which browser they used and other important factors like: screen resolution, operating system, mobile or desktop visitor and more.

Knowing this data can be helpful in many ways. You can set your services accordingly and while designing your website you can take care of optimizing it based on their screen resolution and the device (e.g. mobile) they use to visit your site.

User Flow: What they do on your site:

This will help you to know about how your visitors navigate to your website once they landed. If they just leave your site from the first page means your bounce rate it high. Knowing this you can improve the contents of that page to lower down the bounce rate and encourage them to browse more pages by adding relevant links and so. Bounce rate means the percentage of the users who leave your site from the first page without visiting any other page.

When they visit your site:

Another important factor to know about the time of the day most of the visitors come to your site. Looking at the busiest hours, you can schedule to publish your contents in those peak hours to reach most of your audience.

Traffic Sources:

This will let you know about the source (e.g. direct links, referral links, thru search engines, from social media sites, email newsletters ) from where the user came from.

Not just the numbers but you can see the breakdown of traffic from each source. You can further drill down to find which search engine or which social media and referral site sent you how much traffic.

Knowing this you can focus on posting to the sites that sent you the highest or genuine traffic. You can also see if there are sites that sent huge number of spam visitors and take action accordingly. Blocking spam visits is important as it can have huge impact on your site’s SEO.

How to Install Google Analytics

Step #1 Sign Up!

First you need to create up your Google Analytics Account. Visit this link and click on the ‘Sign In’ at the top right corner; and choose Google Analyst from the dropdown options as shown below.

Google Analytics Signin

Next either you need to sign in with your existing account or click on ‘Create an account’ link.

Google Login Screen

Once you signed up or logged in to your existing account, visit http://www.google.com/analytics to visit your dashboard. If you can’t see a screen similar to the following, just click on the Google Analytics link as shown in previous screenshot to redirect you to the dashboard.

Once you are in dashboard, visit Admin section and make sure ‘Website’ tab is selected in the first option.

Analytics Dashboard

Step #2: Generate Tracking Code

Enter the information above and click on the ‘Get Tracking ID‘ button at the bottom of the screen. A tracking code will be generated as shown. Copy this tracking code as this is what you need to enter in your WordPress site. You can keep the browser window open in case you need some information later on while in the setup process.

Analytics Tracking Code

Step #3: Install Tracking Code in WordPress

There are many ways to install the tracking code either via plugin, or copy pasting in the template/theme files or via functions.php. Choose the one you feel comfortable with. Lets go through each of the methods.

Using Plugins:

Use of a plugin is the easiest and recommended way even for novice or non-developers. You can find numerous plugins for this purpose but here some that you can give a try:

  1. WP Google Analytics
  2. Google Analytics by Yoast
  3. Google Analyticator
  4. GA Google Analytics
  5. Insert Headers and Footers

If you are a geek, you can find the following methods useful as plugins sometime can hit the performance of your site.

Modify Theme Files:

Copy the tracking code (that you have generated in the above step) and paste it in your theme’s header.php file before the closing </head> tag. If you want it in the footer, then paste it in footer.php file before the </body> tag. The recommended method is to use it in the header.php file.

Modify functions.php file

For Advance Users Only: Use this if you have knowledge about how WordPress works.

To add the code via the functions.php file, add the following code to your active theme’s functions.php file and don’t forget to paste your tracking code you generated in the above steps.

<?php
// include GA tracking code before the closing head tag 
add_action('wp_head', 'add_google_analytics_tracking_code');
function add_google_analytics_tracking_code()
{ ?>
// Paste your Google Analytics code here
<?php } ?>

That’s it!! Now you have successfully installed the Google Analytics tracking code on your WordPress site. Allow about 24 hours before the stats start to appear in your Analytics dashboard.

Web Analytics Tutorial

What To Do If The Ownership Of The Website Or Blog On Google Webmaster Tools Is Verified?

Once Your Website Or Blog Is Owned By Google Webmaster Tools, You Will Be Able To Use All Its Tools Well For Web Analytics. As Soon As Your Website Is Added, It Will Also Provide You Daily Seo Reports Of Your Website. Like –

Search Queries

With This Search Query Section You Can Know About All The Keywords Of Your Website. In This, You Can Also Know The Search Pages, Ctr Of The Keywords, And The Average Page Ranking Of The Website.

Links

The Second Most Important Thing Is That You Can Get Complete Information About Your Internal And External Links In Google Webmaster Tools. These Links Are Backlinks To Your Website, So It Is Important To Place Them Correctly.

If You Feel That Your Website Has Been Linked To A Harmful Website, Then You Can Also Block That Harmful Link By Using The Disavow File.

Crawl Errors

Google’s Bot Is Always Crawling Your Website On Search Engine. In Such A Situation, There May Be Some Mistakes While Crawling The Links Of Your Website From Some Reasons, Then At That Time Google Webmaster Tools Provides You Information About Those Errors.

Keywords

It Is Similar To Search Query, But In This Option You Can Know About All The Keywords Of The Website Added.

Sitemaps

This Is Another Important Section That You Can Use From The Dashboard. Here You Can See All The Sitemaps Of Your Website. If You Have Not Already Added A Sitemap, Then Go To Webmaster Tools And Add Your Sitemap.

Details Can Be Found On The Dashboard Of Google Webmaster Tools About Many Other Things Like – Search Appearnce, Search Traffic, Amp Optimization, International Targeting, Blocked Resources, Robo-t.txt Tester, And Many Other Security Issues.

Leave a Comment

Your email address will not be published. Required fields are marked *