plausible / plausible-tracker

Frontend library to interact with Plausible Analytics
https://github.com/plausible/plausible-tracker
MIT License
215 stars 50 forks source link

Provide a mechanism to filter out or obfuscate parts of the URL #13

Closed abridger closed 2 years ago

abridger commented 3 years ago

Detailed Description

We have an issue at Giki where user IDs form part of the URL. This means that any information that we send with the URL attached would in theory be traceable back to a user. We'd love to be able to remove the unique IDs from the URL or obfuscate them in some way so that we can see which pages within their account users are viewing, without being able to link this back to specific users. The best way for us to do this at the moment seems to be creating a small wrapper around Plausible, where we can call the trackEvent and trackPageview functions and pass in a sanitized url in the props.

Context

Possible Implementation

It might be possible to provide a function for the Plausible init options that could either be called to produce the current URL (a default could just return location.href as currently, but developers could implement their own to filter out or obfuscate URLs as needed) or a specific URL sanitizer function (a default could just return the string provided, but a developer could provide one that does any transformation or filtering required). The function we would supply for either of these would just return the location.href string with anything matching a UUID regex replaced.

Thanks!

ukutaht commented 3 years ago

Thanks for the request!

See also https://github.com/plausible/analytics/discussions/136

abridger commented 3 years ago

Aha! I hadn't seen that. Thanks for the pointer :smile:

metmarkosaric commented 2 years ago

This is now live: Specify a custom location to aggregate pages that contain identifiers.