Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

Comments

  1. Chaotic Kristy says:

    Thanks this helped me out a lot

  2. Adam Moustafa says:

    I tried the plugin and the direct method but it still says tracking not installed.

    From the google analytics plugin on WP i do get information, though. Any help would be greatly appreciated.

  3. Mahmudul says:

    Thanks for this helpful post :D

  4. Matthew P. Schneider, LC says:

    What are the advantages of this over Site stats using JetPack. I have a self-hosted blog but use WordPress.com statistics that are available in the JetPack plugin.

    • Editorial Staff says:

      Google Analytics is far more advanced and give you much more data. However for some beginners it can get a little complicated. Jetpack Stats give simple data, but its easy to use.

  5. Tiffany says:

    I can’t find my footer or available plugins. Is there a real step-by-step once you are in your wordpress blog ‘for dummies’? Help!

    • Editorial Staff says:

      If you can’t add plugins, then you are probably using WordPress.com. This will only work for self-hosted sites.

  6. TJ Ellis says:

    Amazing blog post it worked nicely! Thanks again

  7. Lanaya Green says:

    That is what it is about getting useful information thanks for the details it makes it so simple to have something you can follow step by step… Thank you rock on brother

  8. leo wolf says:

    Thank you for the clear stepwise description. I had already an account with Google Analytics showing the results on the website. Now I copied the script code in the functions.php, so far so good. Where and when can I expect the GA output now? Is it displayed in the footer?

    BTW: I don’t use a standard theme, but one built from scratch so maybe I miss something?

    Thnx in advance, Leo

    • Editorial Staff says:

      The output is not visible unless you view the source code of the page. You should see it towards the bottom in the source code.

      • leo wolf says:

        The title of this post suggests that you can have GA data at your site. But if is not visible, what’s the use then?

        • Editorial Staff says:

          Most tracking software will NOT make your data visible to the general public. Google analytics is a tracking software. You install it on your WordPress site, so you can get better insights about your audience. Google analytics works silently behind the scenes to capture data about your audience such as (what time they visited your site, who referred them, which pages they viewed etc).

  9. Louise Bibby says:

    Thanks so much for this info. It helped me overcome my paralysis with anything related to code. It was really useful!! Cheers Louise

  10. Alan says:

    Where do you get the code from step 6 if you do not get it the first time? I do not see it again when I log in.

    • Editorial Staff says:

      Login to Google Analytics. Look in the orange bar where it says Admin. Click on that. Under the accounts, click on the account that you want the code of. Under that account, you will see the property. Click on that property. There you will see a tab for Tracking info.

  11. Webbis says:

    This helped me a lot! But how do I do to measure my subdomains in the same account?

  12. Carly says:

    I wanted to do the paste. I made it to the footer.php page but there is no tag on that page so I can’t paste before it. What am I missing? Plus, I closed the Google page before reading your instructions not to do so. (I did copy the code.) Do I need to start over with Google? Thanks.

    • Editorial Staff says:

      No you do not. Just use the plugin we are recommending in the article above, and it will take care of it.

  13. Luis says:

    Thanks! The header and footer plugin helped me a lot!

  14. Naeem says:

    Thank you for this post.

    I am totally new in blogging and has recently set up a blog using wordpress platform.

    I have set up analytics account and paste the code using my theme’s option.

    Now my account is showing that tracking code installed.

    But the problem is in the audience section it is showing 0 visits while in the real time section it is showing 2 visitors.

    I am totally confused.

    ( My blog is under construction. Me and one of my friend is the only visitor. And I was unable to find single domain option. there are subdomain, mutiple top level domain options but no single domain option.)

    Can you please help me.

    • Editorial Staff says:

      The stats does take some time to be updated.

      • Michael Hickey says:

        I’m not at all sure what I am doing so perhaps you can help. Someone else that is not available now laid out my site. I was told to cut and paste the Google Analytics code one line below this last line of each page of my simple WP site. However, I cannot see where to do that for the Home Page. There is not a tab for the Home Page from the Dashboard. Any help is appreciated.

        • Editorial Staff says:

          Use our plugin that we mentioned, and it will add it on all pages of your site.

  15. Bob says:

    Does this plugin work retrospectively: that is to say, does it enter the the code into existing headers for pages that I’ve already developed on my WordPress site? I’ve put the script code in the header section and pressed save settings, but I’m not sure that that’s all I need to do.

    Any assistance would be gratefully received.

  16. Ameh says:

    Hi, great tutorial. Just one question. I have a desktop site and a mobile site. They both use different themes but have the same domain (www.dapopeyoh.com), so do i enter the google code in the footer.php file of one theme or both themes? Thanks.

  17. Saad says:

    Thank you so much for guiding me. I’ve completed and now waiting for 12-24 hours :)

  18. Omar says:

    I used the “Insert Header and Footer” plugin and pasted the google analytics code into the header in the settings of the plugin. I saved the settings and when I log into google analytics, the status is still “tracking is not installed.” Did I do something wrong and do I simply have to wait a while?

    • Editorial Staff says:

      If it is not working, then it means that your theme does not have wp_head(); in the header.php which is a standard for all WP themes.

      • Ryan says:

        So how would we be able to include the wp_head(); to the site?
        I have the same issue (I think) – tried different ways but tracking still stating not installed.

        • Editorial Staff says:

          It is supposed to be included in your theme’s header.php file in the head markup.

  19. David says:

    We have just started a WP blog as a sub-directory to our main site. We used the main site analytics code in the WP blog but I am not seeing any information about the pages visited in the blog. Should we create a separate analytics account for the blog sub-directory? If so, will that show us information about where visitors move from the blog to the main site?

  20. Monetsky says:

    Hi. Thanks for this tutorial. It simplified my life using the plugin to insert the code. I was wondering thoughif theres a way to get previous months data into google analytics? I only installed the code now and opened an account. Just wondering.. Thanks in advance. Great work!

    • Editorial Staff says:

      It cannot show you the data of things it didn’t track. The only way google can give you the data is if their script is on your page. Otherwise, they can’t.

  21. Bob Furber says:

    I followed the instructions to pate in footer.php, and the Tracking status shows “Receiving Data”.

    However, when I go to the bottom of the Word Press Dashboard, to the Google Analytics Dashboard Widget, there is a note:

    “You need to log in and select an account in the options panel.”

    On clicking the options panel or Settings -> Google Analytics Dashboard, I get the following error:

    “Error gathering analytics data from Google: GDatainsufficientPermissionsUser does not have any Google Analytics account. Please try again later.”

    The problem is later does not arrive and I can find no way out.

    • Editorial Staff says:

      The issue you are describing is with a specific plugin that you are using “Google Analytics Dashboard Widget”. You should ask that question in their support forum.

  22. Lisa - Une Belle Vie says:

    Hey, amazing that this is possible, but is google analytics replacing the normal wpstats ? Do you lose your views and information from that ?
    Thankyou!

    • Editorial Staff says:

      WP Stats is not a built-in WordPress plugin in self-hosted WordPress. Google Analytics is definitely a more robust platform.

  23. Lynette Chiang says:

    When you open Settings>Insert Header and Footer, there are two fields. You don’t specify above whether the code is to go in one field or both.

  24. marie says:

    My Google Analytical has stopped tracking and is showing all 0′s for the past week. Can you advise why?

    • Editorial Staff says:

      Is the code still added in your site? Did you change your theme? The only reason for it to be zero is if the code from your site got removed.

      • Savita says:

        My Google Analytical has stopped tracking and is showing all 0′s for the past week. Can you advise why?
        I looked in the footer if the code is still there, but I don’t remember what the code was or looks like (did not make a note of it so it seems…). It does not look good. So what can I do now?

        Above the in the footer.php it says:

        Thank you.

  25. vida says:

    hello
    my wordpress site is a free one and i don’t see any option for plugins. The site is http://www.lavidavidzi.wordpress.com i’m wondering if this url has the ability to add plugins. I can’t even find the footer option you’re referring to …am i even able to get google analytics ?

  26. Lauren says:

    How do I add a plugin? WordPress doesn’t let me edit my coding. I downloaded one of the plugins but how do I get it on my site?

  27. figz91 says:

    I tried to do this and lost everything, I think its because I put in the function.php coding in wrong but did it in the section where it said I was able to add in extra coding anyway.
     
    My site isn’t opening, neither my admin page to correct the problem it just says theres an http 500 error, I’m clueless and scared, is there anyway I can fix this problem? Please help.

    • wpbeginner says:

       @figz91 Yes, you would need to go through the FTP. Send us an email, and we can help you fix it.

      • Heidi says:

        The same thing just happened to me, please help me fix this asap!

        • Editorial Staff says:

          Heidi, you would have to use FTP to fix it. You are probably getting a syntax error because you pasted the code improperly.

  28. AdamCollins says:

    Aloha, so I signed up for analytics and placed the code in my theme options where there was a spot for my analytics built into the wp theme.  I also have a squeeze page on the blog. part of the domain and wondering do I upload the same code, or do I get another code?  Thanks so much.
     

    • wpbeginner says:

       @AdamCollins You can use the same code. Because that is on a separate page. You can see traffic by pages in Google Analytics.

  29. buckingham87 says:

    Yeh hi… i tried to follow all this and now i have lost everything! i cant even login to my admin page!!
     
    HELP

    • wpbeginner says:

       @buckingham87 That probably happened because you pasted the code improperly in your functions.php file. http://www.wpbeginner.com/beginners-guide/beginners-guide-to-pasting-snippets-from-the-web-into-wordpress/

      • figz91 says:

         @wpbeginner I’m having the same problem Buckingham is and I’m about to breakdown. Regardless of why it’s happening I need to get back my 4 years worth of content and I can’t even get to my admin page let alone the actual site.
         
        Is there anyway to fix this. I’m clueless and have no idea what to do. Please help.

  30. Pauline23 says:

    Thanks it worked great!

  31. Tommy Stuart says:

    What exactly does the following mean? I have a website that I put together compliments of Wealthy Affiliate University. Does that mean it’s a self-hosted or is it a free word press site?

    “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.”

    WHICH?

    • wpbeginner says:

      Go in your WordPress admin panel and click on Appearence > Editor … If you can edit all of your theme files, then you are on self-hosted.

  32. pradeepnairjc says:

    Very useful post. How should I add tracking in case I am using WordPress as a Subdirectory? For example- http://www.domain.com/blog.

    Do I copy -paste the same tracking code in the footer file or do I need to generate a new tracker code for this? I installed the analytics plug-in and configured it but somehow it never recorded visits although the data was being received successfully.

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.