-1

I want to get visitors' latitude, longitude, and country name. I am using the Smart IP module, but it won't show those details.

screenshot

How can I get that data?

I need this information to create view's filters.

1 Answer 1

1

To address your edit about the Views filter requirement, there's a submodule included with the main module, called "Smart IP Views Bridge". It has the functionality you're looking for. An extract from its README:

Smart IP Views Bridge exposes Smart IP visitor's location details to Views field (coordinates, country, ISO 3166 2-character country code, region, region code (FIPS), city and zip) and filter (country, ISO 3166 2-character country code, region, region code (FIPS), city and zip).

Enable that module and the filters you need will become available in Views.

The README goes on to provide full installation and configuration instructions for Views integration, so it's worth reading it thoroughly.

If solving programatically becomes a requirement:

It's right in the module description:

Other modules can use the function smart_ip_get_location($ip_address) in Drupal 6 and 7 and \Drupal\smart_ip\SmartIp::query($ipAddress) in Drupal 8 that returns an array containing the visitor's ISO 3166 2-character country code, longitude, latitude, region (FIPS), city and postal code.

2
  • i need this info in the drupal views for creating the conceptual filters.
    – Karuna
    Commented Apr 12, 2017 at 7:35
  • There's a separate module included (smart_ip_views_bridge), its README has full instructions to set up such a View
    – Clive
    Commented Apr 12, 2017 at 7:44

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