1

I'm receiving an array with empty values when trying to get visitor info using the Smart Map plugin and its Visitor Geolocation feature. I'm using MaxMind's free trial ($5 worth of queries) since FreeGeoIp.net is not recommended and I've double checked the plugin settings and cleared all caches. Looking at the MaxMind account there are no queries logged and my map/debug output has empty location values via PHP (screenshot). Working locally on a .dev domain, running Craft 3 RC and tried FreeGeoIp.net as well but to no avail.

Twig:

{% set visitor = craft.smartMap.visitor %}
{% if visitor %}
  <pre>{{ dump(visitor) }}</pre>
{% endif %}

Output:

 array(8) {
  ["ip"]=>
  bool(false)
  ["city"]=>
  bool(false)
  ["state"]=>
  bool(false)
  ["zipcode"]=>
  bool(false)
  ["country"]=>
  bool(false)
  ["latitude"]=>
  bool(false)
  ["longitude"]=>
  bool(false)
  ["coords"]=>
  bool(false)
}
3
  • Hmm. Could this be part of my problem? craft.app.request.userIP is returning string(3) "::1". A PHP config issue? Using MAMP Pro on macOS FWIW. Mar 15 '18 at 2:41
  • Good theory... Oddly, I just did some testing locally, and wasn't able to reproduce the problem. Hit me up on Slack via DM, and we can troubleshoot it together.
    – Lindsey D
    Mar 15 '18 at 4:20
  • 1
    Thanks for connecting on Slack Lindsey! I'll be sure to post an answer here when we get to the bottom of it. Great plugin support. : ) Mar 16 '18 at 17:14
2

Was using the MaxMind free trial and I didn't have the Web Service set correctly in the Smart Map plugin settings. It needed to be set to GeoIP2 City.

1
  • Glad you got it sorted! To be clear (for future readers), it needed to be set to "GeoIP2 City" because that was the package that you paid for. The dropdown needs to match your selected MaxMind subscription package.
    – Lindsey D
    Mar 24 '18 at 17:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.