Log analytics: how to calculate visit duration based on websocket activity without adding it as Actions

For https://play.lab10.coop/, we successfully managed to reduce external references (trackers, CDNs etc.) to zero.
In order to gain some insights about who visited us, I’m now trying to import the nginx logs with the log-analytics python script.

The import works, but there’s a caveat:
The application will constantly communicate with the server via a websocket connection (using socket.io), which is included in the log file.
However this websocket activity gets rendered as actions in Piwik, which is overkill (frequency can exceed 1 per second) and doesn’t add any meaningful information.
I could easily filter out the websocket activity with --exclude-path "/socket.io*", but then Piwik is nomore able to correctly calculate the visit duration.

Is there a way to import that logs such that visit duration is calculated correctly without recording hundreds or thousands of actions per visit?

1 Like