Geolocation Event
This event is triggered when a visitor geolocation is performed.
# Properties
Property | Type | Description |
---|---|---|
service | string | Which geolocation service was used (ipstack or MaxMind ). |
ip | string | The visitor's IP address (automatically detected by default). |
visitor | Visitor | Complete geolocation lookup results. |
# Example
use doublesecretagency\googlemaps\events\GeolocationEvent;
use doublesecretagency\googlemaps\GoogleMapsPlugin;
use yii\base\Event;
Event::on(
GoogleMapsPlugin::class,
GoogleMapsPlugin::EVENT_AFTER_GEOLOCATION,
function (GeolocationEvent $event) {
// Service used to detect the location
$event->service;
// Visitor's IP address
$event->ip;
// The resulting Visitor Model
$event->visitor;
}
);