scaIPLocation 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.
What can you do with scaIPLocation ?
- 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 "scaIPLocation" folder and you will see "scaIPLocation" External Object and the example web panel named "scaIPLocationExample".
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 &scaIPLocation
Both methods will load the below listed information to &scaIPLocation 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 = &scaIPLocation.LoadFromIP(&IP)
&CountryName = &scaIPLocation.countryName
&CountryISO = &scaIPLocation.countryCode
&Region = &scaIPLocation.regionName
&City = &scaIPLocation.city
msg("Error: " + &scaIPLocation.errorMessage)