ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

View Count Drops

June 17, 2014 9:55am

Subscribe [1]
  • #1 / Jun 17, 2014 9:55am

    ekortright

    3 posts

    One of our bloggers has been reporting that the view count sometimes goes down for certain articles.  I have searched everywhere in the EE code (we are running 2.5.5), and there is only one place where the view_count_* fields are updated, and it is an UPDATE SQL statement that performs a simple increment by 1.

    Since the increment is done atomically in the database, I thought there could not be any way for the view_count fields ever to go down, so I blamed it on browser or some other kind of caching.

    But yesterday I decided to create a cron job that queries the database for one particular article’s view_count_one value and logs it to a file every minute.  So there is no browser or caching involved.

    In the last 16 hours or so, the view count for this article has actually dropped 12 times, by seemingly random amounts ranging from 1 to 72.  If the decreases are actual views that are lost, then for this particular story the view count is below the true amount by almost 11% so far.  See the attached plot of a portion of the log file.  The blogger who complained says that he has seen counts drop by several thousand for other stories, so this problem could be much more severe.

    Has anyone else noticed this behavior?  Any advice as to what to look for or test would be most appreciated.

  • #2 / Jun 18, 2014 8:29am

    ekortright

    3 posts

    Update: after almost 40 hours, the view_count_one value has dropped 35 times for the entry being monitored.  The drops add up to 569, which is almost 10% of the current number of views.

  • #3 / Jul 15, 2014 9:19am

    ekortright

    3 posts

    Well, this is embarrassing.  This is a legacy site that has been running for years (it was using pMachine initially, I’m told).  I have just stumbled on a cron job on the hosting server that subtracts the number of times an article has been viewed from the same session (by querying the exp_session_page_views table) every 15 minutes.  So EE is not responsible for the drops in the view counts.

    I have no idea why anyone would want to do this, or whether it makes any sense to do (maybe the counts were being overestimated at one point?).  Can anyone tell me if such a thing is necessary to get a more accurate view count?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases