Free Wordpress Blog Setup

How to Install Google Analytics in WordPress

By Editorial Staff in Beginners Guide
How to Install Google Analytics in WordPress

Great site statistics is probably the single most important success factor of any website. The best way to know your audience is through your traffic stats and this is what Google Analytics provide for FREE. In this article, we will share why Google Analytics is important, and how you can install Google Analytics in your WordPress blog.

Why is Google Analytics Important for Bloggers?

Google analytics allow you to keep track of:

Who visits your site

This part of analytics answer what is the geographical location of your audience, which browser did the user use to visit your site and many other important information such as: screen resolution, JavaScript support, Flash support, language and more.

This data is extremely useful, and it can help in numerous ways. When getting a custom design, you can use the user data to make sure that your site will be compatible with your audience. If most of your users does not have Flash support, then you should avoid adding flash element to your site. If most of your users are on 1280 screen resolutions, then make sure that your design is compatible with that resolution or smaller.

What they do when they are on your website

You can track where the user is going on your website. How long do they stay on your website, and what is the bounce rate (the percent of users exit your site on the first visit) on your site. By using this information: you can decrease the bounce rate and increase the depth of pageviews.

When they visit your website

By looking at the hottest hours in the day for your site, you can pick the time when you publish your post. If that time zone is not compatible with yours, then you can schedule your post to meet that hour.

Where did they arrive on your website from

This section of the analytics show you where did the user came from: Search Engines, Direct Links, Referral links from another site. It shows you what percentage of your visitors came from each of these sources. Google analytics also gives you the break down of each of these categories. If it is the search engine category, then it shows you which search engine got you the most traffic, google, yahoo, bing etc. It will also show you the most used search terms by visitors, so you can improve your ranking for that keyword (Check out our Must See SEO Guide for All WordPress Bloggers). The break down of referral sites show you which sites you need to work with the most. If your top referral source is twitter, then you need to have exclusive twitter content to make your twitter audience feel special. If your top referral source is an external website, then you might want to consider having a partnership with that website (link exchanges or something else).

How they interact with your site’s content

Google analytics show how your users interacted with your site’s content. It shows you what percent of the user clicked on which link on your site and much more. By seeing the user interactivity, you can work your content around your users.

By seeing the answers to the questions above, you can focus on the strategies that work for your site and eliminate the strategies that don’t work.

How to Signup with Google Analytics

First you would need to create a Google Analytics account. To do this, visit Google Analytics Signup Page.

You will see a screen like the one below. If you already have a gmail account, then use that to sign-in with. If you do not have a gmail account, then you would have to create an account for yourself.

Step 1 for Google Anayltics Signup

Once you sign-in with your gmail account, you will be prompted to a screen like the one below. This is where you will signup for google analytics with your gmail account.

Step 2 for Google Anayltics Signup

The third step would be to enter your site information. The fields are pretty self explanatory. You enter your Website’s URL, Account name (it can be anything that you like), Time zone country, and the time zone.

Step 3 for Google Anayltics Signup

Step 4 requires you to enter your contact information.

Step 4 for Google Anayltics Signup

Step 5 would require you to agree with their terms.

Step 6 is where you will receive the code to paste in your site. This is the important part of the signup. Copy and paste this code in a notepad or a HTML editor and keep this screen open.

Step 6 for Google Anayltics Signup

How to Install Google Analytics in WordPress

There are 3 ways to install Google analytics in WordPress. Direct paste, functions.php, and plugins.

Direct Paste Method

Copy the code that you received in Step 6, and paste it in your theme’s footer.php right above the </body> tag.

Functions.php Method

Add the following code in your theme’s functions.php file and don’t forget to paste your Google Analytics code from Step 6 here.

<?php
add_action('wp_footer', 'add_googleanalytics');
function add_googleanalytics() { ?>
// Paste your Google Analytics code from Step 6 here
<?php } ?>

Plugins Method

There are tons of plugins available to add Google Analytics to your site. The two that we recommend are:

Google Analytics for WordPress by Joost de Valk
Google Analyticator by Ronald Heft

Once you have installed Google Analytics in your site, you can go back to the screen from Step 6 and click Save and Finish. Then you will be taken to the overview of your site’s analytics.

Step 7 for Google Anayltics Signup

You can see the status have an exclamation work. This just means that Google hasn’t realized that you have added the code to your site. It takes Google upto 12 – 24 hours to start providing you with the awesome site stats that you need.

This is a must have for every blog, so get it now. If you have any questions then feel free to ask in the comments. If you like this article, then please share it with your friends on twitter and facebook.

Note: This is only for Self-Hosted WordPress.org blogs. Free WordPress.com sites cannot use Google Analytics. Maybe it’s time to upgrade from free WordPress.com to Self-Hosted WordPress? Consider using our Free WordPress Blog Setup program.

What Next?

Digg it
Save This Page
Subscribe to WPBeginner
Stumble it
Free Wordpress Blog Setup

Comments

12 Responses to “How to Install Google Analytics in WordPress”
  1. Saikou marong says:

    Great tips for a newbie like me i will certainly try it now. The beauty of WPress is that it has a very little limitation.

  2. Eden-Avalon says:

    I just switched over from an entirely hand-compiled website to one using wordpress. This will be most helpful. Thank you!

  3. This is one of the few features I did use a plugin for, even though it can definitely be achieved manually be pasting the code as you explained, thanks for sharing.

  4. Would love to know your thoughts on which method you recommend for installation. Such as are there advantages to placing the code by hand vs. using a plugin?

  5. Brandon C. says:

    i wish i had seen this tutorial before i spent three hours trying to figure it out on my own.

  6. Jan Kasal says:

    Step 5 states to paste the code above the body end tag. Google has changed it since. It goes above the head. Just to let you know.
    Jan

    • Google has not changed anything… All companies would like to have their scripts added in the header << But it is not wise for the webmaster. Any smart webmaster / developer would keep scripts like analytics in the footer to speed up the load time…

      WPBeginner has the codes in the footer. Twitter.com has the code in the footer and many other sites as well.

      • physio says:

        Ok… apparently the commenting system doesn’t like angle brackets. That second paragraph should have said:

        If you want more accurate analytics you will use the new snippet version and you will put it in the head. If you are paranoid about page load times you will put it just before the close body tag.

  7. Jeremy says:

    I’m thinking about going the plugin route – do I need to use both plugins or one or the other?

    I know that the “Google Analytics for WordPress” asks me where I want to embed it but then then “Google Analyticar” doesn’t ask anything about embedding so I’m wondering if it does it or if I have to do something manually…

    Thanks for this walk through!!!

Share Your Opinions

Tell us what you're thinking...
and if you want a pic to show with your comment, then get gravatar!

Please make sure that you have read our Comment Policy.

Due to high volume of request from our readers, we are adding this feature that allows you to stay updated with this post's comments without having to participate in the discussion even though we would love your input as always. Don't worry we hate SPAM just as much as you do, so you will never receive any SPAM messages from our site and that's our promise to you.

Subscribe without commenting

Close Bar