I need to anonymize IP-addresses, but I also need to create a segment that filters visitors from a particular IP-address, namely the organisation responsible for the website.
So if I can’t use the IP-address to create a segment, is there any other way to identify and thus segment visitors from a particular organisation/IP-address?
I have been googling and searching the forum. I only managed to dig up one other post, but that doesn’t have a solution either.
For the record, here is how we solved the issue.
We added a custom variable with scope visit, named VisitorType. It can have a value of “visitor” or “employee”.
In PHP, where during the session, we have the full non-anonymized IP-address of the user, we check the visitor’s IP-adress against the organisation’s known public IP-addresses:
IF visitorIP = organisationIP THEN VisitorType = employee ELSE VisitorType = visitor
We set the value for VisitorType in the Piwik script on the page and when the user agent executes the tracking script, the correct value for VisitorType is tracked by Piwik.
Now we can store anonymized visitor logs as mandated by regulations AND segment the data as we need.