IPLocation is an external object that helps us to obtain Geolocation information from an given IP address. It helps to know the location of visitors to a site.
The information provided includes country, region and city, among other data.
The implementation uses MaxMind GeoCity Information (does not require internet connection) to obtain information from an IP or domain.
Download .dat file at: Link
What can you do with IPLocation ?
- Provide the user with specific content depending on the user location
- Set the default language of your site
- Process information from visitors of your site, see what actions users perform according to their location
Only for .NET
Using the control
Go to "Ignia/Controls/IPLocation" folder and you will see "IPLocation" External Object and the example web panel named "IPLocationExample".
The external object have two methods:
- LoadFromIP -> Loads the Location information from IP
- LoadFromDnsHostname -> Loads the Location information from a domain like: "www.simplifica.com.uy"
First, you need to create a scaIPLocation variable, for example &IPLocation
Both methods will load the below listed information to &IPLocation variable.
- Country ISO Code
- Country Name
- City Name
- Region Code
- Region Name
- Postal Code
- Area Code
- Metro Code
- Our experience
We had an excellent experience which includes:
Provide specific content by country or region, for instance, to use regional advertising and to show or hide specific products in any region. In addition, it let us offer sites or regional news in order to build a closer relationship with our customers.
We are only taking into account information about country, region and city.
Not all fields are returned for a given IP, for instance, for certain mobile IP it only returns the country but not the region or city (see scaIPLocation statistics).
Unfortunately, for Uruguay there is not a city department information. Antel gives IPs indiscriminately, and it always returns "Montevideo" as the only city for Uruguay (something similar happens when you use Google Analytics).
The implementation of this library can throw some errors (incorrect IP format, non-existent domain, lack of file "GeoLiteCity.dat", etc).
For this, both methods return an error code, if it is different than zero, you can get more information using property named "errorMessage".
Each month, MaxMind publishes an update of the information, even when the database is not updated it works pretty well. However, we encourage you to to have this database as much updated as possible.
&Error = &IPLocation.LoadFromIP(&IP)
&CountryName = &IPLocation.countryName
&CountryISO = &IPLocation.countryCode
&Region = &IPLocation.regionName
&City = &IPLocation.city
msg("Error: " + &IPLocation.errorMessage)