Global Office Directory
More Products
Share this page
Home > Community > Technical Blogs > John West Sitecore Blog > Spoof an IP Address to Test GeoIP Lookups with the Sitecore Customer Engagement Platform
This blog post describes how you can spoof an IP address to test GeoIP lookups with the Sitecore Customer Engagement Platform (CEP).
GeoIP information is increasingly important to creating dynamic, personalized web sites, so much so that Sitecore believes (somewhat subjectively) that in the Digital Marketing System (DMS - previously OMS), GeoIP lookup routines are the APIs used most frequently in the content delivery environment. This is definitely the case in the http://sitecore.net implementation.
When working with Sitecore, if you use a single machine as both the browser client and the web server, such as when doing development on your workstation, the server likely sees the IP address of the client as 0.0.0.0 or 127.0.0.1. GeoIP information providers do not return information about reserved IP addresses.
You can implement a solution based on this prototype startTracking pipeline processor that overrides the IP address associated with the client. If tracking is active and if GeoIP information is availble for the request, if the current request is associated with either of the two IP addresses listed previously, this processor uses the handy Sitecore.Web.WebUtil.ExecuteWebPage() method to retrieve a dynamic web page that contains only the public IP address of the server, and overrides the client's IP with that address. You could use this approach to handle other requirements, such as testing specific IP addresses.
Note the use of the Tracker.Visitor.DataContext.GetGeoIp(). This method associates an IP address record with the request rather than associating an IP address with the request. If two visits come from a single IP address, the result is a single record in the database. This reduces storage requirements slightly, but more importantly, simplifies various aspects of reporting.
To use the prototype, add the processor after the existing InitializeTracker processor in the startTracking pipeline defined in the /App_Config/Include/Sitecore.Analytics.config file:
<startTracking> <processor type="Sitecore.Analytics.Pipelines.StartTracking.InitializeTracker,Sitecore.Analytics" /> <processor type="Sitecore.Sharedsource.Analytics.Pipelines.StartTracking.OverrideIPAddress, assembly" />...
Tags: API, Architecture, Infrastructure, Website Visitor Context, Personalization, GeoIP
- Lieven Praet May 25, 2011 at 6:15 AM
- John West May 25, 2011 at 7:43 AM
- Jason Georgiades June 13, 2011 at 4:09 AM
- Jason Georgiades June 13, 2011 at 5:14 AM
John has over ten years of experience in the CMS industry. His areas of focus include the Sitecore community, Web industry research, Sitecore technical documentation, and product management.
This website is designed to be fully functional with scripts disabled in browser. Please contact the webmaster for any suggestions