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.
Solved by Andy Miller View solution
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:
{
"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:
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.
Thank you very much for your prompt response, your explanations and advice, and for the continuity of this data between Grav1 and Grav2.
Log in to reply.
Suggested topics
| Topic | Participants | Replies | Views | Activity |
|---|---|---|---|---|
| 0 | 143 | 6 days ago | ||
| 0 | 142 | 1 week ago | ||
| 0 | 137 | 1 week ago | ||
| 2 | 225 | 2 weeks ago | ||
| 2 | 480 | 3 weeks ago |