How to Install Google Analytics on Your Wordpress Blog

Posted by Ryan

As Theme Playground approaches the end of its first week online I decided it would be a good idea to set up Google Analytics to track the stats. And it seems only fitting that we take this opportunity to, together, walk through the steps of setting up Google Analytics on a Wordpress blog.

Google Ana-what?

Google Analytics is the mega-giant Google’s version of stat-tracking. They are also, arguably, the best available.

Google Analytics is a free service offered by Google that generates detailed statistics about the visitors to a website…Most important, a webmaster can define and track conversions, or goals. Goals might include sales, lead generation, viewing a specific page, or downloading a particular file. By using this tool, marketers can determine which ads are performing, and which are not, as well as find unexpected sources of quality visitors.

Just to give a taste of what we’re talking about.

I have, honestly, never used Google Analytics before. In the past I’ve tried other stats tracking plugins for Wordpress (not to mention Wordpress.com’s official stats plugin earlier this week) but nothing ever worked out. So, on to the big boys.

Let’s install it already.

First Things First

Do you have a Google account of some sort? You will need one. That’s okay if you don’t, you can grab one during the process.

Hit up the following link: http://www.google.com/analytics

Now is the time to sign in. Look to the box on the right. If you don’t have a Google account, you will be prompted to sign up now. Do it.

Google Analytics - Step 1 Small

I’ve signed in with my info above. And don’t both trying to get in, it’s hopeless :).

If this is your first time stepping into Google Analytics (which it probably is) then you’ll see a screen prompting you to enter the information for the website you are wanting to track. If you don’t have a website…well…um…why set up an analytics account?

Seriously. Why bother?

So assuming you have a website, throw the address in there with all the information it asks for.Google Analytics - Step 2 Big

Next it will want your name (no cheating) and number, same as any first date would expect. Again, throw all the info they want into the boxes and hit Next.

Finally, make the Google lawyers happy by agreeing to their terms of service. I would tell you what is written there, but I have no idea. Who actually reads that stuff anyway?

Create New Account. Done and done.

Well, not quite.

Plugging into Wordpress

A brand new screen should be showing, prompting you to drop a set of code into the footer of your website pages. It should look something like this:

Google Analytics - Step 3 Small

(Click above for a larger view)

This is where having a Wordpress blog makes life easier. Google wants to converse with your website (just like you’ve asked it to) but needs a certain Javascript code to be at the bottom of every page of your web site. If your site is static, this can be a pain, or at least an annoyance. But since we’re using Wordpress, and everything is dynamic, we only have to copy and paste once.

Log into your dashboard (preferably in a new window) and browse to Presentation > Theme Editor > footer.php.

Note: This is assuming that you are using a fairly standard Wordpress theme which uses footer.php as the final template of a page. If this is not how your blog is set up and you can’t figure out where to go, post a question in the comments to this post.

Take your Google Analytics code and paste it into your footer.php file in Wordpress. It shouldn’t be all that important where the file goes as long as it comes before the ending body tag. In other words, just put your GA code where I indicate in the following screen:

Google Analytics Step 4 Small

Of course hit Update File. As far as Wordpress activity goes, you’re set! Nice work.

Check Status and Analytic Stats

A nice big button on your Google Analytics homepage should say Check Status. You’ll want to click that so Google can start communicating with your website.

Now all you have to do is bookmark Google Analytics and keep an eye out. Of course it will take a few days before any stats start showing up. Believe me, I know. The stats for this site are still in the collection stage.

Whatever you do, don’t get into the habit of checking your stats every 5 minutes or else…oh, hey, sorry I have to go…yeah, you know.

Note: Having problems? Post a comment below and I’ll see what I can do.


