1. Home
  2. Docs
  3. Enriching your data
  4. Available enrichments
  5. IP Anonymization enrichment

IP Anonymization enrichment

Summary

The IP anonymization enrichment lets you anonymize the IP addresses found in the user_ipaddress field by replacing a certain number of octets with “x”s. For example, anonymizing one octet would change an IPv4 address of 255.255.255.255 to 255.255.255.x, and anonymizing three octets would change it to 255.x.x.x.

Overview

When web users navigate to your website or app, their device makes a request for your content. In that request is their unique IP address. Although IP addresses can be dynamic and assigned by internet service providers, some data collectors would rather not store full IP addresses due to local legislation or in some cases the ability to link an IP Address with an individual.

The IP anonymization enrichment allows you to decide how many of the octets (IPv4) or segments (IPv6) should be anonymized and then stores the IP address without the specified number.

Note: This enrichment runs after the IP Lookup Enrichment. Therefore, if you are not interested in collecting any geolocation information or other data points based off of a users IP Address make sure the IP Lookup Enrichment is not enabled.

Ipv4 and IPv6

The anonOctets parameter can be used to define the number of octets in an IPv4 address to replace with “x”.

Release R117 added support for the anonymization of IPv6 addresses. The anonSegments parameter was added to the enrichment configuration to describe how many segments should be anonymized within an IPv6 address.

The schema for the configuration of this enrichment has been updated to version 1-0-1.

The IPv6 anonymization changes are backwards compatible, such that the new code can also be used with schema version 1-0-0. In the case that the anonSegments parameter is missing, anonOctets will be read and also used for IPv6 addresses.

If you would like to set different values for IPv4 and IPv6, then you would need to use schema version 1-0-1 with the anonSegments param.

Example

Here is a sample configuration file for this enrichment:

{ "schema": "iglu:com.snowplowanalytics.snowplow/anon_ip/jsonschema/1-0-1", "data": { "name": "anon_ip", "vendor": "com.snowplowanalytics.snowplow", "enabled": true, "parameters": { "anonOctets": 3, "anonSegments": 7 } } }

We set the level of octets & segments by defining the value for the two keys, which in this case has been set to 3 and 7. If a user browses our site with:

  • IP: 192.168.1.1, the value stored in the database under the user_ipaddress column in the atomic.events table would be: 192.x.x.x.
  • IP 2a03:808:2e1:ee20:7df1:260f:cdc7:4165, the value stored in the database under the user_ipaddress column in our atomic.events table would be: 2a03:x:x:x:x:x:x:x