New Page Counters

Today I finished writing and installing new site page counters. For most readers, this may be a curiosity at best. For some, a “why are you bothering us with this?” moment. For me, it’s a convenience. For our HOME page, it’s a more accurate counter.

1.  HOME COUNTER: The old HOME counter has always reflected the actual page hit counts we’ve been tracking since 1995. When we changed servers in May 2013, I had to rewrite the counter. To reduce database calls, I wrote counters to a flat file, which periodically broke. Worse, I believe it inflated the counts. I finally got tired of fixing that data file.

The result is a new routine that writes the count to the database (again), so there is no file to break. The code executes inside a new WordPress PHP Code widget. As far as I can tell, my code increments by exactly one every time the page is loaded, never more or less. Thanks to you, our  readers, the current HOME page count is somewhat over two million.

2. NEW DEPARTMENT COUNTERS. As a result of this effort, I was finally able to port my new code routine over to each of the other 9 departments. In the Sidebar of each department home page, COUNTER appears at the top. Department counts restart at 1. You’ll see counts ranging from 21 to a few hundred, and climbing from there.

I felt I had to drop multiple page counters when I went over to WordPress around ten years ago. I used to keep page counts for Photos, Commentary and so forth, on our old HTML pages, but that’s all ten year old data now. I just started over at zero. It is easier for me to look at the page, than look up server stats on the server, which is why I never did.

~~ Alex


6,060 total views, 4 views today

One thought on “New Page Counters

  1. Our HOME page counter has finally outstripped the Site Sisits counter, by some 71,000 hits or so. How could this be?

    Part of it could be “page stutter”, “race condition” or double-counts in an older counter, as mentioned in my post, but not 70K worth.

    “Site Visits” are extracted from the server AWSTATS site stats plugin. As I understand it, these are unique visits. Each time a visitor returns to the home page, the counter increments. But a site visit by the same visitor counts as one unique visitor, no matter how many pages are viewed in a single session, or how many times the visitor returns to browse HOME in that session.

Leave a Reply

Your email address will not be published. Required fields are marked *