Tom Lehman
Tom Lehman

Reputation: 89373

Best way to compute the number of views a page has

What's the best way to implement an on-site per-page view counter (like Stackoverflow has question pages)? Options:

  1. Pull unique pageviews programmatically from Google Analytics
  2. Count the number of times the page was served (though this approach counts crawlers and bots)
  3. Count the number of time the page was served and try to filter out crawler user agents
  4. Ping the server on page load via JS (and then filter out pings from the same IP / user?)

Upvotes: 0

Views: 247

Answers (1)

morganpdx
morganpdx

Reputation: 1876

I'd definitely go with option #1 first. Google analytics has already done the heavy lifting. If that fails, I'd probably go with option #3, which shouldn't be too difficult; just include all known browser user agents, and disregard the rest.

Upvotes: 1

Related Questions