Looking for a WordPress-friendly way to change website content based on a user’s location?
In this post, you’ll learn how to use a simple geolocation WordPress plugin to change content based on a user’s geolocation, or even restrict access or redirect visitors based on where they’re coming from. In total, you’ll learn how to:
- Change post/page content based on geolocation
- Change widgets or menu items based on geolocation
- Redirect users based on their location
- Restrict access to content based on geolocation
- Change eCommerce product information or restrict product access based on geolocation
That’s a lot of geolocation goodness to cover, so let’s get started!
How Does Geotargeting Work On WordPress?
If you’re reading this post, you probably already know how geotargeting works at a basic level:
Someone visits your site. Then, based on their location, they either see different content or get redirected to a different location.
As you’ve probably figured out by now, WordPress doesn’t include this functionality by default. But with a WordPress geolocation plugin, you can easily add all sorts of geotargeting functionality to various parts of your WordPress site.
In this post, we’re going to show you how to use a geotargeting plugin to change your WordPress site’s content based on geolocation.
Specifically, we’re going to use the Geotargeting WP suite of plugins. This service includes a few different plugins that you can mix-and-match depending on your needs. We’ll focus on:
- Geotargeting Pro – helps you display different content based on a user’s geolocation. It’s what we’ll use for most tutorials.
- Geo Redirects – helps you redirect users to different pages based on their geolocation.
All the plugins are free to install and configure and include a 14-day free trial, so you can get started100% for free.
What About SEO? How Will Google Treat Different Content Based On Location?
If you’re displaying different content based on a user’s location, you might be wondering how Google will treat your content since there’s not a single version.
Well, I can’t speak for other geolocation plugins, but I do know how it works using Geotargeting WP.
Basically, you get to choose which country to treat Google as. For example, if you display one version to visitors from the USA and another to visitors from the UK, you can choose to always show Google the USA version (or vice versa).
I’ll show you how to do this at the end. But for now, let’s dig into the tutorials…
How To Change WordPress Content Based On Geolocation
Let’s start with the most flexible method – how to display different content based on a user’s geolocation.
One common approach here would be to display different ads based on a user’s location. But you can use it for any type of content.
All you’ll need is the Geotargeting Pro plugin installed and activated (here’s how to configure the plugin’s basic settings if you need help).
Controlling What Content Displays For Different Geolocations
For this example, let’s say that you want to display:
- One version of content to users from Argentina
- Another version to visitors from everywhere else
You can be more creative with how you structure things – but this approach will teach you the basic principles that you need to apply to everything else.
Once you have the plugin installed and activated at your site, head to the post or page where you want to display different content based on a visitor’s geolocation.
In the WordPress editor, add the content you want to display for all locations. So you might have duplicate content or you might have two different promotional offers – that’s fine. We’ll fix that in a second!
For this example, you can see I have one bit of text for Argentina and another for everyone else.
Using Include Rules To Target Specific Countries (Or Cities/States)
In the WordPress editor toolbar, look for the new Country GeoTarget Content button. Then, select the first version of your content and click that button:
This will open the Geotargeting Shortcode options where you can choose which geolocations to target.
To target specific locations, you’ll want to select Only show content in. Then, simply type in the location name into the relevant box.
Once you’re done, click the Add Shortcode button:
Using Exclude Rules To Target Everywhere Else
At this point, we have one set of content that will only display to visitors from Argentina.
Now, we want to have the other version display to everyone else but not to people from Argentina.
To do that, you’ll select the content for everyone else and launch the same Geotargeting Shortcode options. Only now, you’ll select the option for Never show content in.
Then, you’ll also want to select the same location(s) as the previous step:
Once you’re done, it should look something like this:
And once you update your post:
- Visitors from Argentina will see version 1
- The rest of the world will see version 2
If needed, you can apply the same principles to display more than two different versions – it’s quite flexible.
How To Display Different Widgets Based On Geolocation
I’ll cover this method more quickly than the previous tutorial because the principles are exactly the same. Only now, you can apply them to widgets.
To display different widgets based on geolocation, you’ll need that same Geotargeting Pro plugin.
From there, you’ll basically add separate widgets for each different version that you want to display based on location. Then, you can use the new Geotargeting options for each widget to control which locations it should be active for:
Again, you can use that same include/exclude approach to display:
- Certain widgets to specific locations
- One general widget to every other location
How To Display Different Menus Based On Geolocation
If you need to display different WordPress menus based on a user’s location, you’ll again use the same Geotargeting Pro plugin approach as the previous two methods.
Once you have the plugin configured, you’ll get a new Geotargeting option in the regular WordPress menu area (Appearance → Menus).
You can create separate menu items for each localized version. Then, you can use the same include/exclude principles to display different menu items based on a user’s location:
How To Redirect WordPress Visitors To Different Content Based On Geolocation
Ok, what if instead of displaying different content based on a user’s location, you want to actually redirect visitors to entirely different pages depending on where they’re coming from.
For example, maybe you want to send them to:
- Their local language if you have a multilingual site.
- A completely localized landing page to boost your conversion rate.
No matter why you want to redirect users based on geolocation, you can use the Geo Redirects plugin from Geotargeting WP.
Once you’ve installed and activated the plugin, go to GeoTargetingWP → Geo Redirects to set up your redirect:
From there, you’ll first use the Redirection Rules area to set up what conditions trigger your redirect. Note that you can use both AND or OR conditions here to add multiple triggers.
For example, you could trigger your redirect if:
- The visitor is from Argentina
- AND they’re visiting your site’s homepage
Once you’ve added the conditions to trigger the redirect, you can use the Redirection Options area to enter the URL to redirect them to. While you can always redirect them to a specific URL, you can also use the variables to dynamically redirect them to different URLs based on the variable:
Beyond entering the Destination URL, you can also see the other options that let you configure:
- How often to redirect users
- Whether or not to exclude search engines
- Technical details like whether to pass query strings and what type of redirect code to use
How To Restrict Access To WordPress Content Based On Geolocation
Rather than displaying different versions of content based on a user’s location, sometimes you just might want to restrict access to certain content based on where a user is visiting from.
With this approach, you can display the regular content to users from certain areas, but show a restricted message to everyone else.
To set it up, look for the new GeoTargeting Options meta box underneath any post or page (you’ll need the Geotargeting Pro plugin).
This box will let you restrict access to the entire post. Beyond the normal options that you’re already familiar with, you also get two additional choices:
- Remove post from loop – when checked, the post will not appear in your blog archive list unless the visitor is from a location that’s allowed to view it.
- Show if user is not allowed to see content – this box lets you customize the message that appears to visitors who aren’t from authorized locations.
How To Show Different eCommerce Products Based On User Location
If you’re running an eCommerce store, you can apply the exact same principles to any of your WooCommerce or Easy Digital Downloads products!
That is, you can:
- Use the Geotargeting WP shortcode builder to display different product description content based on a user’s location.
- Restrict access to products based on a user’s location using the same meta box that you saw above.
Wrap Up & How To Choose Which Version Google Sees
You now know several different ways that you can customize content based on a visitor’s geolocation.
To finish things out, I briefly want to show you how to control which version of your content to use for Google
If you go to GeoTargetingWP → Settings in your WordPress dashboard, you can use the Bots Country drop-down to choose how to treat crawler bots like Google. For example, if you want Google to see the same content as:
- Argentinean visitors, you’d select Argentina.
- United States visitors, you’d select the USA.
If you want to get started, head to Geotargeting WP – your first 14-days are 100% free, and after that prices start at just $9 per month.
Leave a Reply