Encrypt last Byte of IP Address plugin

I am fairly new to developing plugins, and I have to make a plugin that will call the getProperty(‘location_ip’) and encrypt the last byte. I’m having trouble following the API calls from the core as well as the formatting for the plugin. If there are any video to recommend that would be great!

Hi,

While I can’t answer your question, I am not sure how useful encrypting IPs is.

It doesn’t help for privacy compared to just storing the IP as you can still identify the user. But it really complicates many things. Depending on how you are planning to decrypt it and where to store the key it may be hard to make it secure. And am not sure if encryption algorithms become far more complicated if the encrypted text is really short.

We can’t store any EU IPs so we want to encrypt the last byte, so that we don’t get the full location, but still get information from the region. Its due to GDPR regulations.

I actually want to know if it’s possible to write a function that checks if the IP address is from the EU then the anonymize data setting is enabled?

Hi,

You are right that with GDPR you can’t store any personal information (like the ip address) without the consent of the user. But encrypting the last byte doesn’t change anything as you still store the full ip address and can uniquely identify the user.

The only way to solve this issue is by throwing away the last one or two bytes which is a feature Matomo supports out of the box (privacy settings).

Could be that there is a way to integrate into the anonymization depending on the result of the geolocation, but I wouldn’t recommend it. People outside of Europe have the same rights to privacy (even if there aren’t laws providing them everywhere) and there is no way to know for sure if an IP is “European”.