Monday 21 October 2013

Stalker tendencies? It's OK - they're more acceptable online

This post explains the what, why, and how of adding Google Analytics to your website, and supplements my post from a couple of days ago (here), on creating your own site for free. It is followed by a post on Favicons, Widgets, and QR Codes (here).

Google Analytics watches your site's viewers. It can seem a bit creepy at times: not only will it tell you how many page views your site is getting, along with some nice graphs and charts to help you see whether interest is growing or waning, but it'll tell you a bunch of other information too. What web browsers (Chrome, Firefox, Internet Explorer, etc) your viewers are using, what their operating system is, what language they speak. What country they're from. What city they're from. If you install the Henry Higgins 3.0 BETA plugin, it'll place viewers within two streets.*

Furthermore, it'll tell you how long people spend on your site, how long they spend on each page, which pages they visited, which site they entered your site from. And more. In fact it inexplicably brings to mind the saying that a jealous woman with Google is far more effective and dangerous than any FBI agent.



An example of what the main Analytics page looks like. Screenshot stolen from kaushick.net

So whatever the size or popularity of your site, you'll probably find it useful to know how many people are actually looking at it, and how they're discovering it. (One example is if you post a link of your site in a Facebook or Twitter update, you can see how many of your followers actually bothered to click the link). Google Analytics provides excellent support for tracking more than one site as well, and it's very easy to set up. A simple matter of pasting some javascript, which Google provides, into the source code of your website.

As to actually setting it up, I'm not going to go into detail. All the instructions are on the Google Analytics site. Just head over to http://google.com/analytics to get started. (You do need to have a Google Account, which you already have if you use Gmail, YouTube, Picasa, or any other Google services).

The actual code you will get given looks something like this


<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-0000000-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>


And you simply paste the whole chunk into your HTML source file (on every page if you want to track them all). It's recommended that you put it at the bottom of the <header> section.

So that's Google Analytics. Happy stalking! If you order your website through Websited, I'll implement Google Analytics for you as a free optional extra! 


* OK, the part about the street is a joke. If you don't understand the reference, do yourself a favour and read the best play ever written (here). The rest is true.

No comments:

Post a Comment