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.89k stars 2.65k forks source link

Optional add link to ip to view data #10286

Open joubertredrat opened 8 years ago

joubertredrat commented 8 years ago

Hi guys, When I'm on indexVisitorLog action, I copy IP and paste in other site to see other IP informations (rDNS, location, blacklists, etc).

So I had an idea, why not set a optional link on IP to open in other sites?

Example: If i set on config url with ip joker, ip will have link to open, as examples below: http://www.tcpiputils.com/browse/ip-address/{$ip} https://mxtoolbox.com/SuperTool.aspx?action=blacklist%3a{$ip}&run=toolpage https://db-ip.com/{$ip}

If you not set config url, indexVisitorLog will display IP only a text, as it is today.

What you think guys?

mattab commented 8 years ago

Hi @joubertredrat - thanks for the suggestion. our thoughts on this will be more around creating a new small plugin (published on the marketplace) that would let people, in the Plugin settings area, easily choose one of a pre-existing list of IP data websites, or input their own custom link. It would be awesome to have such new plugin!

joubertredrat commented 8 years ago

Hi @mattab, if is possible to make this as plugin, I will provide this then :+1:

mattab commented 8 years ago

@joubertredrat sounds good! let us know if you manage to create this plugin :+1:

hpvd commented 8 years ago

+1

joubertredrat commented 8 years ago

Hi guys,

@mattab the plugin is almost ready, as you can see on https://github.com/joubertredrat/Piwik-LinkForIP but I have little question about template.

On template, visitIp isn't escaped with raw, then is display as string, as image below: screenshot-0 0 0 0 9090 2016-07-14 11-34-36

If I add raw on variable (IP: {{ visitor.getColumn('visitIp')|raw }}) in template, works fine: screenshot-0 0 0 0 9090 2016-07-14 11-38-51

Then a question, have one alternative to don't scape data without raw or really will necessary a PR with this change if is allowed?

Other alternative is javascript, get string into span, regex to get IP and add bind click, but I think that isn't good idea.

mattab commented 8 years ago

Hi @joubertredrat - I think in this case, maybe it works easier if we add a class to the STRONG containing the IP address. Then you could get & change in this element and add the <a href=..>...</a> in JavaScript dynamically. Maybe you could make a PR changing the <strong element showing the IP to be a SPAN with a special class?

joubertredrat commented 8 years ago

Hi @mattab I really don't think that is good to use javascript because it can broken browser if have a lot of lines, javascript to manipulate elements after DOM loaded consumes a lot of memory and have other possible problem, on pagination or data reload, will be necessary manipulate again by javascript.

I will test to see if is possible using data html atribute data-ip='x.x.x.x' on span and bind with click and open url by ip defined on data-ip value.

Another way is instead IP: {{ visitor.getColumn('visitIp')|raw }}, create other filter and use on template, IP: {{ visitor.getColumn('visitIp')|url_ip }} but I'm not good with Twig, I don't know if is easy to make this.

http://twig.sensiolabs.org/doc/advanced.html#filters

mattab commented 8 years ago

I will test to see if is possible using data html atribute data-ip='x.x.x.x' on span and bind with click and open url by ip defined on data-ip value.

This also sounds pretty good solution! let us know

joubertredrat commented 8 years ago

Hi guys,

@mattab sorry for delay, a lot of work here :( I tried with data-bind, but without success. Then I can talk with you if have problems to changes in twig as above.