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


  1. Giovanni says:

    I pasted my Google Analytics code using Insert Headers and Footers, but the status of my tracking ID is still showing not installed. How long does this take to show it has been installed or did I do anything wrong?

  2. Molly Fabs says:

    I’ve added my tracking code to the header.php file of my theme (suits), by manually pasting it in. I’ve tried it right after the body tag, as you suggest, and also right before the close of the head tag, which I’ve seen advised elsewhere. (not pasting the code twice, just trying it in each location by itself). In both instances, my Analytics account says: tracking not installed. Any idea why GA isn’t seeing my code? Thanks in advance!

  3. Devesh says:

    I have created a blog on, but where will be paste code of google analytics in ?

  4. Jim says:


    I inadvertently have the Google Analytics script in my home page twice. Once put in by someone helping and another by a plug-in.

    I’ve been able to view/modify the HTML in the past, I think, I but can’t for the life of me find where to access the full HTML.

    I can see visual vs text but don’t believe that gives me enough of the HTML to modify/remove one of the Analytics scripts.

    I’ve also looked at Appearance>Editor but that seems to be about themes..

    I can see what I want to remove if I go to a “view source” page looking at my page from a web browser.. but can’t find it to remove it through WP.

    Any help would be appreciated.
    Jim H
    PS I am using a Genesis theme News Pro and Premise..

  5. Petia Warzel says:

    What theme is this website? BTW thanks for the article I just started my own blog.

  6. Amber says:

    Thank you for this! I have a question. Google analytics has me at 3 visitors and then 0 visitors where wordpress has me at 30 and 50 for those days. I did just start my blog. Why would GA not be picking it up? Thanks!

    • WPBeginner Support says:

      Amber, give analytics sometime. When you first install analytics there is usually a delay in reports.

  7. Becky Manuel says:

    I’m ready to paste my code, and you said do it after the body tag, but I’m not sure exactly where you mean. As in, hit return after I see the words <body >
    then paste?
    Or paste at the bottom of that whole block (which would be the end of the page) as the last item on the whole page?
    Please help thank you

  8. Bozo Pub says:


    thanks for the informative article. I’m interested in following:

    I had a website in Joomla, with already inserted analytics code. Now, I have created a blog in WP, with the same name, but with changed adress (now it have /blog in the extension).
    What is the procedure to keep running the existing code because I want to keep running my statistics record from previous site.


  9. Jerzy says:


    If the WP theme I’m using as a Google Analytics configuration already built in, I am correct in assuming that I don’t need to follow the 3 steps of pasting code in your tut above?

    Thank you.

  10. Kathrine K. says:


    Thanks for a wonderful guide!
    I was wondering what happens if I have my code in the header.php right before the ? I read another guide before yours, stating that this was where to put it.. That’s where it is now and my analytics seem to work?


  11. Jenna says:

    I installed the plugin but there was no settings page. Is there a certain area in the code that I paste the script?

    Thank you!

  12. Nishith G. says:

    I started it 1 hour ago and finished it now. Thanks to this beautifully crafted article that helped a newbie like me to finalize each and everything so smoothly.

    Waiting for the data to populate in GA dashboard now.

    God bless you Syed.

  13. Rosanne says:

    Hi, I downloaded the plug in and followed the directions listed, but on GA it still says that it’s not installed…I’ve given it 12 hours…Any trouble shooting ideas? I chose to paste the script into the footer and made sure I hit save after I copied over the script.

  14. Ronald says:

    I have just started building a new site on WordPress and am building it on my computer as a local host first before I transfer it over to an online host. What I want to know is can/should I activate the Google Analytics plugin now or wait until I have uploaded it to a online host.

  15. Lucia says:

    Thank you so much for these clear and detailed instructions. I did everything you said and it worked out great up until pasting the code into the header and footer plugin. Because after I do that, the code is actually visible in the header of my website. What am I doing wrong?

    Thanks for your support!

    • WPBeginner Support says:

      Lucia, you can try pasting the code using the direct paste method or use functions.php method.

  16. Norman Weathers says:

    I’ve just started a wordpress site at and need to track my traffic. Your advice is invaluable.

  17. Carlos says:


    Thanks for the informative article.

    I followed the instructions for however the Google Analytics still shows “Tracking Not Installed.”

    I pasted the code into the header and footer sections of the plugin settings. Am I missing something?



  18. David Jonsson says:

    do i need to put the analytics code on each blog post every time i post a blog?

  19. E.S. Ivy says:

    The headers and footers plug-in is really nice so that I don’t have to worry about messing up the rest of the code!

    I was wondering, am I right that this also means that a WordPress upgrade won’t make these changes disappear? I keep putting of learning how to make a child theme. :) And I think this was the one change I had made to my code previously. I forgot about it and then it disappeared with a WordPress update.

  20. Dave Jackson says:

    on a site I manage, I have installed google analytics but despite having visited the site using my phone so it is from a different ip address from where I am managing it, it still shows up as there being no traffic. How long after installing do I have to wait before I start seeing results?

  21. Hemant says:


    This article is really helpful, thanks for sharing. I am looking forward to read more articles in future. Keep writing!!! cheers.

  22. Paige says:

    I have recently switched from Blogger to WordPress and want to transfer my Google Analytics over. How do I do this?

  23. Dan says:

    I used the plug-in method to install google analytics, but it keeps saying that tracking is not installed. I copied the tracking code from google and pasted it directly into the settings for the plugin insert header and footer. Any suggestions for what I can do to fix it or any idea why it is not working? My website is
    The tracking code shows up when you do view source.

  24. Dan says:

    I used the plug-in method to install google analytics, but it keeps saying that tracking is not installed. I copied the tracking code from google and pasted it directly into the settings for the plugin insert header and footer. Any suggestions for what I can do to fix it or any idea why it is not working?

    • E.S. Ivy says:

      I was having this problem too. Not sure if it was just time, but I also have W3 Total Cache installed and it might have helped to empty the page cache.

  25. Craig says:

    How do I know if this has worked and is active?


    • WPBeginner Support says:

      Log in to your Analytics dashboard and from the top menu click on Admin. Select the account and property you want to check and then click on Tracking Info you will be able to see a status message like Status: Receiving Data

  26. Emmanuel Rosani says:

    Thank you for this awesome blog post! I’ve successfully installed Google Analytics to my new first WordPress site..


  27. zohar says:

    thank you, this was very helpful!! :)

  28. Heather says:

    very helpful! thanks!

  29. ahsan karim says:

    you are great man. I have no words to thank you

  30. Kat says:

    I have Google Analytics installed on my web site, and i’ve just created a folder area to house our new blog. Do I need a separate tracking code to track the blog statistics, or just install same site-wide tracking code through the header/footer plug-in? If so, where in Google Analytics would I view the blog stats specifically? Thanks for your help!

    • WPBeginner Support says:

      if your new blog is actually a separate website on its own, then you better create a new project in Google Analytics. If it is under the same website but in a subdirectory then you can use the same analytics code.

  31. Samantha says:

    Thank you, this was very helpful. I was really confused about how to get that code into “every page on my website” without going though a bunch of work, but that “insert header and footer” plugin is a really fast and easy way to do it! Thanks again,


  32. Carole Rains says:

    I have been using Google Analytics for about 6 months, but want to utilize the Demographics and Interests data. I keep getting a message that I need to implement a code change to allow that data to be accessed, but I’m not sure how or where to make this code change. Can you provide some guidelines please?

    • WPBeginner Support says:

      Carole when you first integrated Google Analytics in your website you would have inserted a piece of code somewhere on your site. Now you need to update that code and replace it with the new one.

  33. Stephanie says:

    If using the “Insert Header and Footer” plugin, should the Google Analytics code snippet be installed in BOTH Header and Footer or either?

  34. paola says:

    hi! when you add the code in the functions.php, is not missing a closing php somewhere?

  35. Brooke Muckersie says:

    Hi there, just one thing… is this an error in your post?

    “Direct Paste Method
    Copy the code that you received in Step 6, and paste it in your theme’s header.php right after the tag.”

    Shouldnt that be ‘before the tag.’ (not after)?

    • WPBeginner Support says:

      Brooke, yes it is right after the <body> tag not before it.

      • Hugh says:

        Doesn’t Google Analytics make asynchronous calls? I guess that’s why instructions say “Paste your snippet (unaltered, in it’s entirety) into every web page you want to track. Paste it immediately before the closing tag.”

        Yoast’s plugin Google Analytics for WordPress also loads the tracking code in the header

  36. vivek says:

    I used the plugin you recommended and i doubt that is it important to paste the whole Google Analytics code in both header and footer boxes?? or header is enough??

  37. Shiv Saroya says:

    As we all know Google Analytics has changed it dashboard like anything. day by day it becomes more user friendly. Nice post. Keep sharing like this.

  38. Ashish kausha says:

    it is nice and very helpful for me………..

  39. Hayley Reed says:

    Hi there
    I am using the header and footer plugin for GA in my wp blog and was wondering if there was any way to exclude pages such as the legal pages etc


    • WPBeginner Support says:

      By default header and footer are there on all pages in most themes and Insert Headers and Footers plugs the code into header and footer functions of WordPress.

    • Hugh says:

      You could try using filters (Admin > Views > Filters). A custom filter excluding the page title field may work

      Another option is including the GA code conditionally, of course, in this case you can not use a plugin

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.