You are here: WordPress Video TutorialWordpress TutorialWhere To Paste Google Analytics Code In WordPress

Where To Paste Google Analytics Code In WordPress

by Kimi on July 25, 2010

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

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:

Subscribe new tips via Email:

Was the post helpful? Share it to help others with:

{ 28 comments… read them below or add one }

Udegbunam Chukwudi August 1, 2010 at 11:39 am

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.

Reply

Dina August 2, 2010 at 11:54 am

@Udegbunam Chukwudi, Thanks for the suggestion.

Wordpress 4? or is it the name for the plugin?

Reply

Udegbunam Chukwudi August 2, 2010 at 1:42 pm

You’re welcome. The name of the plug-in is Google Analytics for WordPress 4

Reply

Patrick@InternetMarketingBizBlog.com November 4, 2010 at 5:50 pm

Hi,

An awesome blog with clear step by step directions to help showing how to put Google Analytics code and paste it in the wordpress file
with ease.

Thanks for the clear directions.

All The Best,
Patrick Lim

Reply

Kimi November 4, 2010 at 6:54 pm

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.

Reply

someone@aymmarketer November 23, 2010 at 2:28 pm

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.

Reply

Kimi November 23, 2010 at 3:58 pm

Thank you for leaving a comment!

Glad it saved your time.

Reply

Ben Gold December 17, 2010 at 4:34 pm

Hi,
I’ve recently started a blog, the information you provide on this site has helped me tremendously. Thank you for all of your time & work.

Reply

Somename@analytics code January 5, 2011 at 5:52 am

Great blog.And I just want to say thanx to you for awaring me
about the new and revised things about google.

Reply

someone@analytics code January 14, 2011 at 5:08 am

Thanks, really helpful. Even though Google has made it more complex these days, I was still able to follow this really easily and get it working. Awesome.

Reply

vadakara January 18, 2011 at 8:32 am

hi , this is very helpful, really appreciating your attempt

Reply

gavin January 18, 2011 at 8:11 pm

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

nice one

Reply

Vivek Parmar February 9, 2011 at 8:28 pm

well i’m using thesis theme and headway + catalyst on my blogs and i do not need to edit any of the files

Reply

Kimi February 11, 2011 at 7:25 am

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!

Reply

Cveta February 17, 2011 at 8:03 pm

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

Reply

Alec March 12, 2011 at 12:42 pm

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.

Reply

Kimi March 13, 2011 at 8:23 am

Most Welcome, Alec!

Glad you found it easy to follow :-)

Thanks!

Reply

Jean March 18, 2011 at 3:21 pm

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…

Reply

Kimi March 18, 2011 at 4:16 pm

Most welcome!

Reply

Dustin June 9, 2011 at 6:17 pm

First blog clearly explaining step by step and not missing stuff. Thanks!

Reply

Alexander Heyne July 28, 2011 at 4:52 am

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?

Reply

shreya November 7, 2011 at 11:08 am

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!

Reply

Kimi November 7, 2011 at 6:33 pm

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.

Reply

hal November 26, 2011 at 5:32 am

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

Reply

Alisha January 18, 2012 at 10:21 am

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?

Reply

Kimi January 21, 2012 at 11:48 am

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.

Reply

Ismail January 23, 2012 at 10:31 am

HOW DID YOU FIX THE MOVING BUTTON?;….. E.G FOLLOW,SHARE, COMMENTS ETC…. KINDLY INFORM ME AT CONCEPTUAL92@GMAIL.COM

Reply

pawan negi February 2, 2012 at 6:28 pm

thanks for such a usefull post it solve my problem in a minute.

Reply

Know better? Feedbacks, or Questions? Shoot! :-)

Please use a name instead of blog name or SEO stuff, otherwise it will be deleted right away.

About checkbox → See more my post:how to get rid of spam bots in wordpress post.

Thank you for visiting, you're always welcomed to be here again!

Previous post:

Next post: