From 90cb0b60263370d5ed80be581f06a43b49971d7c Mon Sep 17 00:00:00 2001 From: Erica Porter Date: Mon, 23 Sep 2024 11:51:35 +0100 Subject: [PATCH] revert to pre-pseudonymisation --- lib/dfe/analytics.rb | 4 ---- lib/dfe/analytics/event.rb | 12 ++++++------ 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/dfe/analytics.rb b/lib/dfe/analytics.rb index c086087f..5a35a4bb 100644 --- a/lib/dfe/analytics.rb +++ b/lib/dfe/analytics.rb @@ -212,10 +212,6 @@ def self.extract_model_attributes(model, attributes = nil) end def self.anonymise(value) - pseudonymise(value) - end - - def self.pseudonymise(value) # Google SQL equivalent of this is TO_HEX(SHA256(value)) Digest::SHA2.hexdigest(value.to_s) end diff --git a/lib/dfe/analytics/event.rb b/lib/dfe/analytics/event.rb index e11d4bcc..036d0332 100644 --- a/lib/dfe/analytics/event.rb +++ b/lib/dfe/analytics/event.rb @@ -55,7 +55,7 @@ def with_response_details(rack_response) end def with_user(user) - @event_hash.merge!(user_id: user_identifier_for(user)) + @event_hash.merge!(user_id: user_identifier(user)) self end @@ -126,15 +126,15 @@ def hash_to_kv_pairs(hash) end def anonymised_user_agent_and_ip(rack_request) - DfE::Analytics.pseudonymise(rack_request.user_agent.to_s + rack_request.remote_ip.to_s) if rack_request.remote_ip.present? + DfE::Analytics.anonymise(rack_request.user_agent.to_s + rack_request.remote_ip.to_s) if rack_request.remote_ip.present? end - def ensure_utf8(str) - str&.scrub + def user_identifier(user) + DfE::Analytics.user_identifier(user) end - def user_identifier_for(user) - DfE::Analytics.user_identifier(user) + def ensure_utf8(str) + str&.scrub end end end