feat(analytics): tracking system plugin — privacy-first pageview collection #213

Open
opened 2026-06-18 15:57:32 +00:00 by jmiller · 1 comment
Owner

Parent issue: #210
Migrated from: MokoSuiteAnalytics#3

Summary

System plugin that injects a lightweight tracking script on frontend pages and records pageviews without cookies or personal data.

Tasks

  • plg_system_mokosuiteclient_analytics tracking logic
  • Inject tracking JS via onAfterRender (small inline script, no external dependencies)
  • JS collects: page URL, title, referrer, screen size, timestamp
  • Server endpoint receives beacon POST (lightweight, async)
  • Generate visitor_hash from IP + user agent + daily salt (never store IP)
  • GeoIP country lookup (MaxMind GeoLite2 or ip-api.com fallback)
  • Parse user agent for device type, browser, OS
  • UTM parameter capture (source, medium, campaign)
  • Respect Do Not Track header — skip tracking entirely
  • Respect component config: enabled/disabled per menu item
  • Exclude admin pages and API requests
  • Exclude bot traffic (common bot user agents)
  • Scheduled task: daily visitor_hash salt rotation
  • Scheduled task: purge old data per retention config

Performance

  • Tracking script < 1KB inline (no external JS file)
  • Beacon API for async, non-blocking submission
  • Batch inserts for high-traffic sites
  • Index on created_at for fast purge queries
**Parent issue:** #210 **Migrated from:** MokoSuiteAnalytics#3 ## Summary System plugin that injects a lightweight tracking script on frontend pages and records pageviews without cookies or personal data. ## Tasks - [ ] `plg_system_mokosuiteclient_analytics` tracking logic - [ ] Inject tracking JS via `onAfterRender` (small inline script, no external dependencies) - [ ] JS collects: page URL, title, referrer, screen size, timestamp - [ ] Server endpoint receives beacon POST (lightweight, async) - [ ] Generate visitor_hash from IP + user agent + daily salt (never store IP) - [ ] GeoIP country lookup (MaxMind GeoLite2 or ip-api.com fallback) - [ ] Parse user agent for device type, browser, OS - [ ] UTM parameter capture (source, medium, campaign) - [ ] Respect `Do Not Track` header — skip tracking entirely - [ ] Respect component config: enabled/disabled per menu item - [ ] Exclude admin pages and API requests - [ ] Exclude bot traffic (common bot user agents) - [ ] Scheduled task: daily visitor_hash salt rotation - [ ] Scheduled task: purge old data per retention config ## Performance - Tracking script < 1KB inline (no external JS file) - Beacon API for async, non-blocking submission - Batch inserts for high-traffic sites - Index on created_at for fast purge queries
Author
Owner

Branch created: feature/213-feat-analytics-tracking-system-plugin-pr

git fetch origin
git checkout feature/213-feat-analytics-tracking-system-plugin-pr
Branch created: [`feature/213-feat-analytics-tracking-system-plugin-pr`](https://git.mokoconsulting.tech/MokoConsulting/MokoSuiteClient/src/branch/feature/213-feat-analytics-tracking-system-plugin-pr) ```bash git fetch origin git checkout feature/213-feat-analytics-tracking-system-plugin-pr ```
Sign in to join this conversation.
No labels
Priority Medium
Type Feature
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoSuiteClient#213