matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.91k stars 2.65k forks source link

Add a whois feature #20111

Open mattmary opened 1 year ago

mattmary commented 1 year ago

One of our plugin users asked us if he could get a whois integration in Matomo

Summary

Otherwise, he has to copy and paste the IP in a term. Maybe it could be a plugin which parse the generated content looking for IPs and add this feature?

Your Environment

mmokrejs commented 1 year ago

Ideally a mouse hover() over the IP address shown in "Visitors" -> "Visits log" would show parsed WHOIS info for the network and also simple ip2hostname translation. Somes either of the two is too generic and useless.

You could even show both parsed text values underneath the IP address, that woud be even better as one can search for it using "Select a segment of visits:", would that support a REGEXP search or at least a substring search or .startswith() or .endswith() conditionals. Currently only mathematics operators are allowed ... for the Visitor IP cases I tried at least.

BTW, am on PHP 7.4.

sgiehl commented 1 year ago

This might be similar or even a duplicate of #3889. Personally I think this might be a very rare use case, as the majority of Matomo users are using the IP Anonymization, which makes it impossible to fetch this data afterwards. It would though be needed to do that prior to anonymizing the IP, which would make the tracking requests slower, as it needs to send out whois requests before storing any data. I don't think this is something that might come to core soon. Nevertheless it should be possible to develop a custom plugin for this.

mmokrejs commented 1 year ago

I do not know about your experience but I always inspected the Apache logs before Wordpress and similar tools arose. Definitely, it is disappointing one cannot do a simple filtering search using IP address ranges using a wildcard or even a substring search.

The hostname and whois queries could be done later by some batch "overnight" and then the IP address zapped. Why do you need to do all the queries before an entry is added to the logs? Isn't it in an editable database?

Seems like I should leave Matomo. I just inspect the Visits log and that's it. And these simple additions are simply missing.

sgiehl commented 1 year ago

@mmokrejs That would need to be done upfront, as Matomo can be configured to anonymize IPs. If that is the case, the ip is stored anonymized in the database, which would make it impossible to work with the IP later. It seem you don't use IP anonymization, in that case it would for sure also be possible to do that later.

mmokrejs commented 1 year ago

@sgiehl Yes, I do not use IP anonymization so it can be done in some batches or another thread. Still I think the anonymization could happen before the IP is shredded so the freature could be available even to users using IP anonymization.