-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add anonymisation of user_id in the web request event data #64
Conversation
- Make this configurable through dfe analytics config - Update README to explain anonymisation and custom user identifier
README.md
Outdated
If a field other than `id` is required for the user identifier, then a custom user identifier proc can be defined in `config/initializers/dfe_analytics.rb`: | ||
|
||
```ruby | ||
DfE::Analytics.config.user_idenitifier = proc { |user| user&.id } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@asatwal I think there's a typo here? idenitifier should be identifier?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well spotted @stevenleggdfe
README.md
Outdated
|
||
#### User ID anonymisation | ||
|
||
The `user_id` in the web request event will not be anonymised by default. This can be changed by updating the configuration option in `config/initializers/dfe_analytics.rb`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@asatwal would it be worth adding a line here like 'You probably want to anonymise user_id if the field it comes from in your schema is in analytics_pii.yml so that analysts can join the IDs together. If your user_id is not in analytics_pii.yml but is in analytics.yml then you probably want to ensure user_id is not anonymised so you can join the IDs together.'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, (tiny) nits inline!
README.md
Outdated
If a field other than `id` is required for the user identifier, then a custom user identifier proc can be defined in `config/initializers/dfe_analytics.rb`: | ||
|
||
```ruby | ||
DfE::Analytics.config.user_idenitifier = proc { |user| user&.id } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DfE::Analytics.config.user_idenitifier = proc { |user| user&.id } | |
DfE::Analytics.config.user_identifier = proc { |user| user&.id } |
|
||
def user_identifier_for(user) | ||
user_id = DfE::Analytics.user_identifier(user) | ||
user_id = DfE::Analytics.anonymise(user_id) if user_id.present? && DfE::Analytics.config.anonymise_web_request_user_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd turn this into a multiline if
, but if Rubocop's fussy 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rubocop not happy with multiline if, so left as is :-)
Trello-975
Add anonymisation of user_id in the web request event data