Choosing how to track

Simple, private, self-hosted, cookie free website analytics...one day...maybe

Choosing how to track

I’ve been trying to work out how best to do the tracking.  There seem to be two options:

  1. Request a resource using CSS or an image
  2. Make a JS call

The main disadvantage of the CSS/image approach is that it won’t be able to send a referrer so we won’t be able to see where the page that was loaded was accessed from.

There may also be a performance hit as the request might not load asynchronously. I’ll have to do some testing with this.

The JS method requires JS to be added to the site and loaded, BUT, it will allow the referrer to be passed on. (I’ll have to work out how).

There’s also a question about bots.  One slight advantage of JS is that it will not track bots that don’t use JS.  What I don’t know is do the bots that fail to load JS also fail to load other resources?  Will a crawler hit the tracking endpoint if CSS or an image is used?

I think I’ll probably end up offering both options. With the JS as an enhanced version if you want to implement it.