Beginning a simple stats gathering app in Django

I just pushed a commit to my worksheet generator website containing a new app: something I’m calling “tobystats.” (Guess what my first name is.) The idea is simple: to try and collect the kind of stats that I’d like to have as I think about intentionally growing the site to be useful to more than just myself. (I mentioned the idea already.)

What stats would I like to collect?

In all honesty, this is probably a poorly-conceived project. I mean, I don’t know what I want to know. I do know that I’d like to start working on my landing page and create something of a conversion funnel to attract new users.

To that end, I’d like to know how many people who visit my site either 1) log in (they’re returning users and wouldn’t have clicked through, anway) or 2) click through to a “learn more” or “try it free” page.

Eventually, the same app should also be used for something akin to event logging. I’d like to know how many total worksheets the site has made. (It would be fun to celebrate a thousand worksheets made, or whatever) as well as counting other events. This is not something I’ve added, yet, but will.

How am I doing this?

The goal is to be able to add a single line to the views of pages that I’d like to track. Right now, that line is:

from tobystats import tobystats

tsid = tobystats.process_request(request, 'LandingPage')

And then the tsid string that’s returned is passed through to the template. (tsid stands for “tobystats id”), where it’s appended in the query string in links, like this:

<a href="example.com/link/blah.html?tsid={{ tsid }}">Example link!</a>

So, the idea is simple: when the process_request() function is called, it checks if there’s a tsid already associated with the URL. If there isn’t, we assume this is the first page that’s been loaded and create a new SiteVisit object (SiteVisit is the model I’m using to store the basics of a single visitor–eventually I’ll use some kind of IP geo-lookup to get the city and country of origin and store it there as well) and a PageView is created for that specific page, storing only the name of the page visited (this seemed to make more sense to me thatn URLs) and the date and time. Lastly, the tsid (a random five-character string) is generated and associated with the SiteVisit and returned to the view that called it.

If there’s already a tsid in the query string, it’s even simpler: look up the SiteVisit with the corresponding tsid and create a new PageView object associated with it. Job done!

I still have to make a dashboard

So far, all of the stats reporting available to me is the number of site visits and the number of those which were successful logins (the idea is that we’re going to only worry about what happens to visitors who don’t login–they’re the ones at whom the messaging is directed).

There’s a lot more to look at: how many visitors are identified by django-user-agents as bots (turns out that, within moments of uploading my stats, I was seeing referer spam), how many of the non-bots clicked through to the “learn more” page. If each step in the signup/initiation process is logged, it would be interesting to see how any people get fatigued by it and at what point. (Also, with geo-lookup, I could skip a step in the signup process).

It’s just a start

I’m sure there is more I can do–see the comment above about using geo-lookup for IP addresses. However, it was important to me to push something to the production site as soon as possible to just get a baseline for current usage. After all, if I don’t measure now, how will I know how many more visits are coming?

Also–and this may be the point of the whole thing–it’s nice to have a coding project to tinker with as I have time.

The Master Plan

As we move towards the summer — and, even more, towards the fall when a lot of language courses start up — I’ve been brainstorming how I’ll promote the worksheet generator. It’s not something I’m naturally good at, but I rationalize that means it’s an area where I can grow the most.

So far, two things are clear to me: 1) I can’t afford to buy every click I get on Google 2) I need to increase the rate at which people who do click through to my site create free accounts and experiment with them.

That brings me to step one:

Finish the worksheet generator

It’s an obvious step and will mean a bunch of small changes, tweaks to the interface, and walkthrough videos. I hope to fix the one thing I’m aware of going wrong, as well as to add an extra review activity.

Basically, this step addresses part two up above: before I start really pushing people towards the website, I want it to be as ready as possible to wow them with its functionality.

On the topic of pushing people towards the website, that brings me to the next step (which isn’t necessarily chronologically next — I can do these things in parallel).

Make two free websites

That’s right. In order to promote what I hope will be a paid website, I think it makes sense to make two more free websites. These should attract English teachers and ‘prepare’ them to want to see great vocab worksheets.

Here is the idea:

The New Spork City Website

I have already moved the stories I wrote for EFL students to their own website, called New Spork City. (If you never read the stories, New Spork City is the fictional setting.) This website should serve several purposes:

  1. Get me to keep writing the stories. I use them, and I can’t write them week-by-week just in time for a class. I have to set aside time to sit down and make the stories.
  2. Let me showcase the worksheets. Using the worksheet generator, I’m creating vocab worksheets that could be passed out in parallel to the stories. Naturally, these will be amazing on their own, but I’m hoping they’ll be an argument for creating tailor-made worksheets for your groups.
  3. Let me showcase the other resources. I don’t think I personally would invest class time playing a memory game based on a reading activity, but the website will give me a chance to show the resources it can make.
  4. Let me promote a free website. Having a free website means I could add it to lists that are only for free resources. Or, I could upload a few stories to worksheet-sharing sites with links back to the New Spork City site.

A blog for teachers in Germany

I don’t know if I really have time to commit to a second blog (third, if you count New Spork City, which has a blog component), but I rationalize that I could pre-write articles and commit to an article-per-week plus things like conversation topics/games.

Here are the goals that I think this could help me accomplish:

  1. Promote the worksheet generator, of course. After all, teachers who come to a blog with teaching tips are probably more open to learning about new resources. What’s more, I couldn’t find a list of online resources for teachers in Germany. I could make (and be on the top of) that list.
  2. Push me to get some stuff done. That is to say, there are activities and ‘teacher documents’ that would make more sense to host on a site for teachers as opposed to on the specific New Spork City site. Having a site that needs content might push me to get it done.
  3. Push me to learn and do some of the things I want to learn and do. It might surprise you to know that I’m not a perfect teacher, but there are things I could improve at. Researching, practicing and writing about those things for a blog would be a great way to improve. That’s in addition to the fact that writing about the things I do think I know will make me understand them better.
  4. Give me a second free website to promote. This is the same as point four above (and it’s point four, here!) It’s not a high priority, but I think that it could be part of a sustainable model for the worksheet generator, to have things that I give away for free as well as a service I provide for money.

That certainly seems like enough, doesn’t it?

So, in addition to finishing the one website I’ve been working on for years, I’m looking at making two more. I get that it seems absurd.

However, most of the work for the two websites can be divided into two categories: initial setup work that has to be done once, and then stays done; and work like writing stories, making worksheets and classroom activities that I would do either way, and which I might do a little better if I knew it was for an ‘international audience’ and ‘promotional purposes.’

I’ll check in again soon.