Difference between revisions of "MaxMind's GeoIP Integration"
(3 intermediate revisions by the same user not shown) | |||
Line 9: | Line 9: | ||
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. | 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''' | + | '''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 [http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz MaxMind GeoLite City Binary Format]. | 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 [http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz MaxMind GeoLite City Binary Format]. | ||
Line 17: | Line 17: | ||
#. Extract ''GeoLiteCity.dat.gz'' zip file and place ''GeoIP.dat'' file into your store's ''App_Data'' folder. | #. 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. | #. 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. | + | #. Move remaining API classes to your store's ''App_Code'' folder and specify some suitable namespace upon them. |
#. Now you can query data against IP address to find location information as below | #. Now you can query data against IP address to find location information as below | ||
<pre> | <pre> | ||
− | |||
string path = Server.MapPath("~/App_Data/GeoIP.dat"); | string path = Server.MapPath("~/App_Data/GeoIP.dat"); | ||
LookupService lookupService = new LookupService(path, LookupService.GEOIP_STANDARD); | LookupService lookupService = new LookupService(path, LookupService.GEOIP_STANDARD); | ||
Location location = lookupService.getLocation("ipAddress here"); | Location location = lookupService.getLocation("ipAddress here"); | ||
− | Response.Write(location. | + | Response.Write(location.city); |
− | + | ||
</pre> | </pre> |
Latest revision as of 11:39, 19 May 2009
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
- . Download the .NET C# library code available here at 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 and specify some suitable namespace upon them.
- . Now you can query data against IP address to find location information as below
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.city);