Jan 22, 2009

Quick Introduction to Web Analytics for Bloggers

Summary

This post gives a quick introduction to popular free web analytics tools (Google Analytics, Microsoft AdCenter Analytics, FeedBurner Stats, WordPress Stats), how to set it up, and how web analytics works.

What is web analytics?

If you blog, you may be very interested in knowing:

  • who read your blog: the demographic, geographic, techno-graphic information of your readers;
  • what do they do on your site: what pages do they read, how much time do they spend on each page, how frequently do they come back etc;
  • how do they find your blog: referrals, keywords, search engines that lead people to your blog.

Web Analytics answer those questions, help you to better connect with your readers, improve your site, and motivate you to blog more. It is those who contribute information to the Web that have made the Internet so much useful.

After about 20 years of development, web analytics is now fairly mature and easy to use. There are many free web analytics tool on the Web, the most popular one is probably Google Analytics (GA):
Google Analytics

Microsoft has a free web analytics offering too, called AdCenter Analytics (ACA):
AdCenter Analytics

Besides those general web analytics tools, there are analytics tools for specific sectors, in particular FeedBurner Feed Stats for bloggers who publish blog feeds via FeedBurner:
FeedBurner Stats

And if you use WordPress, probably the best blogging software, WordPress.com has free blog stats:
WP Stats

How to set it up?

"OK, you've convinced me, so how do I get started?" You ask. Just follow below three simple steps:

  1. Open an account with an web analytics provider, like Google Analytics or AdCenter Analytics;
  2. Add the piece of JavaScript code from your analytics provider to pages in your site;
  3. Log into your provider's site and watch analytics roll in, or if you prefer, receive analytics reports via email.

The only tricky part is step two. Some blog providers don't allow JavaScript, like Windows Live Spaces, then you are out of luck there. For those providers do allow JavaScript, like Blogger and WordPress, or you host your own blog software, you have several options, for example:

  1. modify the html template directly
  2. use some widget/gadget that allow your add JavaScript code

I usually go with option two, because it makes it easy to switch/upgrade templates.

  • Blogger: use HTML/JavaScript Gadget, contain JavaScript for both Google Analytics and AdCenter Analytics

Blogger Html/JavaScript Gadget

  • WordPress: use Text widget, ACA only, since GA is tracked using Google Analytics for WordPress widget

WordPress Text widget

Please note: account code (UA-1234567-1, A1B2) in above screenshots are fake, to protect my privacy :-)

It is generally advised to use two or more analytics providers:

  • to verify data and possibly fix data discrepancies
  • to duplicate traffic history and avoid get locked into one provider
  • each provider usually offers some unique features, like AdCenter Analytics has better demographic data, FeedBurner gives subscriber stats.

How does it work?

For those curious minds, this is how web analytics works, over-simplified version:

  • The JavaScript code you add to your pages references a JavaScript file, like ga.js for GA, and msAnalytics.js for ACA. Those JavaScript files contain a whole set of JavaScript API's for web analytics. The code by default uses just one API, like GA's pageTracker._trackPageView(), or ACA's msAnalytics.TrackPage(). You can add other API calls for more sophisticated analytics scenarios, like msAnalytics.EnableLinkTracking() in above screenshot for tracking outbound referrals.
  • The JavaScript calls mentioned above generate http requests, usually for a 1x1 transparent gif, (those requests are also called web beacon), to the analytic provider's log servers. Those http requests contain a lot of information:
    • the web page on your site that issued the http request
    • the user who is browsing the page, usually identified by cookies
    • the machine and software the user is using in browsing your page
  • The web analytics servers have complex logic in analyzing and aggregating information from those logs, together with other online and offline information, and then produce the web analytics for your site, via web site, email, or API.

Below screenshots show some of those web analytics http requests in Fiddler and FireBug:

GA gif request in Fiddler

ACA xgif request in Fiddler

ACA x.gif request in FireBug

Conclusion

Hopefully this post will help those who haven't tried web analytics before to get started in using it. Happy blogging!