MaxMind's GeoIP Integration
What is GeoIP?
With GeoIP you can detect where your visitors are coming from. You can use this information to deliver personalized information, reducing credit card fraud, analyzing web server logs.
About MaxMind
Founded in 2002, MaxMind is an industry-leading provider of geolocation and online fraud detection tools.
MaxMind provides its geolocation technology through the GeoIP brand. By accurately pinpointing the location of Internet customers and visitors by country, geographic region, down to the granular detail of city in real-time, MaxMind enables online businesses to have a valuable marketing tool as well as the ability to customize their websites to better serve clients.
How to integrate AbleCommerce powered store with MaxMind
First of all you need to have data file containing GeoIP information. In order to write this WIKI topic I used a free data file available at MaxMind GeoLite City Binary Format.
- . Download the MaxMind GeoLite City Binary Format database from MaxMind
- . Extract GeoLiteCity.dat.gz zip file and place GeoIP.dat file into your store's App_Data folder.
- . Extract csharp2_1_10.tar.gz file and move cityExample.cs,countryExample.cs, netspeedExample.cs, orgExample.cs, regionExample.cs file to some other folder. Those are samples and will help you under stand how to use available API classes to get information.
- . Move remaining API classes to your store's App_Code folder.
- . Now you can query data against IP address to find location information as below
<code> string path = Server.MapPath("~/App_Data/GeoIP.dat"); LookupService lookupService = new LookupService(path, LookupService.GEOIP_STANDARD); Location location = lookupService.getLocation("ipAddress here"); Response.Write(location.countryName); </code>