How Display Different Phone Numbers Based On A User’s Geolocation
If your business or website accepts phone calls from people in different locations, it’s a good practice to use different phone numbers for each location to make it easier for people to contact you and boost your call-through rates.
Makes sense, right?
But if you want these different numbers to actually be useful - you need a way to show the right phone number to the right person.
Rather than cluttering things up with a huge list of phone numbers that forces your visitor to find the number that applies to them, the most user friendly way is to display different phone numbers based on a user’s location.
To help you do that, we’re going to dedicate this post to showing you how you can use the Geotargeting Pro WordPress plugin to display a different phone number depending on where a user is visiting from.
How To Change Phone Numbers Based On User Location With Geotargeting Pro
Geotargeting Pro is a WordPress plugin from Geotargeting WP that helps you easily display different content on WordPress based on a user’s geolocation.
With the Geotargeting Pro plugin, you can quickly start displaying different phone numbers based on each visitor’s location.
In fact, the plugin gives you two different ways to get the job done:
- Via simple WordPress shortcodes, which is great if you display your phone number in regular WordPress content or something like a widget
- Via PHP functions that be placed directly in your WordPress theme’s template files
For more information on Geotargeting WP, Geotargeting Pro, and pricing, head here. Otherwise, let’s dig into how to change phone numbers based on location!
How To Change Phone Number With Geotargeting Pro Shortcode
The easiest way to display different phone numbers is via the Geotargeting Pro shortcode builder.
This method should work for regular WordPress content, WordPress text widgets, and anywhere else on your WordPress site that accepts shortcodes.
The approach is simple:
- Use separate shortcodes that target specific countries to display the phone number that’s best for each of those countries
- Optionally, use a fallback shortcode that excludes all those countries from the first step to show a default number to countries that don’t match your targeting criteria.
Let’s say you want to show the following phone numbers:
- Singapore: 111-111-111
- Brazil: 222-222-222
- All other countries: 333-333-333
First, open up the shortcode builder from the WordPress editor interface:
- Select Only show content in
- Enter Singapore as the country
- Click Insert Shortcode
Then, enter the relevant phone number inside the shortcode:
Repeat the same process for Brazil so you see something like this:
Then, to create the default phone number that applies to all other countries, open the shortcode builder and:
- Select Never show content in
- Enter Singapore and Brazil in the country box
- Click Insert Shortcode
Put it all together and you should see something like this on the backend:
To test if the geotargeting is working properly, you can run it through a tool called GeoPeeker to simulate visitors from different locations:
In the screenshot above, you can see that each location sees the relevant phone number automatically!
If you display your phone number directly in your WordPress theme’s template files, you can also use the plugin’s included PHP functions.