On various Stack Exchange sites we see a side bar that tells us what the usage is. One of the metrics is views/day Jeff gives some description of it's calculation here, but what I want to know is

Is it an average? If so, over what period of time?


For the time being views/day is coming straight from the API.

views_per_day there is the sum of all views (as determined by unique IP visits within a reasonable interval) on all questions (including deleted, closed, migrated, etc.) over the number of days the site has existed (as determined by the creation date of the oldest question).

This formula has been tweaked in the face of site closure (Gadgets) and the fact that now that we have a bunch of sites, we're going to have a bunch of weird dates on questions due to migrations.

Now, a site's views_per_day is calculated as follows:

  • Vn = sum of view counts of all questions created after the site (regardless of where they were created originally)
  • F(q) = (q's view count) * (number of days the site has existed) / (number of days q has existed)
  • Vu = sum of F(q) for all questions created before the site
  • views_per_day = (Vn + Vu) / (number of days the site has existed)

This isn't perfect, but we don't track individual view events (we'd probably need a dedicated DB server for that on SO, just incrementing is already kind of painful without some tricks) so I think its OK given the data.

The whole scheme has some nice properties:

  • migrated questions are reflected in the views_per_day, just ignoring them seems very wrong
  • new sites don't get huge view boosts from being seeded with SE 1.0 sites
  • questions that were asked on another site while the destination site existed, and then migrated, are counted immediately (as if they were asked on the correct site to begin with)
  • newer questions have a larger impact than older ones
    • so a hot new question asked a day before the site was created would be reflected almost immediately, while an old one will be counted eventually
  • all migrated questions are "eased in," so views_per_day doesn't jump sporadically

Though, obviously, views_per_day should still be taken with a grain of salt.

  • 1
    Does it consider migrated questions to enstabilish the creation time? – Thomas Bonini Sep 17 '10 at 19:26
  • @Kop - yes. Excluding them makes something inaccurate (either the total question views or the time period for those views), so I took the easy way out and left them in. This has a small effect on SE 2.0 sites, since the migration paths are quite limited. With gadgets closure (and subsequent question "salvage") this may be changed if really neurotic numbers start showing up... but its not a high priority. For the trilogy sites, they're both too big and too old for migrated questions to have much impact. – Kevin Montrose Sep 17 '10 at 20:05
  • Won't just having a site.CreationDate column be easier? :S It can be set manually for old sites, and automatically from now on.. – Thomas Bonini Sep 17 '10 at 20:16
  • @Kop - we have a notion of site creation date, but if we use it then we're dividing question view count totals by a smaller period than they were "earned" in. On the other hand, if we exclude migrated questions altogether, views_per_day won't reflect the popularity of a sites current content (regardless of where it came from originally). There isn't a perfect solution. – Kevin Montrose Sep 17 '10 at 20:20
  • ohh, I understand the problem now.. Thanks for explaining =) – Thomas Bonini Sep 17 '10 at 20:40
  • @Kevin Montrose: Thanks. This explains why Apple.SE's views/day just halved. – Chealion Sep 19 '10 at 5:31

As an update to this post - we now pull visits / day directly from google analytics for the SE 2.0 sites. This number will more closely match the number presented at stackexchange.com/sites.

Visits = sessions. A session is a defined period of activity by a visitor. The standard criteria for a session in Google Analytics is activity without a break of more than 30 minutes OR closing the browser. So, if someone comes to your site, looks at two pages, goes to lunch and leaves their browser open, comes back an hour later and resumes browsing, a second session would be started. If a user viewed two pages on your site, closed their browser, and came back 5 minutes later, they would create a new session.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .