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
  • WPBeginner Staff

    Give it at least 24 hours before your data may start showing up in your analytics account.

  • Concerned Citizen

    You refer to “Step 6″ a couple times but I cannot find a “Step 6″.

    • WPBeginner Staff

      Thank you for notifying us, we have updated the article. This is an old article rewritten several times since then to keep up with changes. The step 6 is actually step 4 now. Hope this helps.

  • Lumia

    Yes you can

  • Lumia

    Ask those who set up the page and installed analytics to grant you access…

  • WPBeginner Staff

    paste the code in header.

  • Amanda

    For the plug-in option, do you paste the code into the header or footer box in the settings?

    • Lumia

      Both works, but header is recomended for scripts

  • WPBeginner Staff

    Yes this is the tag.

  • JayMichaelsSDM

    You just saved me tons of time …ha! So simple

  • WPBeginner Staff

    its located under the main Settings menu in WordPress admin menu.

  • Ray Uotila

    Paste into the header, footer or both in the plugin settings?

  • Giovanni

    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?

  • Molly Fabs

    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!

    • WPBeginner Support

      Give it atleast a day.

  • Devesh

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

    • WPBeginner Support

      Devesh, this guide is for self hosted sites. Please take a look at vs guide to understand the difference.

  • Jim


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

  • Petia Warzel

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

  • Amber

    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

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

  • Becky Manuel

    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

    • WPBeginner Support

      you need to paste it immediately after <body> tag.

  • Bozo Pub


    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.


  • Jerzy


    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.

    • WPBeginner Support

      Yes, you can follow the instructions provided in your theme’s documentation.

  • Kathrine K.


    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?


    • WPBeginner Support

      If it is working, then it is good.

  • Jenna

    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!

  • Nishith G.

    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.

  • Rosanne

    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.

    • Crissy

      I had the same problem. I’ve tried other plug ins and they didn’t work either.

  • Ronald

    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.

    • WPBeginner Support

      Wait until you upload it online.

  • Lucia

    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

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

  • Norman Weathers

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

  • Carlos


    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?



  • David Jonsson

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

    • WPBeginner Support

      No you don’t. If you paste it correctly then it should track all your website.

  • E.S. Ivy

    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.

  • Dave Jackson

    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?

  • Hemant


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

  • Paige

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

  • Dan

    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.

  • Dan

    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

      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.

  • Craig

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


    • WPBeginner Support

      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

      • Debbie Pugh-Jones

        I have a site Can I use Google analytics on this as I read somewhere that you couldn’t.


  • Emmanuel Rosani

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


  • zohar

    thank you, this was very helpful!! :)

  • Heather

    very helpful! thanks!

  • ahsan karim

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

  • Kat

    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

      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.

  • Samantha

    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,


  • Carole Rains

    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

      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.

  • Stephanie

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

    • WPBeginner Support


  • paola

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

    • WPBeginner Support

      Paola, functions.php file does not have a closing php tag at the end.

  • Brooke Muckersie

    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

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

      • Hugh

        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

  • vivek

    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??

  • Shiv Saroya

    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.

  • Ashish kausha

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

  • Hayley Reed

    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

      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

      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