Geo Cookie


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.


Free

Package Name

To install this plugin, search for its package name on the Plugin Store and click “Install”.


Information

  • Version 1.3.3
  • Last Update 9/12/2018
  • Active Installs 858
  • Compatibility Craft 3
  • License MIT
  • Categories Templating

Report an issue