Analytics Plugin for SynaptikCMS
Lightweight server-side analytics — no JavaScript, no cookies, no external scripts. Fully GDPR-compliant by design.
What it tracks
- Page views and unique visitors (7d / 30d / 90d / 365d ranges)
- Top pages with view counts, content type, and slug
- Traffic sources — direct, search engines, social networks, referral sites
- Device breakdown — desktop, mobile, tablet
- Country of origin — optional, requires the GeoIP database (see below)
- Today's live stats — real-time view and unique visitor count, not cached
Bots and crawlers are filtered out automatically via User-Agent pattern matching. Logged-in admins are excluded. Static assets (CSS, JS, images) are never tracked.
GeoIP — Country detection
Country detection is optional. Without a GeoIP database, the Countries tab in the admin shows no data. Everything else works normally.
Installing the GeoIP database
From the Analytics admin panel, go to Settings → GeoIP and click Install / Update GeoIP Database. The install process:
- Attempts to download the current month's DB-IP Country Lite CSV from
download.db-ip.com. If the current month's file isn't available yet, it falls back to the previous month. - Decompresses the
.csv.gzarchive in a PHP temp directory (requires thezlibextension). - Converts the CSV into the two binary files via a single-pass stream parser. The temporary CSV is deleted immediately after.
- Writes
meta.jsonwith the build timestamp and record counts. - Protects
data/geoip/with a.htaccessdeny-all rule.
The endpoint requires an active admin session and a valid CSRF token. Server requirements: curl, zlib, write access to plugins/analytics/data/.
Updating GeoIP Database
Re-click Install / Update at any time. DB-IP publishes a new CSV at the start of each month. The binary files are replaced atomically (.tmp rename) so a failed update never corrupts the live database.
Log retention
Old log files can be purged from the Analytics admin settings. The purge threshold is configurable (default: 365 days). The purge function deletes daily JSON files older than the threshold and leaves everything else untouched.
