How to Setup Google Analytics on WordPress

Google Analytics is a free web analytic service offered by Google which provides traffic stats of a website. It is a powerful tool which have now become the most widely used web analytic service on internet. The idea that it is free and its ability to integrate with other Google programs like Adsense and Adword make it even more beneficial. This article shows how to setup Google Analytics on WordPress.

How to Setup Google Analytics on WordPress

Google Analytics was originally developed from Urchin on demand software that Google acquired in 2005. Google launched its first branded version of Google Analytics in the same year. In 2006, Google acquired Measure Map by Adaptive Path and used its idea to redesign Google Analytics. In early day, the demand of Google Analytics was so high that it had to use lottery-type invitation-code model to distribute its service.

Google Analytics gives you complete analysis of your visitors and presents you with loads of valuable data. Here are the few things that you can keep track with Google Analytics :

  1. Track your visitors: Google Analytics can give the geographic location of your visitors. The important information like the name of visitor’s browser, their screen resolution, JavaScript support, flash support and language used can be found out using Google Analytics. These data can be used to increase the user friendliness in your website.
  1. Visitor’s activities: The average time span for which the visitor’s stay logged in and the bounce rate of your visitors are given by Google Analytics. You can make plans to increase the depth of page view and decrease the bounce rate.
  1. The time of maximum traffic: It also gives you the time when your website gets maximum traffic and the time when you have lowest traffic. You can set your posts and blogs to be published in the time of maximum traffic.
  1. The place where your visitors are coming from and going by tracking inbound and outbound links: By tracking outbound links, you can decide to remove the low value links and replace it with links to your best contents or to an outside blogger who has helped you significantly. Similarly with inbound links data, you can know which source is giving you more traffic. The sources can be direct links, referral links and search engines like Google, Bing, Yahoo etc. With these valuable data  you can take major actions like building a partnership with the website that is offering you more traffic.
  1. Check visitor’s interactions with your site: You can find your most popular and least popular posts by checking the number of views. You can also find the percentage of people clicking certain links of your site. The idea of keywords that visitors are searching in your site can help you add contents according to viewer’s demand.

How to Setup Google Analytics on WordPress

Google Analytics manual installation

Step 1. First you need a Google Analysis account. Sign Up for Google account in the Google Account sign Up page. If you already have a Google account you can choose to login.

How to Setup Google Analytics on WordPress

Step 2. After signing to google account you will be directed to  Google Analysis Sign Up Page. Click the sign up button on the right.

How to Setup Google Analytics on WordPress

Step 3. This takes you to the setting up account page. Since we are trying to track a WordPress Site, You need to select Website and fill up the form accordingly.

How to Setup Google Analytics on WordPress

After you finish filling the form click on the Get Tracking ID button at the bottom of the page. This gives a pop up window with terms and conditions. Select your location and click I Accept button. If for some reason you don’t see I agree button, drag the pop up window to top to find hidden buttons.

Also Read:   Generate XML Sitemap using Yoast SEO Plugin in WordPress

How to Setup Google Analytics on WordPress

Step 4. Now you are directed to the admin page where you are given the tracking code. The Tracking code is a very important piece of script code that you have to copy and paste in every webpages you want to track.

How to Setup Google Analytics on WordPress

Now lets move to the next step of installing Google Analytics.

Step 5. Login to your admin dashboard. Go to Appearance>>Editor

How to Setup Google Analytics on WordPress

There are two methods to paste tracking code in your website from editor page. You can follow any one of them

Direct paste Method: In this method you just paste the tracing code before the closing </head>  tag in your themes header.php file as shown in picture below. The header.php file can be found in the right side of the page in the templates.

How to Setup Google Analytics on WordPress

Functions.php Method: In this method you need to add the tracking code inside a function. The function is then hooked by add_action method to the footer of every page.

In the editor page find the function.php file in the right side. In side the php tag paste the following code.

add_action('wp_footer', 'add_tracking_code');
function add_tracking_code() {
// Paste your Google Analytics tracking code here
}

Inside the function paste the Google Analytics tracking code. And finally update the file.

How to Setup Google Analytics on WordPress

Google Analytics Installation using Plugins

If you are not comfortable using  above methods, then you can also install Google Analytics using plugins. In fact using plugins is the safest, most reliable and highly recommended way specially for beginners for performing web analysis. One of the popular plugin for installing Google Analytics is Google Analytics by MonsterInSights.

How to Setup Google Analytics on WordPress

You can easily find and install the plugin from the Admin Dashboards Plugin Page . Just go to Plugin > Add New and search for the plugin and install it. Next, you need to authenticate your Google Analytics account with the plugin. There are some basic settings and options that you need to configure. After the complete setups, you will start getting the reports and stats.

Web analytic tool is a basic necessity of all websites. The data offered by analytic tools like Google Analytics can make our website better and evoke us to be better marketers, skilled web developers and talented content writers.  If you have not used the Google Analytics yet, its prime time to take your website to next-level by start using it.

The following two tabs change content below.

Kantiman Bajracharya

Kantiman Bajracharya is a freelance web developer. He is a computer geek who has a Bachelor’s degree in Computer Engineering. He has earned lots of satisfied customers while working for numerous successful projects. He is also a WordPress theme creator and web article writer. On free time he likes reading philosophy books, traveling and playing chess.

Share This Post