Setting Up Google Analytics on Your Site

September 20th, 2009 by Gage Pacifera

Note: This post is one of a series of posts that breaks out the individual topics of my presentation “Pimp My Web Page” given atWebVisions 2009. You can see the fully pimped page that includes the code detailed below at http://pimpedblog.harmonicnw.com. Code tested for XHTML 1.0 Strict pages on IE 6 and 7 for PC, Firefox 3 for PC/mac, Safari 4 public beta for mac.

Tracking site statistics through Google Analytics is remarkably easy. Basically you just sign up for your free Analytics account, then paste some provided JavaScript code into the bottom of your page. Simple! To get going, follow these steps:

  1. Create a Google Analytics Account (www.google.com/analytics)
  2. Complete signup process, copy tracking code
  3. Paste the code just above </body>

You can check out a good video tutorial here.

Notes

Don’t expect the stats to start working immediately–there’s about a 24 hour lag processing data.

Also, Google Analytics doesn’t track file downloads by default, just page views. To track downloads you can add a JavaScript file from here that enables this functionality.

Posted in HTML, Web Development, WebVisions

Back to blog home