Where To Paste Google Analytics Code In WordPress

Easy to follow tutorial how to insert or put Google analytics code in your wordpress blog theme file.

Google analytics
is one of several ways to track your blog’s visitors, like, where they come from, which search engine brings you the most traffics, or which referral websites your visitors come from, and many more.


The most useful is you will know how many visitors you receive a day or some specific period of times. I added my blog to Google Analytics right after submitting my sites to search engines, like Google, Yahoo, Bing, and Ask. The result will usually show after a few days.

I have decided not to use any Google analytics plugins for this, because we can easily do it without plugin. Do remember, using too much plugins can slow down your page load, and sometimes buggy while upgrading your blog.

If you are using Thesis theme, it will be much easier, you just need to enter the code to tracking Thesis options.

So this is how i get Google Analytics code and paste it in my wordpress file or it will work for any html static websites too (I use twenty ten theme of wordpress 3 for this tutorial):

1.  Go to this URL: https://www.google.com/analytics/reporting/login and sign in with your gmail account.

Google analytics page.

2. Click “sign up” button.

Sign up for Google Analytics.

3. In “New Account Signup” type in:

-Website’s URL = www.yourwebsiteaddress.com
-Account Name = your web address by default, i left it as it is.
– Time zone country or territory = where you are at.
– Time Zone= Type in to suit your time.

Click “Continue”.

Type in your site's datas.

4. Next, type in your first, and last name, the country and click “Continue”.

5. Read the Terms and Conditions of Google Analytics, and after all ok,  tick “Yes, I agree to the above terms and conditions. Then hit “Create New Account” button.

Agree on Terms and Conditions.

6. If we did all correct, the next step is you will see your tracking codes. Copy all of the codes, and Go to your wordpress dashboard admin page.

Copying Google Analytics code.

7. Click Appearance/Editor and look for footer.php.

I personally paste the code in footer of my wordpress theme file, not in </head> as it shown in Google analytics page. Most people paste it in footer, and i never had any problems with having the code in footer.

Open up this footer.php file, and paste the code right before this code: </body>

Click “Update File”.

Where to paste Google Analytics Code in Footer.php wordpress.

Note: There are some theme files which provide you only to add the Google analytics ID, if your theme has this function, then just add the  GA ID which is displayed in your code too. (see image).

Some themes have a feature to paste only GA's ID.

8. Back to Google analitycs page, the last step, is hit “save and finish” button.

9. You will see the website profiles tables, and see your wordpress blog’s URL too. After a few days, check to see the report by clicking “view report” link.

View report of your website or blog.

That’s how i copy and paste Google analytics code to my wordpress blog, did you do differently? :)

Video Tutorial:

Share the knowledge
Share on Google+0Tweet about this on Twitter3Share on Facebook2Pin on Pinterest0Share on Reddit0Email this to someonePrint this page

