With Grav1, I used to retrieve the daily.json and montlhy.json files from the logs/popularity directory every day to process them and present statistics. It seems that since Grav2, these files are no longer produced.
General
last edited 08/04/26 by jean-louis67
Nothing was lost, it just moved and consolidated.
Page-view tracking used to be part of the classic admin plugin, which Grav 2 no longer uses. It now lives in the API plugin, and instead of four separate files it writes one combined file:
logs/popularity/popularity.json
Same directory as before. The contents cover everything the old files did:
JSON
{
"version": 2,
"daily": { "2026-08-03": 42 }, // was daily.json
"monthly": { "2026-08": 1180 }, // was monthly.json
"pages": { "/blog/my-post": 61 }, // was totals.json
"visitors": { "<ip-hash>": 1754236803 } // was visitors.json
}
Two things worth knowing if you're scripting against it:
- Date keys are now ISO (
YYYY-MM-DDandYYYY-MM) rather thand-m-Y, so they sort correctly and don't depend on locale. - The first time the new code runs on a site that still has the old files, it imports them and renames them to
*.migrated, so your historical numbers carry over.
Settings are under user/config/plugins/api.yaml:
YAML
popularity:
enabled: true
exclude_admin: true
exclude_ips: []
history:
daily: 30
monthly: 12
visitors: 20
If you'd rather fetch the stats over HTTP than read the file off disk, the API plugin also exposes GET /api/dashboard/popularity (requires the api.system.read permission), which returns today/week/month totals, a 14 day chart series, and the top 10 pages already aggregated for you.
Log in to reply.
Suggested topics
| Topic | Participants | Replies | Views | Activity |
|---|---|---|---|---|
| 0 | 130 | 4 days ago | ||
| 0 | 135 | 6 days ago | ||
| 0 | 130 | 6 days ago | ||
| 2 | 219 | 2 weeks ago | ||
| 2 | 473 | 3 weeks ago |