Introduction
The IP Geo Locator uses GeoLite data created by MaxMind, available from http://www.maxmind.com and uses the geoPlugin service at www.geoplugin.com where you can find detailed information about the service.
Before using this add-on, please read the geoPlugin privacy policy and terms of service carefully and also take careful note of the Terms and Conditions at the bottom of this page.
We recommend you register with geoPlugin to use this add-on: www.geoplugin.com/signup
This add-on attempts to identify your site's visitors by using the IP address returned by PHP's $_SERVER['REMOTE_ADDR'] variable.
NB: Results of the first API call for location data are cached so that subsequent calls to any of the tags on the same page will use the cached results.
Tags and Parameters
This add-on provides the following tags:
- {exp:ip_geolocator:country_code}
- {exp:ip_geolocator:continent_code}
- {exp:ip_geolocator:ip_lookup}
- {exp:ip_geolocator:get_variable}
- {exp:ip_geolocator:is_allowed}
- {exp:ip_geolocator:geo_data} ... {/exp:ip_geolocator:geo_data}
- {exp:ip_geolocator:near_to_user} ... {/exp:ip_geolocator:near_to_user}
- {exp:ip_geolocator:near_to_lat_lng} ... {/exp:ip_geolocator:near_to_lat_lng}
Parameters
You can use the following common parameters in any of the above tags:
currency="GBP" The default base currency. If omitted it will default to "GBP".
language="en" The default language. If omitted will default to "en"
error_action="silent|no_results|fatal_error" Defines how errors should be handled by the add-on. Use one option only: silent = fail silently, no_results = output EE no_results (tag pairs only) and fatal_error = stop the template and display an error.
detect_bots="yes|no" ( default is "yes") Should the plugin detect bots? If so you can choose the behaviour by specifying bot_action below.
bot_action="silent|error" ( default is "silent") If a bot is detected either continue silently or issue a fatal error.
bot_error_message="No Bots allowed" If bot_action is set to "error" then display this message as an EE fatal error. The default message is "No Bots allowed"
Tags
Country Code
Returns the visitor's country code
{exp:ip_geolocator:country_code default="XX"}
Parameters
default="GB" Optional: specify a default country code which will be used if geo location fails. If omitted this will default to "GB".
Continent Code
Returns the visitor's continent code
{exp:ip_geolocator:continent_code default="XX"}
Parameters
default="EU"
Optional: specify a default continent code which will be used if geo location fails. If omitted this will default to "EU".
IP Lookup
Looks up a specific IP address
{exp:ip_geolocator:ip_lookup ip="XXX.XXX.XXX.XXX"}
Parameters
ip="216.58.201.4" - Required: the IP address to lookup. The result is the same as using the Geo Data tag, see below
Get Variable
To display any of the variables returned by the API, use this tag.
{exp:ip_geolocator:get_variable name="XXX" default_country="XX" default_continent="XX"}
Parameters
default_country="FR" Optional, specify a default country if geo location fails. If omitted this will default to to "GB".
default_continent="EU" Optional, specify a default continent code if geo location fails. If omitted this will default to to "EU".
The name parameter can have one of the following values:
- ip
- city
- region
- region_code
- region_name
- dma_code
- country_code
- country_name
- in_eu
- eu_vat_rate
- continent_code
- continent_name
- latitude
- longitude
- location_accuracy_radius
- timezone
- currency_code
- currency_symbol
- currency_converter
Is Allowed?
Check to see if a user's country code is on a supplied list of allowed codes. Returns TRUE or FALSE for use in an EE {if} statement
{exp:ip_geolocator:is_allowed allowed="XX|XX|XX|XX" default="XX"}
Parameters
allowed="XX|XX|XX|XX": Checks to see if the user's country code is included in a supplied list of "allowed" country codes. If the country code cannot be determined then the default country code is used either from the default="" parameter if it's supplied or the internal default set by this add-on.
GEO Data
All geo location data returned by the API call can be displayed using this tag pair.
{exp:ip_geolocator:geo_data} ... {/exp:ip_geolocator:geo_data}
Parameters
default_country="FR" Optional, specify a default country if geo location fails. If omitted this will default to to "GB".
default_continent="EU" Optional, specify a default continent code if geo location fails. If omitted this will default to to "EU".
{exp:ip_geolocator:geo_data}
IP: {ip}
City: {city}
Region: {region}
Region Code: {region_code}
Region Name: {region_name}
DMA Code: {dma_code}
Country Code: {country_code}
Country Name: {country_name}
In EU? {in_eu}
EU VAT Rate: {eu_vat_rate}%
Continent Code: {continent_code}
Continent Name: {continent_name}
Lat: {latitude}
Lng: {longitude}
Location Accuracy Radius: {location_accuracy_radius}
Time Zone: {timezone}
Currency Code: {currency_code}
Currency Symbol: {currency_symbol}
Currency Converter: {currency_converter}
{/exp:ip_geolocator:geo_data}
Nearby
Nearby locations to the visitor can be retrieved using this tag pair:
{exp:ip_geolocator:near_to_user limit="X" radius="X"} ... {/exp:ip_geolocator:near_to_user}
Parameters
limit="5" Limit the number of nearby results. If omitted this will default to 10.
radius="5" Limit the radius nearby results in miles. If omitted this will default to 10.
{exp:ip_geolocator:near_to_user limit="5" radius="20"}
Place: {place}
Country Code: {country_code}
Region: {region}
Lat: {latitude}
Lng: {longitude}
Distance (m): {distance_miles}
Distance (km): {distance_kilometers}
{/exp:ip_geolocator:near_to_user}
Near to Specific Latitude and Longitude
This tag pair enables you to feed in specifc longitude and latitude values to perform a "nearby" search.
{exp:ip_geolocator:near_to_lat_lng} ... {/exp:ip_geolocator:near_to_lat_lng}
limit="5" Limit the number of nearby results. If omitted this will default to 10.
radius="5" Limit the radius nearby results in miles. If omitted this will default to 10.
lat="xxxx" Required: the latitude value
lng="xxx" Required: the longitude value.
NB: The code example below also shows the use of the error_action parameter
{exp:ip_geolocator:near_to_lat_lng limit="5" radius="20" lat="51.4802600" lng="-0.1993000" error_action="no_results"}
Place: {place}
Country Code: {country_code}
Region: {region}
Lat: {latitude}
Lng: {longitude}
Distance (m): {distance_miles}
Distance (km): {distance_kilometers}
{if no_results}
Could not find any results
{/if}
{/exp:ip_geolocator:near_to_lat_lng}
Terms and Conditions
This add-on was created by Climbing Turn Ltd and is provided for free. Use of this add-on is at your own risk. By using this add-on you agree that Climbing Turn Ltd cannot provide any guarantees as to the accuracy of the data provided, the reliability of the add-on or be liable for any loss or damage resulting from the use of this add-on under any circumstances. By using this add-on you are also bound by the terms of the geoPlugin service which can be read here www.geoplugin.com/privacy.
If you do not agree to the above terms, please uninstall the add-on.
We'd love to hear from you if you have any comments or suggestion relating to this software. Please do get in touch using our Contact Form