andreaselia / laravel-analytics

Analytics for the Laravel framework.
MIT License
165 stars 25 forks source link

Allow changing how session id is resolved #27

Closed justRau closed 2 years ago

justRau commented 2 years ago

In some cases session is not available, therefore, we need another way to provide the session_id, for example, by hashing IP address + user agent + other params, or any other method that may depend on the use case.

This PR adds a way to create and set a custom SessionIdProvider, allow consumers of this package to change how session_id is generated. The default remains the same: session ID of the current request.

andreaselia commented 2 years ago

I really like this change as it keeps the default package privacy friendly (sessions, not IPs) but allows the user to change it if they see fit. Thanks a lot for the contribution @justRau. I'll check this out in more detail and properly test it when I get some free time (hopefully over the weekend).

Cc: @tomirons

andreaselia commented 2 years ago

Hi @justRau,

Thanks again for your great PR! I've reviewed it and it all looks good to me, and there don't appear to be any breaking changes from what I can tell.

Just pending a secondary review from @tomirons, and then this will be good to merge in and release 🚀

Thanks, Andreas

andreaselia commented 2 years ago

Right, this looks good to me. I'll hopefully get some time to test this again (after the latest changes) over the weekend and push a new release then.

andreaselia commented 2 years ago

Looks good to me, thanks again for your contribution @justRau 👍

justRau commented 2 years ago

Thanks for a nice package and merging @andreaselia ❤️