Ektron 9.00
Targeting Content with GeoIP Information
GeoIP support lets you target your messaging to specific audiences based on current geographical location. Ektron uses a site visitor’s IP address to detect the location. For example, your eCommerce website may have a special sale on snow blowers. That information is relevant to people in northern climates but of no interest to those living in the tropics. Or, a site visitor uses a cell phone to find the nearest store location, and the Ektron Map server controla server control uses API language to interact with the CMS and Framework UI to display the output. A server control can be dragged and dropped onto a Web form and then modified. displays a map of nearby stores based on the user's current latitude and longitude.
Ektron maintains GeoIP information in a cookie only while a visitor uses the site. When the visitor exits, Ektron deletes the cookie. Ektron obtains the following information from the IP address of your site visitors. (The values are only examples.)
Ektron includes GeoLite data created by MaxMind. You can purchase more accurate GeoIP databases from MaxMind.
Ektron retrieves the IP address information from a site visitor's IP address via 3 databases. The databases are installed to your site root's App_data
folder and listed in your site's web.config
file.
NOTE: The tilde character (~) in the value
element represents the site root folder.
<!-- GeoIP City Database -->
<add key="GeoIpCityDatabase" value="~/App_Data/GeoLiteCity.dat"/>
Returns the following information, based on IP address:
<!-- GeoIP Organization Database -->
<add key="GeoIpOrgDatabase" value="~/App_Data/GeoIPOrg.dat"/
>
Returns the organization name, based on IP address.
- GeoIP Domain Database -->
<add key="GeoIpDomainDatabase" value="~/App_Data/GeoIPDomain.dat"/>
Returns the domain name, based on IP address.
If you want to move the databases to another folder, you must update their web.config value
elements to the new location.
Best Practice
You should keep the GeoIP databases in the App_data folder, because this folder prevents unauthorized copying of the database.
Among the Targeted Content widgetWidgets are mini-applications that you place on a Web page using PageBuilder; a widget provides either specific functionality (calculators, search, social bars, etc.) or areas into which you can add content (content blocks, list summaries, collections, and so on).'s criteria is User Regional Info, which has 2 options: Country and US Regions.
If you choose US Regions, you can select from states in the United States.
User Regional Info data uses GeoIP information. See Also: Creating and Using Widgets
You can center a map on a specific location by using the Map server control's latitude
and longitude
properties. You also can use GeoIP information to obtain a user's latitude and longitude, based on IP address. For example, if a site visitor searches for a chain restaurant, the map can indicate restaurants near the user.
The following code shows how to set up the Map server control to populate latitude and longitude with GeoIP information.
Sample .aspx page, showing the placement of the Map server control.
<cms:Map ID="uxMap" runat="server" />
Code-behind page in C#
Ektron.Cms.UserLocationData userLocationData = Ektron.Cms.UserContext.GetCurrentUserLocationInfo(); if(userLocationData != null) { uxMap.Latitude = userLocationData.Latitude; uxMap.Longitude = userLocationData.Longitude; }
The following APIApplication Programming Interface code demonstrates the retrieval of a user's GeoIP information. Note that Ektron.Cms.UserContext.GetCurrentUserLocationInfo()
returns the Ektron.Cms.UserLocationInfo()
object, which provides access to all elements listed in retrieving IP address information except IP address.
To obtain the IP address, use Ektron.Cms.UserContext.IP
.
Ektron.Cms.UserLocationData userLocationInfo = Ektron.Cms.UserContext.GetCurrentUserLocationInfo(); //If GeoIpCity.dat/GeoIpLiteCity.dat file is present in webconfig int AreaCode = userLocationInfo.AreaCode; string City = userLocationInfo.City; string CountryCode = userLocationInfo.CountryCode; string CountryName = userLocationInfo.CountryName; double Distance = userLocationInfo.Distance(userLocationInfo); int DMACode = userLocationInfo.DMACode; double Latitude = userLocationInfo.Latitude; double Longitude = userLocationInfo.Longitude; int MetroCode = userLocationInfo.MetroCode; string PostalCode = userLocationInfo.PostalCode; string Region = userLocationInfo.Region; string RegionName = userLocationInfo.RegionName; // If GeoIpOrg.dat file and GeoIpCity.dat/GeoIpLiteCity.dat file // is provided in web config string Organization = userLocationInfo.Organization; // If GeoIpDomain.dat and GeoIpCity.dat/GeoIpLiteCity.dat file // is provided in web config string Domain = userLocationInfo.Domain;