Closed jmcgroar closed 3 years ago
A bit of additional information since I posted the issue. Just took a look at the database and I see that matomo_ip_to_company table which you created. But, it's empty even though a row appears in the Companies widget on the matomo dashboard. It also looks like you must be populating the other columns in the Companies widget from the matomo_log_visit table. If so, that explains why they're correct.
Hope this helps!
-Jeff
Added an ipInfo access token. Still no company name.
Hi @jmcgroar,
thanks for reaching out to me to let me know about this issue.
Guessing the name of the company behind the IP is something that is not 100% reliable. To do this, I use the a function called gethostbyaddr
as mentioned in the documentation. As I say in the doc:
This function returns the name of the company provided by the proxy used by the user. Most of the big companies have their own proxy set up with a real name configured. But SMBs may not and in this case, you could see the name of their ISP appear.
From my experience, ~5% of company names can be catch this way, but it also depends on who visits your website.
Connecting IpInfo can help a bit, but in your situation, it seems that it only catches the name of the ISP through which the visitor is connecting to your website, which is not a relevant information. That's why I don't save it in the DB, and that's why I don't display any information about the company itself. You can try it directly on their website and see the result.
I hope that this answers your question.
Hello Romain,
Thanks so much for getting back to me and providing the information on the IP-to-Company process.
What I’m seeing is that in 90%+ plus of the cases, nothing is displayed in the Company field. Curiously, the only time we’re seeing anything in the company field is when the hit is by an AWS machine. But, it’s the DNS name of the machine which is displayed in the company field rather than the company name. For example, for IP address 34.213.0.0, I see ec2-34-213-0-0.us-west-2.compute.amazonaws.com as the company name. However, if I enter that same IP address on the ipinfo.io ip-to-company page (https://ipinfo.io/ip-company-api), it correctly returns Amazon Technologies, Inc. as the company name. I’m not sure exactly how the ipcinfo.io site is finding the company name, but it’s what we’re looking for.
I did clone your git repo so I can take a look at what you’re doing. I’m really hoping I can get this working as it’s what I’ve been looking for.
Thanks again for your help!
-Jeff
From: Romain Biard [mailto:notifications@github.com] Sent: Wednesday, January 27, 2021 5:05 AM To: Romain/Matomo-IP-to-Company Matomo-IP-to-Company@noreply.github.com Cc: Jeff McGroary jeff@aristoscompany.com; Mention mention@noreply.github.com Subject: Re: [Romain/Matomo-IP-to-Company] Plugin Not Capturing Company Name (#10)
Hi @jmcgroar https://github.com/jmcgroar , thanks for reaching out to me to let me know about this issue. Guessing the name of the company behind the IP is something that is not 100% reliable. To do this, I use the a function called gethostbyaddr as mentioned in the documentation https://github.com/Romain/Matomo-IP-to-Company#how-reliable-is-this-data . As I say in the doc:
This function returns the name of the company provided by the proxy used by the user. Most of the big companies have their own proxy set up with a real name configured. But SMBs may not and in this case, you could see the name of their ISP appear.
From my experience, ~5% of company names can be catch this way, but it also depends on who visits your website.
Connecting IpInfo can help a bit, but in your situation, it seems that it only catches the name of the ISP through which the visitor is connecting to your website, which is not a relevant information. That's why I don't save it in the DB, and that's why I don't display any information about the company itself. You can try it directly on their website https://ipinfo.io/ and see the result.
I hope that this answers your question.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Romain/Matomo-IP-to-Company/issues/10#issuecomment-768176022 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACBSGYKZE5BG2Y7J3UYQYTLS37QNZANCNFSM4WQC6VLA . https://github.com/notifications/beacon/ACBSGYJ4EJX6HYEC4W3NYMLS37QNZA5CNFSM4WQC6VLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOFXEW7FQ.gif
This email was scanned by Bitdefender
Thanks for these additional explanations @jmcgroar. Feel free to submit a PR if you think that you can improve the name detection, I'll be glad to review it!
Hi Romaine,
I did some poking around with the ipInfo API. It looks like the company name is in the “org” field rather than the “hostname”. The “hostname” – if it’s present – has the DNS name. From the sample hits I’ve tested, the “hostname” is often not present at all. That would explain why I’m not seeing many company names in my website hits.
Here’s a sample JSON response from one of our hits:
{
"ip": "131.247.0.0",
"city": "Tampa",
"region": "Florida",
"country": "US",
"loc": "27.9475,-82.4584",
"org": "AS5661 UNIVERSITY OF SOUTH FLORIDA",
"postal": "33606",
"timezone": "America/New_York"
}
This hit displayed with no company name on the Matomo dashboard because there is no “hostname” field. But, if we make the change to use the “org” field, I think we’ll be good. I think I’ll make the change locally here and let it run for a while to see how it works. With the change, I think I’ll also parse out the AS Code at the beginning of the “org” field and just leave the AS Name.
I’ll let you know how it goes.
Thanks again,
-Jeff
From: Romain Biard [mailto:notifications@github.com] Sent: Thursday, January 28, 2021 3:13 AM To: Romain/Matomo-IP-to-Company Matomo-IP-to-Company@noreply.github.com Cc: Jeff McGroary jeff@aristoscompany.com; Mention mention@noreply.github.com Subject: Re: [Romain/Matomo-IP-to-Company] Plugin Not Capturing Company Name (#10)
Thanks for these additional explanations @jmcgroar https://github.com/jmcgroar . Feel free to submit a PR if you think that you can improve the name detection, I'll be glad to review it!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Romain/Matomo-IP-to-Company/issues/10#issuecomment-768878825 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACBSGYJ6QIDPXIPBIYVDMXLS4EMB5ANCNFSM4WQC6VLA . https://github.com/notifications/beacon/ACBSGYOZBRNNAJ765J3VB6DS4EMB5A5CNFSM4WQC6VLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOFXKCR2I.gif
This email was scanned by Bitdefender
Hi Romaine,
I figured out the problem at our site. We have a self-signed certificate on the web server we’re using for testing. I found that the PHP-CURL call to ipInfo was failing because it doesn’t like self-signed certificates.
I fixed the problem were locally be just adding the line:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
In the getRequestDetails() call in IPInfo.php.
It works great now! I also see that your code was nice enough to go back in and fill-in the missing company information in the previous hits. Nice!
Thanks for helping me work through this.
Best,
-Jeff
From: Jeff McGroary [mailto:jeff@aristoscompany.com] Sent: Thursday, January 28, 2021 3:54 PM To: 'Romain/Matomo-IP-to-Company' reply@reply.github.com; 'Romain/Matomo-IP-to-Company' Matomo-IP-to-Company@noreply.github.com Cc: 'Mention' mention@noreply.github.com Subject: RE: [Romain/Matomo-IP-to-Company] Plugin Not Capturing Company Name (#10)
Hi Romaine,
I did some poking around with the ipInfo API. It looks like the company name is in the “org” field rather than the “hostname”. The “hostname” – if it’s present – has the DNS name. From the sample hits I’ve tested, the “hostname” is often not present at all. That would explain why I’m not seeing many company names in my website hits.
Here’s a sample JSON response from one of our hits:
{
"ip": "131.247.0.0",
"city": "Tampa",
"region": "Florida",
"country": "US",
"loc": "27.9475,-82.4584",
"org": "AS5661 UNIVERSITY OF SOUTH FLORIDA",
"postal": "33606",
"timezone": "America/New_York"
}
This hit displayed with no company name on the Matomo dashboard because there is no “hostname” field. But, if we make the change to use the “org” field, I think we’ll be good. I think I’ll make the change locally here and let it run for a while to see how it works. With the change, I think I’ll also parse out the AS Code at the beginning of the “org” field and just leave the AS Name.
I’ll let you know how it goes.
Thanks again,
-Jeff
From: Romain Biard [mailto:notifications@github.com] Sent: Thursday, January 28, 2021 3:13 AM To: Romain/Matomo-IP-to-Company <Matomo-IP-to-Company@noreply.github.com mailto:Matomo-IP-to-Company@noreply.github.com > Cc: Jeff McGroary <jeff@aristoscompany.com mailto:jeff@aristoscompany.com >; Mention <mention@noreply.github.com mailto:mention@noreply.github.com > Subject: Re: [Romain/Matomo-IP-to-Company] Plugin Not Capturing Company Name (#10)
Thanks for these additional explanations @jmcgroar https://github.com/jmcgroar . Feel free to submit a PR if you think that you can improve the name detection, I'll be glad to review it!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Romain/Matomo-IP-to-Company/issues/10#issuecomment-768878825 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACBSGYJ6QIDPXIPBIYVDMXLS4EMB5ANCNFSM4WQC6VLA . https://github.com/notifications/beacon/ACBSGYOZBRNNAJ765J3VB6DS4EMB5A5CNFSM4WQC6VLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOFXKCR2I.gif
This email was scanned by Bitdefender
hi @jmcgroar
Thanks for investigating on this. If the results are good for you, feel free to submit a PR, I'll be happy to review it!
Thanks for your nice comments on this plugin.
Hi Romaine,
I think that for most people using your plug-in, it’ll work just fine as-is. It’s just that we have this self-signed certificate that was causing us a problem. My guess is that very few people will be in a similar situation.
One change I would like to make is to have the companies sorted so that they appear in the dashboard widget with the most recent visit first. I do see a line this snippet of code which seems to have something to do with sort order:
// This defines in which order your report appears in the mobile app, in the menu and in the list of widgets
$this->order = 26;
Is this the line I should change in order to get the companies sorted in descending order by LAST VISIT time? If so, what should I change this value to? If I’ve missed the mark (always a possibility :)), where can I make the modification to affect the sort order for the IP-to-Company widget?
As always, thanks for your assistance. Much appreciated.
-Jeff
From: Romain Biard [mailto:notifications@github.com] Sent: Monday, February 1, 2021 7:40 AM To: Romain/Matomo-IP-to-Company Matomo-IP-to-Company@noreply.github.com Cc: Jeff McGroary jeff@aristoscompany.com; Mention mention@noreply.github.com Subject: Re: [Romain/Matomo-IP-to-Company] Plugin Not Capturing Company Name (#10)
hi @jmcgroar https://github.com/jmcgroar
Thanks for investigating on this. If the results are good for you, feel free to submit a PR, I'll be happy to review it!
Thanks for your nice comments on this plugin.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Romain/Matomo-IP-to-Company/issues/10#issuecomment-770826861 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACBSGYIINWXOZAHCTMZN2RLS42OJHANCNFSM4WQC6VLA . https://github.com/notifications/beacon/ACBSGYKQQHLRVER6D4FG7T3S42OJHA5CNFSM4WQC6VLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOFXY6E3I.gif
This email was scanned by Bitdefender
Hi @jmcgroar ,
Thanks for this follow-up. I'm glad to hear that the issue is a corner-case that you identified and that it's not really related to the plugin itself.
With regards to sorting the visits, I don't think that the parameter you're pointing out is what you're looking for. From my understanding of Matomo and how to develop a plugin in Matomo, there's not much we can do to change this sorting on our side, since I use the live plugin to get the results. This plugin takes parameters (id of the site, period of time, date, segment, ...). He is the one responsible for sorting the result.
The only solution I see to your need is to create a PR on this plugin to add an optional parameter to it and be able to decide how the results should be sorted.
I hope this helps. Let me know if you see any other approach.
Cheers, Romain
Hi There,
I just installed your IP2Company plugin on matomo 4.1 running on Windows Server 2016/IIS 10 with PHP 7.4.13. I installed it from the matomo Marketplace.
It's all working fine in that it is capturing hits and displaying them in Companies widget on the dashboard. But, the company column is blank. Well, actually, it's "-". All the other columns are populated correctly.
The IP address which appears in the Companies widget on the matomo dashboard is 73.114.0.0. (I'm connected to a Comcast (Xfinity) WiFi hotspot.)
Any thoughts on what might be the problem?
Thanks,
-Jeff