I work for an e-commerce company that operates solely within the United States. However, the price of goods and availability of our products depends on what State or even Zip Code you reside in (we sell alcohol).

I know that there are techniques for localized SEO on a national scale, but I was wondering if there is anyway we can do it on a Provence/State scale. I have been searching for an answer but everything seems to be on the international scale.

For example, we would prefer it if Google/Bing/Yahoo knew the location of their visitors and could point them to:






Is there anyway to convey this information to the search engines with either canonical tags or another approach?

2 Answers 2


Unfortunately, the only options to Geotarget your website in search engines are by country/region.

However, you can accomplish the same thing using MaxMind, which offers a GeoIP City database that breaks down visitors by:

  • Postal/Zip Code
  • City Name
  • Metro Code
  • Latitude & Longitude

When visitors arrive at your website, their IP address can be compared against this database using the above criteria, for example zip code, and redirected to the appropriate URL of your e-commerce site.

You can integrate this with your website using a number of different server-side language API's:

  • PHP
  • Python
  • Perl
  • Ruby
  • Java
  • C#
  • C ...

Many of these have easy to use open source modules. For example, I use this PHP extension: Geo IP Location, as well as this Perl module: GEO-IP

There's a free version of the database, GeoLite, which is updated once a month, and a more accurate paid version, GeoIP City. You can try an an online demo here.

There's also a JavaScript Client API, available in a paid and free version (the free version only requires an attribution statement on your website). This combines both W3C Geolocation and their GeoIP2 Web Service, which first attempts to get the visitor's location from their browser, and if not available or inaccurate, it then uses a GeoIP lookup.

It's interesting to note that the Sample Code displays your current location live on their site, so you can see what values are returned for your browser right now. For States, look under subdivisions -> iso_code

In addition to the sample code, there's a tutorial on how to use the API here: GeoIP2 JavaScript Tutorial


Even if the search engine does know the state of the visitor they aren't going to provide this information to you, so you're going to need to try and work this out on your side.

I'm not from the US but I believe over there you can detect the city (and thus state) of a user's IP address with reasonable accuracy, so I'd suggest doing this when someone lands on your site, but also have a dropdown in the top right corner (or similar) so they can change it if you get it wrong. Also don't forget that even if your site operates solely within the US, your site will get international traffic, so have a sensible default for non-US users.

Store this value in the user's session, rather than the URL to avoid issues with indexing.

  • We already do prompt them for their ship to state when they arrive at our site. That is unfortunate, that there is not a way to provide provincial/state level canonical information. We are incorporating schema microdata on our site that includes the offers/stock availability/prices for each region that we ship to. I'm going to leave the question open in case somebody has a different answer. I'll select your answer in a day or two, if no one else responds.
    – Greg
    Commented Jun 14, 2013 at 18:53
  • Are you auto-detecting the state based on IP, or just prompting them? I'd suggest investigating the former if you're not, if it works in most cases it should help. Tricky problem though. Commented Jun 14, 2013 at 20:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.