A possible way to Log User- and Page-Access to statsd is via the Event system - using Adaptavist's Scriptrunner for Confluence, se https://scriptrunner.adaptavist.com/latest/confluence/ConfluenceEventHandlers.html#_collecting_stats
Read Access Logging in Confluence for good reasons to log via the Event system.
To make this work, the jar file from https://github.com/datadog/java-dogstatsd-client#java-dogstatsd-client must be placed under confluence/WEB-INF/lib and Confluence must be restarted. This will load the jar file into the Tomcat.
The script is executed by an Event Handler in Confluence:
this executes this script for every PageViewEvent:
Viewing the data in DataDog - here its all Page Views pr. Space:
Or tracking a single User pr. Space:
Finally - vice versa - Monitoring a single Space for PageViews pr. User:
For some reason, this kill the Confluence Tomcat with "java.io.IOException: Too many open files", so my best guess is that the script is not releasing some resources. Raising limits has not helped...