Anyone solved the issue of tracking pdf/doc downloads accurately?

We are going to need a new solution now thats compatible with plone 6. We won't upgrade c.googleanalytics but we might take the code we made and make it standalone perhaps so it can have different methods to add server side analytics for different systems, not just GA.
Basically what the code did was hook into the zope machinery at the right point to work out if it was a file being streamed vs something else, what the mimetype was and then tried to registered a hit with GA for the specified mimetypes.

We may also opt to deal with this where if the user is coming from an external link then we redirect them to a browser page first before they can download. however I'm not sure thats a good idea yet. Google might not like users going to different urls than what their indexer saw