An Update on Explaining Sitecore Geographic (GeoIP) Personalization Rules

» 9 min read


By Edward Kapuscinski

Sr. Director, .NET

A number of years ago I wrote a blog post about Sitecore’s GeoIP personalization rules that included explanations of what each rule did and how to use it. I’ve heard that many people have found this post to be useful, but in referencing it in my Personalization for the Masses presentation I’ve discovered that some of the data and links are out of date. To that end I wanted to share an update on some of these rules.

One of the big changes is that nobody refers to Sitecore’s marketing tools as “DMS” anymore. Frequently it’s just called “personalization” or “Experience Management”. Sometimes the data store behind it, “xDB” is used.

As I mentioned previously, geographic targeting is one of the more valuable and accessible routes to taking advantage of Sitecore’s personalization capabilities. This is all still true and even more important now as more of the world has shifted over to consuming the web on mobile devices. Geographic targeting lets you tailor a web experience to the location in which a site visitor originates, providing more relevant content and better user experience. Examples include showing events near a person, showing relevant local news, or highlighting content for users browsing from a store’s wifi.

Improve your customers’ experience by implementing Chatbots into your Digital Commerce strategy.  ||  Sign up today for the latest news about your Digital Transformation.

Sitecore’s experience management tools allow content editors to easily configure the targeting of content based on a user’s location but there are some details of the rules that had been difficult to turn up before my post.

One of the big changes between the time I wrote the initial post and today is how the GeoIP lookup service is provided. It used to be a service provided directly from MaxMind but is now provided through Sitecore themselves. There’s an exciting development here, though: the service is now free for Sitecore licensees. The setup steps from Sitecore still need to be followed to get it working, however.




An Update on Explaining Sitecore Geographic (GeoIP) Personalization Rules



Sitecore still uses its rules engine to make personalization decisions, evaluating the rules a content editor configures to decide what content or presentation components to show a user. The rules that Sitecore provides include a number using GeoIP. These rules cover most of the cases that you may be personalizing for, but sadly the syntax of the values that they need to compare against still isn’t obvious and still requires some explanation.




One thing to keep in mind on a Sitecore site is that because of some quirks in the way GeoIP data is referenced, GeoIP data for a visitor may not be available for that visitors first request. This makes sense, because it could force users to wait a long time while the lookup is performed if pages weren’t served for them until the data was available. IP lookups are cached, so the underlying information will be available for their second request and for subsequent requests coming from that same IP. Sitecore provides a Knowledgebase article on troubleshooting the Geolocation service that also contains helpful information about this caching.




An Update on Explaining Sitecore Geographic (GeoIP) Personalization Rules



I’ll explain how each of the rules is used:



Where the Area Code Compares to Specific Value

This rule allows compares the visitor’s area code to a specified value. MaxMind exposes area codes as digits only, so compare against “410” not “(410)”. There is not much that has changed from this rule.

Our Certified Sitecore Experience Platform and Sitecore MVP’s specialize in helping you deliver seamless contextually personalized customer experiences.


Where the Business Name Compares to Specific Value

In some cases, a business or institution may be available for an IP address. This rule compares against the name of that organization. This rule is not very useful, however, because these values are also made available through the rule that exposes a user’s ISP.

Where the City Compares to Specific City

This rule compares the visitor’s city to the specified value. The list of cities that can be checked against is provided to the Sitecore service by their partner MaxMind. Details of this data can be viewed in a spreadsheet (actually, a CSV) here. This spreadsheet contains the raw data for over 350,000 global locations and can be used to determine the specific city names that Sitecore compares against.

Where the Country Compares to Specific Country

This rule compares the visitor’s country to the content editor specified value. The list of countries that can be checked against is provided to the Sitecore service by their partner MaxMind. Details of this data can be viewed in a spreadsheet (actually, a CSV) here. This spreadsheet contains the raw data for over 350,000 global locations and can be used to determine the specific country names that Sitecore compares against.

Where the DNS Address Compares to Specific Value

