Making my own stats

I live in Germany. I can’t click on a single website without getting a “we use cookies to enhance your experience” message and being required to consent before I can see whatever content I actually want to see.

Cookies, am I right? Nobody likes them.

For a while, I’ve been saying in conversation that it has to be possible to collect the data you need without using cookies (though, I guess I’ll continue to use them to keep users logged in). So, while I’ve played around with Google Analytics (and believe I still have it on the worksheet generator page), I never nerded out on it.

My idea

It’s not super-scalable or a product I can sell, but I’d like to make my own system for trying to get some insight into user behavior. The idea is something like this:

  1. A user hits my webpage: If the querystring doesn’t already have a unique identifier in it, the system generates a unique ID (I’m thinking six digits like “a8d0zw”) and records things like the time and IP address in a database entry.
  2. This unique ID is passed through to the Django template: It’s inserted into all the links, so that the next page knows which “session” this pageview belongs to. This could be used to record how much time is spent on each page, and, ultimately, how the user moved through the site.
  3. Individual links can also have identifiers: Here, I’m thinking about the fact that I plan to use two different CTA links on the re-written landing page. It wouldn’t be a lot of work to see if people typically scroll to the bottom before clicking, or click at the top.
  4. Logging-in would have to be accounted for: The login mechanism would have to include this, so that page hits that resulted in logins could be separated from page hits that were generated by things like paid advertising.
  5. Finally, I’d have to write code to make sense of everything: It would be on me to make my own dashboard that would parse the information out of all of this data.

Next steps

It doesn’t seem overwhelming, does it? I figure this is a project I can do to practice, and to keep at coding while I’m also working on things that aren’t code intensive. I get that it’s not going to be the kind of thing that I’ll be able to send others, but I like the idea of making my own stuff, and of disconnecting from Google Analytics.

So, I guess the next thing to do is to write out the literate programming plan for what I want this to do, and then implement it.

I’ll keep you posted.