Skip to content


How to find all visits from a company/ISP in Piwik

I don’t believe Piwik has any function to search among its statistics and logs. This is not really a big issue because, objectively, there isn’t much stuff to search for in the stats, but still sometimes I wish I could do such searches. For instance, recently I wondered how often I was visited by people from a specific company. And there’s no tool to answer that question in Piwik. However, you do have access to the full visits database. After a brief look around, the log_visit table seemed the most appropriate for my needs: its location_provider field contains the URL of the visitor’s ISP, which is often the visitor’s company itself, as long as the company is large enough to own its own IP range.

So, the query (MySQL/MariaDB/whatever) simply looks like this:
SELECT * FROM log_visit WHERE location_provider LIKE '%company.domain.name%'

Note that:
– Piwik doesn’t manage to map all IPs to companies or ISPs, you’ll probably miss like a third of them, or maybe even more.
– From the results, you’ll have easy access to information about the ID of the visited site, the referrer, and date & time of the visit, but that’s about it. You’ll have to use that information to browse the normal GUI if you want to easily read more details about any specific visit. Or do some coding if you feel inspired 😉
– For your search, if you don’t find any result, try a shorted name for the domain name, notably without the leading www, and also maybe without the final extension.

Posted in Uncategorized.

Tagged with .


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.

Sorry about the CAPTCHA that requires JS. If you really don't want to enable JS and still want to comment, you can send me your comment via e-mail and I'll post it for you.

Please solve the CAPTCHA below in order to fight spamWordPress CAPTCHA