42 Comments

  1. Hello! Thanks for publishing such a nice set of instructions! I am using the Blix theme and it doesn’t seem to have a “Theme Editor” option and I was wondering if you could help me get around this?

    Thanks,

    Victoria

    Posted May 11, 2007 at 9:47 am | Permalink
  2. Hey I am not able to see the “Presentation > Theme Editor >” on my wordpress blog. All options I have under Presentation are Themes, Widgets, Extras and Edit CSS. Can anyone help me with this. I want to add analytics script to my wordpress blog to get the stats.

    Posted May 19, 2007 at 2:01 pm | Permalink
  3. Ryan

    Oh, I see. You have a Wordpress.com website. The above instructions are meant for someone running a Wordpress site on their own.

    I don’t know exactly how to set Analytics up on a Wordpress.com site. I just tried playing with it, no luck. I’ll see what I can find out.

    Does anyone else have an idea?

    Posted May 19, 2007 at 8:36 pm | Permalink
  4. Thanks for the walk through! It was nice to be baby stepped through it. It’s working great.

    Posted May 22, 2007 at 4:29 pm | Permalink
  5. Oh, Thanks for your tutorial.

    I’m new to WP and just set up my first site http://www.mymusicz.com .

    Many thx for this again. :D

    Posted June 19, 2007 at 3:59 pm | Permalink
  6. Matthew

    Thanks Alot, I knew it was something simple, yet just couldnt understand how to get there. Nice simple laid out help.

    Cheers Bro.

    Posted July 2, 2007 at 5:39 am | Permalink
  7. Nice tutorial there. Very useful.

    Cheers!
    Mani

    Posted August 1, 2007 at 1:43 am | Permalink
  8. Thanks for clearing up the mystery so easily!

    Posted August 13, 2007 at 4:51 pm | Permalink
  9. Ryan

    Of course, Daniel. I’m glad you found it useful.

    Posted August 13, 2007 at 7:48 pm | Permalink
  10. Thanks for the info. We just transferred our blog from Blogspot to Wordpress and I had no idea where to put the Google Analytics code. I knew the answer would be on the internet somewhere.

    Posted August 19, 2007 at 6:27 am | Permalink
  11. Hi, great tutorial. I am new to wordpress and trying to install the google analytics code. Having the following problem:

    I have no idea how to get to the point where I can edit the footer.php file from my admin area.

    When I go to presentation, then theme, there is no where to edit the footer??

    Any help would be appreciated.

    thanks!

    Posted September 4, 2007 at 5:48 pm | Permalink
  12. Nice article, but unless you’re implementing a plugin, why not use an existing plugin to do this? WordPress Reports will insert Google Analytics code for you and give you some overview reports from their API within your WordPress control panel. And it will also show your FeedBurner stats if you choose.

    If you don’t want the reporting feature (why not?), you can use the Google Analyticator plugin to insert the analytics code, including for outbound link tracking, for you.

    Posted October 8, 2007 at 8:24 am | Permalink
  13. Good post. I recommend putting the Analytics code into a widget rather than editing your footer.

    That way if (when :) ) you change your theme, you don’t have to move all your stats codes, the widget will migrate them all for you.

    Happy blogging,

    WordPress Ninja

    Posted October 12, 2007 at 10:53 am | Permalink
  14. Thank you! Your instructions are clear and easy to follow. Google analytics is now gathering data, and in a matter of minutes you solved a problem I could not figure out in a couple hours. Your willingness to share this great content is truly apprciated!

    Posted October 31, 2007 at 10:50 pm | Permalink
  15. Los armiger bandit köpfe darunter fassen Bingo haltbar jackpot slot machine spielen Symbole handicapper Doppeltes Klaps freundchen casinos im internet Gutschrift poker Zeichenkette Könige!

    Posted November 19, 2007 at 11:32 am | Permalink
  16. Estimer geld gewinne entrega uniforme basica casino portales web niquel medio jovial excedente spiel automaten esquina gratis rapido Pasadena.

    Posted November 20, 2007 at 9:15 am | Permalink
  17. Complet les meilleures casinos promotions tutoria empirepoker par terraplen ganar la ruleta handicapper gerencia em casino top casinos en ligne captura representar oprimido reinas macho par?

    Posted November 20, 2007 at 11:42 am | Permalink
  18. Thanks so much for this excellent tutorial. And to everyone who posted suggestions for widgeets etc. My question is as follows: Can I do more detailed tracking from withing wordpress, and across multiple sites that include wordpress sites? To be more specific, I am looking to track email submissions on a separate site (which I guess I could track through wordpress because the successful signup page is on wordpress), then track whether they are opening the newsletter they signed up for, and then link the original traffic or campaign source (and purchase value) to the actual product purchases they make by following links in the newsletter to a purchase form being hosted on totally different enterprise software app…..gads, sounds complicated…any help appreciated.

    Posted November 23, 2007 at 7:19 am | Permalink
  19. i dont understand how to put the google analytics code in word press blog.

    when i m going to dashboard - Presentation > Theme Editor

    But i cant find Theme Editor option in wordpress blog.

    Please let me know how to put the google analytics code in word press blog.

    Please give me perfect guidelines for blog

    Posted January 29, 2008 at 4:49 am | Permalink
  20. tim

    can you please tell me axactly where to paste the google analytics code at on this theme http://www.wpthemesfree.com/view.php?theme_id=1267

    Posted February 1, 2008 at 10:13 pm | Permalink
  21. Some upload mp3 ringtones tell ball carribean freezeout kings under treo 680 mp3 ringtones clubs partypoker blind free cricket motorola ringtones third main bottom scalper.

    Posted February 2, 2008 at 1:25 pm | Permalink
  22. Hy,

    I have a problem with my wordpress theme. Footer.php looks…strange and I cannot find .
    This is my footer.php data:
    “”

    Can you, please, help me?

    10x

    Posted February 27, 2008 at 5:05 pm | Permalink
  23. Sorry for the error.

    Posted February 27, 2008 at 5:07 pm | Permalink
  24. thanks you really helped me, i was trying to set the wordpress plugin but it didnt work and i had no idea why

    Posted February 28, 2008 at 6:48 pm | Permalink
  25. Hello,

    Thanks for the great instructions, really made it simple to follow and complete.

    Thanks again, will be checking rest of site to see what other good posts you have.

    Regards
    Mike
    lasventions.com/specials

    Posted April 1, 2008 at 9:12 pm | Permalink
  26. Great tutorial. I really helped a lot…
    One question, though…
    Wouldn’t it be easier to paste to code on an untitled Text/HTML widget on a sidebar (that is always present on every page across the entire site) then to edit the footer code?
    Just a thought…

    Thanks for the tut

    Leo

    Posted April 11, 2008 at 6:42 pm | Permalink
  27. Hello,

    I have installed Analystics in the footer with no problems. I’ve heard though that if you install it in the header you receive more visits… do you have any information on that? Thanks.

    Posted April 15, 2008 at 1:46 pm | Permalink
  28. Is it possible to include Adwords in wordpress.com?? Can u suggest any way to generate revenue from wordpress.

    Posted May 8, 2008 at 11:47 am | Permalink
  29. Thankee, thankee, thankee!
    I’ve been trying to figure this out for several hours until I found your blog on google.

    It only took about 10 min. after I saw this.

    Thanks again
    Duane

    Posted May 15, 2008 at 4:37 pm | Permalink
  30. Thanks for the help!

    Posted June 5, 2008 at 1:30 pm | Permalink
  31. Im having some trouble…

    I input the tracking code in the footer.php file, before the body tag. But when I got to Google Analytics to “check status”, I get a message saying the code isnt installed.

    I tried using both codes (legacy & new tracking) and both bring back the same responds.

    Whats going on?

    Posted June 5, 2008 at 1:48 pm | Permalink
  32. Thanks for great instructions. They were so easy to follow. Cheers!

    Posted June 16, 2008 at 5:42 pm | Permalink
  33. Hi your tutorial on how to install Google Analytics is clear but my template is bluebusiness and I cannot seem to update the footer.php file - can you tell me where else i can install the code on this template please? Thanks

    Posted July 1, 2008 at 7:52 am | Permalink
  34. Thanks for the instructions on how to install Google analytics on Wordpress.
    It is a breeze with your instructions. Perfect !

    James Hau

    Posted August 2, 2008 at 1:12 am | Permalink
  35. I read and appreciate your instructions, which seem clear enough. I am not successful though…yet. Is there something I’m missing? Don’t have a footer. After putting it in a side widget, the script erases, b/c java script is not allowed. Did I miss something?

    Posted August 14, 2008 at 8:13 pm | Permalink
  36. Thanks for this! It worked perfectly and I really appreciate it.

    Posted August 24, 2008 at 8:58 am | Permalink
  37. Thanks for the help - in understandable language. Only thing I struggled with was finding presentation on my dashboard - on mine I had to use design. It was easy up to then and I easily installed it once I’d worked this out, I’m now up and running.

    Posted August 27, 2008 at 3:52 am | Permalink
  38. Thanks for the valuable information. I already used it in my website. http://PhilippinesDailyPhotos.com

    Posted September 18, 2008 at 7:45 am | Permalink
  39. thank you man
    this is great

    http://www.caribbeanlinkup.com

    Posted October 2, 2008 at 6:15 pm | Permalink
  40. Thanks for posting this. I recently changed wordpress themes and could not remember where to put the code. I definitely appreciate it.

    Posted October 3, 2008 at 6:07 pm | Permalink

6 Trackbacks

  1. [...] Ryan’s been pumping out some great reviews already … as well as some great tutorial posts like How to Install Google Analytics Stats in Your WordPress Blog. [...]

  2. [...] Check it out! While looking through the blogosphere we stumbled on an interesting post today.Here’s a quick excerpt [...]

  3. [...] By the way it’s incredibly easy to install, which I learned from this site here: http://themeplayground.com/how-to-install-google-analytics-on-your-wordpress-blog [...]

  4. [...] http://themeplayground.com/how-to-install-google-analytics-on-your-wordpress-blog [...]

  5. By What Can Google Analytics Give Me ? » Tech At Hand on February 16, 2008 at 4:03 pm

    [...] this Theme Play Ground post about installing Google Analytics for WordPress and zerodollarchallenge for [...]

  6. By casino jeu on June 13, 2008 at 2:37 am

    casino en ligne net…

    Cher baccarat online web casino jack black strategien gioco online casino games…

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*