koko-analytics icon indicating copy to clipboard operation
koko-analytics copied to clipboard

slow loading of total views per post

Open yellowmastodon opened this issue 1 year ago • 0 comments

Background: Planned to use koko_analytics in a news site project, which displays post views on the front end both in single-post and archive view. I have already imported stats from jetpack, since this is a redesign of an ongoing project.

Issue:

  1. Loading of the views via shortcode does not allow total views, only for specified amount of days.
  2. Loading the views for 10 years slows down archive page (with 24 posts) load from 600ms to 2500ms in local environment

The issue lies probably in large query, that is performed due to the fact, that the stats are saved to database per post per day.

Proposed solution: There could be a separate database table, which stores only total amount of views/visitors per post. Probably could even have two more tables, which store them per year and per month for easier query.

yellowmastodon avatar Nov 17 '24 16:11 yellowmastodon