Comments

  1. says

    For folks who tend to work a lot on our themes, using a plug-in like Google Analytics for WordPress 4 is best. That way we can avoid tracking our visits while previewing our theme/blog changes.

    • says

      Hey there Patrick,

      Thank you for the encouraging comment, and i am glad the tutorial was clear for you :)

      You have a great site, however you may want to fix the “I love the giveaway of the day” box, because the width is somehow bigger than your sidebar’s width.

      Cheers Patrick.

  2. says

    Hi, I’m glad I’ve found your site because I was just wondering lately how to paste it without downloading the plugin in wordpress. I know it could result to some slow if I will install a lot of plugins. Well, this saves my time. Hope it will take effect soon.

  3. gavin says

    Excellent – I was pulling my hair out how to get google analytics set up but you have made it really clear.

    nice one

    • says

      Hi Vivek,

      Yes, if we use those premium themes, we won’t need to edit any files, but not every bloggers have premium themes :-)

      I notice Twenty Ten is still loveable..

      Thanks for your comment!

  4. says

    very helpful, just submitted analytics to my blog according to this. but still the status is “tracking not installed” hope that will be ok within few hours or days

  5. says

    Thank you so much. The best detailed information I have found. Most people just say paste it in footer file without stating which line. I’m new to wordpress.

  6. says

    Thanks Kimi,

    Finally someone who gave me an answer on what I was looking for. Well explained with the snapshot of the steps to follow. A picture is worth a thousand words. I am using the twenty ten Red Theme and couldn’t find anywhere even in the vague instructions given in theme settings on where it went. I have the site since last fall and haven’t been able to add the analytics because I had no clue where to put it (for that theme). Usually it’s easy to insert it and find the portion of the header but for the Red theme it looks complicated to find. I was, I guess stubborn and kept believeing in putting it in the header. But if it works just the same in the footer then “COOL”.

    Thanks a lot…

  7. says

    Hi Kimi —

    I’ve paid for a .com domain through wordpress, and I guess that means it’s different from wordpress.org?

    Anyway, I don’t have the same screens or settings as you guys: if I open a widget called footer, I put in a text box so I can enter HTML and then I paste my code, with the at the end.

    However, I just get the garbled code showing up at the bottom of my webpage. I assume it’s not supposed to be like that. Any suggestions?

  8. says

    Thanks for the info that was dying to look for. :) But have a query. After I pasted it in the footer as per your instruction, will the analytics be made of every page of my website or only home page? May be a silly query but I am a complete novice in this field, so would love to know. Thanks in advance!

    • says

      Hi shreya,

      I also embedded in my footer in this blog, it will be used in every page of your site :)

      It’s absolutely not a silly question, have a nice week

      Kimi.

  9. hal says

    Hello….you posted this in July 2010 and it is still helping others…I found it very clear and precise……thanks
    hal

  10. says

    Hi there,
    Great tutorial, but I’m in the same boat as Alexander…sucks that WordPress doesn’t allow this if you are a .com. Balls. The garbled code that results in the footer doesn’t look clean so now what?

    • says

      Hi Alisha,

      Welcome to my blog, and yes, you are correct wordpress.com doesn’t allow the users using javascript, including adds and any affiliate links.

      If you are serious into setting up a website or a blog, I would recommend directly getting a webhosting, I used this webhost to begin blogging with this site.

      With this few advantages:
      1. Cheap PRICE. Costs only 4 bucks a month, it’s like a bottle of coke a month, and reliable. I know you will read some other reviews, but trust me, I used it for years and don’t have a complain or issues. I also use other hostings but they are more expensive so not very ideal to start your own blog unless you have a budget, but they also have same features.

      2. Free one domain name, other cost you extra for a domain name.

      3. You can monetize your blog for later use, or basically you have a full control of your site, no need to be worried to have hassles transfering or migrating your big blog once it is big.

      With your own webhosting, you can then install wordpress with this quick clear video: http://www.blog.web6.org/wordpress-versions/

      And you can add any plugins, themes, and any codes you prefer.

      I hope this helps

      Kimi.

  11. says

    I didn’t understand why you said we need to use the plugin?? adding code in footer.php is normal code modification method….i m bit confused about that!!!!

  12. Egami says

    hi Kimi
    thank u very much for this post, it saved me ..i just confused that the steps i have read in google analytics website after i made an account is that to paste the code in each page , ..i noticed u have have pasted it once in the footer .. can u explain to me this differance

    best regard

    • says

      Hi Egami,

      Yes, I only paste in the footer.php, since a wordpress theme is usually connected to footer.php file whenever it is opened.

      I hope this can help

      Thanks for visiting my blog,

      Kimi

  13. Sean says

    Hi,

    I do not see the footer.php option under “Appearance” in wordpress. Could you kindly help me. Thank you in advance.

    Sean

    • says

      Hi Sean,

      It can depend on the theme you’re using, you probably use a theme which has different file structure as the theme I used in this tutorial.

      You can use a plugin for this alternatively.

      Kimi.

  14. says

    Thanks very much Kimi. I was stuck for an hour figuring out how to paste my google-analylics code. Then, searched on google and found your post. You really made my day. Thanks again.

  15. says

    Thanks Kimi for this helpful tutorial on adding google analytic code, actually my theme had an option to add the code directly but some how it was not functioning properly. Let see how it works. Anyway thanks :)

  16. says

    Thank you very much for your clear and concise instructions! I am building my blog with relatively no knowledge of the internet, so websites like yours are extremely helpful!
    THANKS!

  17. doreen says

    thanks so much Kimi. Im glad i landed on your tutorial. youve just saved me hours of researching :)

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">