Support » Plugin: Slimstat Analytics » Wrong Geolocation for RFC 1918 Private IP Ranges

  • Resolved tkleinsteuber

    (@tkleinsteuber)


    Hi,

    We are using WordPress for an Intranet site and all users come from RFC 1918 defined private IP Ranges. Slimstat is mapping those addresses to multiple countries around the World.
    It would be nice if we could specify the Location of specific subnets but at least there should be no wrong Country displayed in the stats.

    Thanks.

    http://wordpress.org/plugins/wp-slimstat/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Jason Crouse

    (@coolmann)

    Good catch. We’ll make sure to mark those IP’s as ‘local’, and skip the geolocation piece.

    A vote for SlimStat would be a nice way to say thank you!

    Camu

    Thread Starter tkleinsteuber

    (@tkleinsteuber)

    Done and thanks a lot.

    I also have a Suggestion for a nice plugin/extension for those who use Slimstat internally like us. It would be great if we could define Locations based on Subnets and then could see on the geo reports our different locations. Wouldn’t mind paying a bit for it too.

    Thorsten

    Plugin Author Jason Crouse

    (@coolmann)

    We already offer an add-on that allows you to label your IP addresses 😉

    Thread Starter tkleinsteuber

    (@tkleinsteuber)

    Do you mean the “Label your IP Addresses” plugin? If I understand the description properly this will show hits from defined IP-addresses as know visitors overwriting the (maybe) existing username but will have no effect on the Location?

    What I want to do is to show the hits from our different sites as different locatins. All the users are known users but they may have different Locations (within the same Country). I still want to retain the original username with the Addition of the Location.

    Plugin Author Jason Crouse

    (@coolmann)

    You are correct. We can develop a custom add-on for you, if you want…

    Thread Starter tkleinsteuber

    (@tkleinsteuber)

    I tried the updated Version but it is not working. After looking into the source code I’ve seen that the block in “_get_country($_ipnum = ”)” who compares it to the local IP Ranges get’s a negative signed Long IP. The values to compare against however are unsigned.
    According to the php documentation for “ip2long()” which says that the function may return a signed value I send the results of “ip2long” through “sprintf(“%u”, <ip2longresult>)” for all assignments in “_get_ip2long_remote_ip()”. After that it seems to work for me. I could only test with local IP’s though.

    Plugin Author Jason Crouse

    (@coolmann)

    If you look at lines 341 and 342, we already do that 😉

    self::$stat['ip'] = sprintf("%u", $long_user_ip);
    if (!empty($long_other_ip) && $long_other_ip != $long_user_ip)
      self::$stat['other_ip'] = sprintf("%u", $long_other_ip);
    Thread Starter tkleinsteuber

    (@tkleinsteuber)

    Yes, but in line 346 when getting the Country you are using

    self::$stat['country'] = self::_get_country($long_user_ip);

    If I read the code correctly the original value $long_user_ip is used and not the previously converted value.
    You probably need to Change line 346 to

    self::$stat['country'] = self::_get_country(self::$stat['ip']);

    Plugin Author Jason Crouse

    (@coolmann)

    You are correct, indeed 🙂

    Plugin Author Jason Crouse

    (@coolmann)

    Fixed in 3.4.2. Thanks!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Wrong Geolocation for RFC 1918 Private IP Ranges’ is closed to new replies.