I love Google. They represent so many positive ideas about technology and offer an amazing suite of tools. Gmail is fantastic. I adore Google Calendar. Google Scholar is the only site I need for research. Google Reader is the best RSS feed reader on the market. Google Docs works a like a charm and is infinitely handy. I have entrusted my workflow to Google and had positive results. They’ve taken over the heavy lifting and ushered in an era of browser-based productivity that I agree with wholeheartedly. I’m excited today to use yet another Google server: I added Google Analytics to the site :)

In last week’s Introduction to Usability course we discussed good and bad websites, and one student selected Google Analytics as a good website. The Analytics page provides all the necessary statistics on your sites traffic including their IP address and corresponding location, the number of unique visitors, and timing. It was characteristically Google: clean, easy to use, and hugely useful. I had no idea the service was free!

Inspired by the class I checked into Google Analytics further and signed up. I added http://www.sethholloway.com to the service and they generated the necessary javascript–they even told me where to place it (though I already knew enough HTML to insert the scripts)

Here’s the generated javascript:

<script type="text/javascript">
  var gaJsHost = (("https:" == document.location.protocol) ?
                   "https://ssl." : "http://www.");
  document.write(unescape("%3Cscript src='" + gaJsHost +
                          "google-analytics.com/ga.js' 
                          type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
  try {
    var pageTracker = _gat._getTracker("UA-7555904-1");
    pageTracker._trackPageview();
  } catch(err) {}
</script>

And the only change necessary to gather statistics from across the blog is contained in header.php. From your WordPress admin panel click Appearance->Editor->Header (header.php). Then locate this bit of code and insert the generated code where I placed the comment below:

<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>

<?php wp_head(); ?>

//PASTE GOOGLE ANALYTICS CODE HERE AND REMOVE THIS LINE

</head>
<body>
<div id="page">

That’s it! So simple! So useful! If you haven’t already signed up for Google Analytics, do it now. The service is free, incredibly helpful and easy to use; even better, installation will take you less time than heating up that Hot Pocket!