This plugin is no longer maintained.

Setting the Variable

{% set location = geocookie() %}

The location variable gives you access to the geolocation data.

Example Response

{
  "ip": "8.8.8.8",
  "city": "Mountain View",
  "region": "California",
  "region_code": "CA",
  "country": "US",
  "country_name": "United States",
  "postal": "94035",
  "latitude": 37.386,
  "longitude": -122.0838,
  "timezone": "America/Los_Angeles",
  "asn": "AS15169",
  "org": "Google Inc."
}

Caching

If an active cookie matching the cookie name in the settings exists, the plugin will use the location stored within the cookie instead of performing another API request.

To check if a cookie exists simply use location.cached which will return a boolean true/false response.

Installation Instructions

To install this plugin, copy the command above to your terminal.

Active Installs
21
Version
1.3.3
License
MIT
Compatibility
Craft 3
Last release
September 12, 2018