How to Set Up Google Analytics for WordPress

[This post is part of the WordPress Guide for Beginners – Step by Step Tutorials]

Google  Analytics is the best & free tool to track your site stats. It will tell you who is visiting your site, from where they are visiting, how long they stay your site, which pages they are visiting, how they interact with your content etc.

If you want to know more about your site visitors, their demographics and behaviors, then you should consider using Google Analytics.

Google analytics and wordpress

In this post I will show you how to sing up for Google Analytics and how to set up GA on WordPress blog.

How to Get Started with Google Analytics

The first thing you’ll need to have a Google Account.  A Google Account provides access to all Google’s products like YouTube, Gmail, Google+ etc. If you don’t have a Google account then get one here.

1. Once you’ve signed up for your Google Account, go to Google Analytics and Click on ‘Sign In’ .

Sign In to Google Analytics

2.Then you’ll be landed to a new page. If you are logged in with your Google Account, you’ll see the screen like this.


Now click on ‘Sign Up’ button.

3. Then it will ask you ‘What would you like to track?‘ and to ‘Select a tracking method‘. I think default setting is OK for you. Just make sure that it selected  Website tab and  checked Universal Analytics BETA. (Follow screen shot)

Tracking on Google Analytics

4. Now move to the ‘Setting up your web property‘. On those fields, enter your Web site name, Website URL, Category and timezone.


5. Now enter your account name (it could be the name of your blog) and click on ‘Get Tracking ID‘ button.


Then a pop up will show the ‘Google Analytics Terms of Service Agreement’. Click on ‘I Accept’ button if you are agree. Now it will ask you to paste the tracking code to your site.


Keep this screen open.

How to Install Tracking Code to WordPress

Now login to your WordPress Dashboard. Follow any of the options that seems easy to you.

Option #1

If you are using WordPress Premium theme, then it may have an option like Google Analytics Tracking Code or Google Analytics Tracking ID in theme’s General Setting.

In case of Tracking Code, you have to put the full tracking code there. (Ex:<script> Codes</script>)

For Tracking ID, you have to enter the Tracking ID only. (Ex: UA-4*****84-1)

Option #2

If you don’t find the above option you can use All in One SEO Pack Plugin to track your site with Google Analytics.

Once you’ve installed the plugin, Go to All in One SEO (Under dashboard) > General Setting > Navigate to Google Setting and enter the Tracking ID on ‘


Now navigate to bottom and click on ‘Update Options’.

BTW there are a lot of Google Analytics Plugins to track your site. You can use them too. But I prefer using All in One SEO plugin because it is one of the best plugin for WordPress SEO.

Option #3

Note: Make sure you back up your WordPress blog before doing it.

How to Set Up Google Analytics for WordPress 1

If you don’t like to install plugin to do that, you can do it manually by adding the tracking code in header.php file. From your dashboard, go to Appearance >  Editor. Then select header.php from right side. Now find the < / head > tag and paste the tracking code before closing < / head > tag.


 And click on ‘Update File’.

How to Make Sure Code is Installed Properly

Now go back to your Google Analyics, Click on Admin from upper right.

Select your account and click on ‘Tracking Info’.


Make sure that Status is shown Tracking Installed.   Sometimes it takes few minutes to track your site.

How to Add New Site to Google Analytics

If you’ve more sites you can them to Google Analytics.

To add new site, Click on Admin from upper right of your Google Analytics account.


And click on New Account.

Other procedures are same. For any kind of help, you can check the Official Analytics Help page.

Read: How to Submit your Blog Google Webmaster Tools

Hope this post helps you to install Google Analytics in your WordPress blog. If you face any difficulties, feel free to ask us via comment. And don’t forget to subscribe our blog to get regular updates.

11 responses to “How to Set Up Google Analytics for WordPress”

  1. Siobhan du to it Avatar
    Siobhan du to it

    I’m trying option 3 but under dashboard and appearance I don’t have editor… Help?

    1. Istiak Rayhan Avatar
      Istiak Rayhan

      It seems that your theme doesn’t have the editor option. Try any of these plugins:

  2. fahim mahmud chisti Avatar

    i completed add my word-press blog Google Analytic for see your article but whats plugin batter for word-press
    (seo by yoast) or (All in One SEO Pack ) which is batter

    1. Istiak Rayhan Avatar
      Istiak Rayhan

      Here at RoadToBlogging, I am using All in One SEO Pack.

      1. Rajesh Rao Avatar
        Rajesh Rao

        I saw the seo by yoast being suggested by wordpress guys themselves.

  3. Vk Verma Avatar
    Vk Verma

    Hi.. i read ur article… this is very interesting… but i have one for step, anlytics code can be paste in Text widget also.

    1. Istiak Rayhan Avatar
      Istiak Rayhan

      I didn’t know it could be done such way. Thanks for sharing.

  4. Rahul Pahal Avatar
    Rahul Pahal

    Nice step by step guide for installing Google Analytics. Snapshots make it more comfortable to understand. It will definitely help out the newbie bloggers.

  5. seo company Avatar
    seo company

    i think all in one SEO pack is best option to install analytic. i used this and i also use wp editor

  6. Raplus Avatar

    Hey Istiak,

    I think that Option #3 is the best option because we can use option #3 for any theme.

    Try Histats also. It is the best alternative for Google Analytics. Sometimes, it is better than Google Analytics.

    1. Istiak Rayhan Avatar
      Istiak Rayhan

      Yeah, options #3 is the best option if the user knows what he/she is doing.

      Never tried Hitstats. But I found Clicky useful.

Leave a Reply

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