Content Marketing

How to Redirect Users Based on Their Location in WordPress

A few months ago, a multi-location client of mine asked if we could automatically redirect visitors from specific regions to their internal location pages on the site. At first, I didn’t think it was too difficult a request. I thought I could download an IP address to location database and put a few lines of JavaScript into the pages and we’d be done.

Well, it’s a lot more difficult than you might think. Here are some of the issues you run into:

  • IP addresses are updated on a continued basis. And free GeoIP databases have huge chunks of data missing so accuracy can be a big problem.
  • Internal pages need to be dealt with. It’s easy to redirect someone on the home page, but what about if they land on an internal page? You have to add cookie logic so they can be redirected on the first visit in a session, and then leave them alone as they check out the site.
  • Caching is so necessary nowadays that you need to have a system that treats identifies each user. You don’t want one visitor from Florida going to the Florida page and then every visitor after that.
  • Requests for data with every user on every page can really slow down your server. You need to save each user session so that you don’t have to keep looking up the information over and over.

Each week of use brought more and more issues so I finally gave up and did some research. Thankfully, a company already identified and took care of these issues with a service, GeotargetingWP.  GeotargetingWP is a powerful API service to geotarget content or create geo targeted redirects within WordPress. They’ve built four plugins that can be used depending on your needs:

  1. Geotargeting Pro is the favorite plugin for affiliate marketers for their country specific offers because of it’s simplicity and powerful features. Now with premium accuracy to help you target States and Cities specific content.
  2. Geo Redirects sends users to different web sites based on their location with a few simple steps. Geo Redirects plugin for WordPress it’s a powerful tool that will let you easily create a redirect based on multiple criteria.
  3. Geo Flags is a simple addon for the Geotargeting Pro plugin that will let you display the current user country flag or any other flag that you want by using a simple shortcode like this:
    [geo-flag squared="false" size="100px"]
  4. Geo blocker plugin for WordPress will let you easily block access to users from certain locations. You can block them from accessing your entire site or simple choose which pages.

The platform also allows you to build and utilize regions to target so that you don’t have to create infinite rules based on multiple regions. You can group countries or cities in order to make it easier to target users. As an example, you could create a region called Europe and another called America, and then simple use those names in shortcodes or widgets saving you time. Caching isn’t an issue, either. They detect real user IP no matter if you use Cloudflare, Sucuri, Akamai, Ezoic, Reblaze, Varnish, etc. If you have something custom it can be easily added.

Their API provides top geolocation accuracy, returning continent, country, state and city data. Since the cost is based on usage, you can just connect directly to their API and use it as you’d like.

Get Started with Geotargeting WordPress

Disclosure: We’re using our affiliate link in this post since we like the service so much!

 

Douglas Karr

Douglas Karr is CMO of OpenINSIGHTS and the founder of the Martech Zone. Douglas has helped dozens of successful MarTech startups, has assisted in the due diligence of over $5 bil in Martech acquisitions and investments, and continues to assist companies in implementing and automating their sales and marketing strategies. Douglas is an internationally recognized digital transformation and MarTech expert and speaker. Douglas is also a published author of a Dummie's guide and a business leadership book.

Related Articles

Back to top button
Close

Adblock Detected

Martech Zone is able to provide you this content at no cost because we monetize our site through ad revenue, affiliate links, and sponsorships. We would appreciate if you would remove your ad blocker as you view our site.