How can I access the geolocation data detected by If-So in PHP?

If-So detects the visitor’s location using an IP-to-location database, and you can access this data for your own logic or integrations.

Use the following code to retrieve the detected location:

require_once(IFSO_PLUGIN_BASE_DIR. 'services/geolocation-service/geolocation-service.class.php');
$geo_data = \IfSo\Services\GeolocationService\GeolocationService::get_instance()->get_user_location();

Want to capture the user’s location using JavaScript? Learn how