Utilities¶
-
analytical.utils.
anonymize_ip_address
(ip_address)¶ Anonymizes an IP address by zeroing the last 2 bytes
Zeroing the last two bytes is sufficient to make a user reasonably anonymous while still allowing decent geolocation accuracy. One byte is insufficient for the DoNotTrack standard.
anonymize_ip_address('12.34.56.78') # '12.34.0.0'
Parameters: ip_address (str) – the IP address of the user Returns str: an anonymized IP address
-
analytical.utils.
anonymize_user_agent
(user_agent)¶ Anonymizes rare user agents
Currently, this function is pretty naive. Only if the browser or OS family are not recognized, it is considered “rare”.
Parameters: user_agent (str) – the browser user agent for the user Returns str: the same user agent or the string “Rare user agent” if user_agent
is “rare”