This rule is similar to the information provided with Business Name, but is more specific. For example, the company may be “TA Digital”, but the DNS address could read something more like This rule can be useful if you’ve got a very specific use case, especially if you’ve got a site with an internal audience (to target different target to different offices on an intranet, for example).

Where the IP Address Compares to Specific Value

The internet relies on IP addresses to route traffic. They are one of the fundamental building blocks of online communication, so it makes sense that Sitecore lets you target content at users coming from a specific address. This is the rule you use to do just that.  IPs should be supplied to the rule in the standard format:

Where the ISP Name Compares to Specific Value

This rule exposes the ISP that provides the IP address from which the visitor is accessing a website. In my case, this would be “Verizon”, but it could also likely be “Comcast”. Additionally, for traffic coming from a corporate network, the ISP may be the owner of that network. Getting accurate data to supply for these values can be tricky so I recommend using your existing Sitecore analytics data to find the values you may need.

Where the Latitude Compares to Specific Value and Where the Longitude Compares to Specific Value

These rules allow you to target content based on a user’s latitude and longitude. Remember that these rules are based on an IP address and not GPS or location information that a browser or mobile device may be able to provide.

Where the Metro Code Compares to Specific Value

This rule was one of the more confusing at first, but actually turns out to be incredibly useful. Metro codes are another term used for a “Designated Market Area” (DMA). DMAs are areas defined for use by TV and Radio stations but are also useful for all sorts of marketers. The Wikipedia article for Media Markets contains lots of great information about them. The metro code values that correspond to locations can be viewed in the ever helpful MaxMind spreadsheet here.

Where the Postal Code Compares to Specific Value

This rule personalizes based on zip or other postal codes used for mail or package delivery. These codes are available for some IP addresses in Australia, Canada, France, Germany, Italy, Spain, Switzerland, United Kingdom, and the US. In Canada, the first 3 characters are returned, and the first 2-4 characters (outward code) for postal codes in the United Kingdom are provided.

Where the Region Compares to Specific Value

This rule provides personalization choices based on a state, province, or similar geographic unit. The rule should compare against a two-character ISO-3166-2 or FIPS 10-4 code for the state/region associated with US and Canadian IP addresses. The following are also options that may come back for military IPs

  • AA – Armed Forces America
  • AE – Armed Forces Europe
  • AP – Armed Forces Pacific

For all other countries, FIPS codes are also exposed.

The helpful MaxMind CSV file also provides region code data.

There have been a few changes to this information over time, and the one constant in technology is change, but these updates should be helpful for marketers for a little while at least.

    About TA Digital

    TA Digital is the only global boutique agency that delivers the “best of both worlds” to clients seeking to achieve organizational success through digital transformation. Unlike smaller, regional agencies that lack the ability to scale or large organizations that succumb to a quantity-over-quality approach, we offer resource diversity while also providing meticulous attention to the details that enable strategic success.

    Over the past 20 years, TA Digital has positioned clients to achieve digital maturity by focusing on data, customer-centricity, and exponential return on investment; by melding exceptional user experience and data-driven methodologies with artificial intelligence and machine learning, we enable digital transformations that intelligently build upon the strategies we set into motion. We are known as a global leader that assists marketing and technology executives in understanding the digital ecosystem while identifying cultural and operational gaps within their business – ultimately ushering organizations toward a more mature model and profitable digital landscape.

    Recognized in 2013, 2014, 2015, 2019, 2020 and 2021 Inc. 5000 list as one of the fastest growing companies in the United States, TA Digital is pleased also to share high-level strategic partnerships with world class digital experience platform companies like Adobe, SAP, AcquiacommercetoolsSitecore, and Elastic Path.

    Explore TA Digital



    See what we’ve done for our clients – and what we can do for you.



    Our teams specialize in solving your biggest digital transformation challenges.



    Content. Data. Experience. Let us help guide your digital transformation.


    Partners & Platforms

    Put our partnerships with world-class digital experience platforms to work for you.


    Contact Us

    Let’s talk about getting your business where you want it to go.



    Get expert analysis on trends and developments affecting your business.