Reduce statistics visits and visitors identifiability#863
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Formwork’s Statistics visitor tracking to reduce long-lived visitor identifiability by rotating identifiers (daily) and incorporating the user agent, while migrating existing visitor registry entries keyed by anonymized IP.
Changes:
- Include
$dateand$userAgentin the per-page session hash used for visit de-duplication. - Replace legacy IP-based visitor registry keys with a daily rotating hash of date + anonymized IP + user agent.
- Add an in-place migration step to convert existing
visitorsentries from$ipkeys to the new hashed keys.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request updates the visitor tracking logic in the
Statisticsmodule to improve uniqueness and future-proof the identification of visitors. The main changes focus on replacing the legacy IP-based visitor keys with a new approach that incorporates the date and user agent, and introduces a migration step to handle existing data. In this way, visitors become less identifiable over time, as the anonymized IP address and user agent are hashed together with the current date, producing rotating, non-persistent identifiers instead of stable tracking keys.Visitor tracking improvements:
formwork/src/Statistics/Statistics.php, formwork/src/Statistics/Statistics.phpR64-R72)formwork/src/Statistics/Statistics.php, formwork/src/Statistics/Statistics.phpL82-R104)Legacy data migration:
formwork/src/Statistics/Statistics.php, formwork/src/Statistics/Statistics.phpL82-R104)