Is Google Analytics really that slick?
What I liked about GA
There is a few things I like about GA. It can tell me
- Where my visitors are from
- How they got to my site
- The path they took through the site
- Whether they use a mobile device
- Whether they are a new or returning visitor
- How long they stayed on pages
How I cut out GA and still have all the metrics I need
Those 6 core metrics are actually pretty easy to record. IP address information, referals, and the User-Agent are all possible to determine from the headers. While each of these things is trust-based, as a user could set the headers to whatever they feel like, most folks are using a browser and browsers tend to respect convention. This information alone, all tacked on to the header, is enough to provide answers for 1-4.
The 5th question can be answered with a simple long lasting session cookie. The 6th is hard to answer conclusively no matter what. Information about the DOM helps to create a better answer for this question, but clickthrough rate is possibly equally useful.
So if these metrics can be obtained without running 3rd party code on a site, why does everyone do it? I believe it's the pretty graphs and charts. Nice user friendly dashboards (even one's that we should admit don't tell us all that much) are nice. My next step will be to build a killer dashboard for my site. When I do, I'll let you know.
So how exactly are you tracking me?
The way I track users is effective but primitive. If you are a new user to my site, you'll access a page of the site and your browser will not send any cookies. My server will see that and so along with the webpage you requested, it will send back a cookie with the suggestion that your browser store it. I do this by setting a Set-Cookie header on the response. My Set-Cookie response header looks something like this.
Set-Cookie: ooh_so_tasty=PhyllisBeverlySealPage9120; Expires=Wed, 01 Jan 2116 23:00:00 GMT;
If you haven't set your browser to do differently, it will remember this cookie is associated with my site, and pass it along with every request to my site for the next 100 years (when the cookie will finally expire). I will keep a record of you, PhyllisBeverlySealPage9120, and with it store information about you -- your ip address, User-Agent, and whether or not you are on a mobile device. I will also store each 'event' you engage in. This will include the page name, time fetched, and referral page. Using this information, I can create effective visualizations of traffic on my network, whilst allowing my guests to remain personally anonymous. As always, feel free to look at the code for my website, and please write me with your comments and critiques.
(c) 2018 firstname.lastname@example.org