Geo-Targeting WordPress Content to Personalize Your Site

    Jenni McKinnon
    Jenni McKinnon

    So what does that phrase mean, “Geo-Targeting WordPress Content”? First, let’s back up and look at an example of personalization.

    After a decade of steadily declining sales, Coca-Cola turned its fortunes around by simply adding names to Coke bottles. The company’s “Share a Coke” campaign created a personal connection with consumers that fueled sales. After all, why wouldn’t you buy a drink with your name on it?

    Nutella soon followed suit, taking the idea a step further by allowing customers to add their own names to jars. Soon enough, people were rushing to show off their personalized jars on social media.

    So what do Coca-Cola and Nutella have to do with WordPress?

    Well, what these brands achieved are clear examples of the power of personalization. Consumers now expect content online that is unique to them, so much so that 74% of customers feel frustrated when website content is not personalized. And marketers know this – 52% of digital marketers consider the ability to personalize web content to be fundamental to their online strategy. The problem? Only 32% say their CMS enables personalization.

    Fortunately, WordPress is not one of these CMSs. There are plenty of tools and plugins for WordPress that make it easy to personalize content for visitors, but by far the easiest way to personalize site content is with geo-targeting.

    What is Geo-Targeting?

    Geo-targeting is a way for websites to serve specific content to visitors based on their geographic location, usually their country or city via their IP address.

    This technique isn’t new – it’s been around so long that it has become ubiquitous. Google provides search results tailored to your location in the world, Amazon offers personalized home pages with recommended products, and eBay displays local currencies.

    A more recent example of geo-targeting is WordPress itself. The recent 4.8 release includes a new dashboard widget that displays upcoming WordPress events tailored to your geographic location.

    WordPress Events

    Using Google Analytics to Determine Visitor Location

    You can use Google Analytics to learn more about your visitors and where they’re from.

    Just log in to Google Analytics. Go to Audience > Demographics > Geo > Location.

    Google Analytics

    You’ll see a map of the world color-coded to match your audience demographic and underneath a more detailed breakdown of your audience, including the countries where they are located, sessions, new users, bounce rate, transactions and revenue.

    You can use this information to inform how you want to personalize content on your website. For example, based on the geo data in the Google Analytics profile above, you might want to:

    • Add German translations to your site
    • Put more time into promoting content to Americans (e.g. tailor promotions around U.S. holidays)
    • Inform German visitors that you’re collecting their information in compliance with the EU Cookie Law.
    • Connect with your visitors by welcoming them in a way appropriate to their location (e.g. Say “G’Day!” to Australian visitors) and even add humor or location-specific references
    • Display testimonials of customers from the same location as your visitors
    • Let US, Canadian, Australia, UK and Germany visitors know that you deliver to their location

    Using Geo-Targeting with WordPress

    Let’s look at a simple example of how you can personalize your website content: displaying tailored welcome messages to visitors from different countries.

    Displaying a Welcome Message

    Scenario: Let’s say you run an online store specializing in hats. While your caps are selling off the proverbial shelves thanks to the summer heat, you have an over supply of winter hats and they are gathering dust. Fortunately, it’s winter in Australia – a perfect opportunity to target customers in the land down under and sell off stock.

    For this example, I want to display an alternate welcome message on my homepage that displays only to visitors from Australia. Visitors from other countries will see a standard welcome message advertising a sale.

    Step 1: Install Plugins

    We’ll use a few free plugins available in the WordPress Plugin Directory to implement this example, specifically:

    Custom Content by Country is a simple plugin that uses shortcodes to show or hide content to visitors based on their location. We’ll use Custom Content by Country to start geo-targeting WordPress content by the visitor’s location – we can start by simply using it to display an alternate welcome message.

    I want to display the alternate message over my theme’s header, so I’m using Widgets on Pages to add a widget to the header.

    Lastly, Shortcode Widget will allow me to easily use shortcodes on my site without having to add a filter to my functions.php file or create a child theme.

    Step 2: Create a Custom Widget

    For this example I’m using the Zerif Lite theme, a popular free theme in the WordPress Theme Directory. Here’s what it looks like freshly installed:

    Zerif Lite Theme

    I want to display my own custom message instead of the generic message included with Zerif Lite and I’ll use a custom widget to achieve this.

    First, we’ll make a few changes to the theme:

    • Replace the header image
    • Remove the green button
    • Replace the red button text.

    Now, let’s create a custom widget for the header using Widgets on Pages. Go to Widgets on Pages > Turbo Sidebars and click “Add New Turbo Sidebar.”

    Give your widget a name – in my case “Header Widget” and click “Update”; then copy the shortcode provided.

    In your theme files, add the shortcode where you want to display the alternate text. In my case, I want to display the text in the header. So in the Zerif Lite theme I’ll edit big_title.php and replace the line




    Click “Update File” to saves your changes.

    Obviously, it’s best practice to create a child theme before editing any WordPress files. But for the sake of simplicity, I’m making direct changes to files for this example.

    Step 3: Add Shortcode to Widget to Display Custom Welcome Messages

    Go to Custom Content > Content by Country and click to enable the first option, “Enable Content by Country Feature”. This option is disabled by default so it’s important to check this option before continuing.

    Next, go to Appearance > Widgets. You’ll see there’s a new “header_widget” widget. You’ll also see a new Shortcode Widget listed in the available widgets section.

    Drag the Shortcode Widget onto header_widget. In the content area, paste in the shortcodes for the Custom Content by Country widget. Here’s my example:

    [CBC show="y" country="au"]Brr! It’s cold outside!<br />Let’s warm up your noggin![/CBC]
    [CBC show="n" country="au"]Looking for a great hat? <br />Sale on now![/CBC]
    Adding shortcode

    To explain, the first shortcode will display “Brr! It’s cold outside! Let’s warm up your noggin!” to visitors from Australia since “show” is set to “y” which means “yes”.

    The second shortcode will display “Looking for a great hat? Sale on now!” to all visitors who are not located in Australia, since I’ve set “show” to “no”.

    Click “Save”.

    Here’s what it looks like on the front-end:

    Shortcodes for Geo-Targeting WordPress Content

    Not exactly easy to see the text.

    It contains the second message for non-Australian visitors because I’m located in Canada. If you have a VPN, turn it on and set your location to somewhere in Australia, which is what I’m going to do (of course, if your visitors are using VPNs, their locations will be masked and setting up geo-targeting WordPress content may not make much of a difference, but the percentage of visitors behind VPNs is going to be low).

    Displaying Alternate Message

    Voilà! Looking good! Sort of. It definitely needs some styling. Let’s fix that.

    Step 4: Add CSS Styling

    Styling output from the Custom Content by Country plugin is pretty straight forward using the provided classes.

    Open the CSS file for your theme or child theme and add the following for some simple styling:

    .cbc_content {

    Now refresh the frontend to see what it looks like.

    Final Result Display

    So that’s a very simple example of how geo-targeting WordPress content can work in tandem with personalizing content, and how you can easily display different content on your site to visitors from different countries.

    Geo-targeting WordPress Content Using Plugins

    While Custom Content by Country is a great free option, there are many other free and premium plugins available for adding geo-targeting features to WordPress.

    • Geolify (premium) – This premium SaaS allow you to geo everything on your site, including redirects, links, content, pop-ups, notification bars, images, JavaScript, and also block visitors back on location.
    • GEO my WordPress (free) – This free plugin works with posts, pages, and custom post types. It also works with BuddyPress so members can add their location.
    • WP Geo (free) – Another free option, WP Geo lets you set a physical location to a post and embed that information using a Google map.
    • GEO my WP (premium) – This premium plugin offers lots of advanced options for geo-targeting WordPress content, including options for post types and BuddyPress, proximity search forms, Google Places address auto-complete, nearby locations, and current user location.
    • GeoIP Detection (free) – This simple, free plugin provide geographic information detected by an IP address, which you can then use in themes and plugins. This plugin is aimed at developer who can then hook into that information .
    • GeoTargeting Lite (free) – Similar to Custom Content by Country, this plugin uses shortcodes to display content to users based on their geographic location.
    • Geotargeting WP (premium) – This API service enables developers to start geo-targeting WordPress content on any part of their site, including posts, pages, custom post types such as WooCommerce products, widgets, menus and template files.


    Geo-targeting WordPress content provides a relatively easy way to personalize content for users based on their location. While the example in this tutorial was fairly basic, hopefully it’s shown you what is possible with a few free plugins. I encourage you to experiment with geo-targeting on your own sites to see what you can achieve! Let us know in the comments below about your experiences with geo-targeting in WordPress!

    Frequently Asked Questions (FAQs) on Geo-Targeting WordPress Content

    What is Geo-Targeting and how does it work in WordPress?

    Geo-Targeting is a method used to deliver different content to a website user based on their geographical location. This is achieved by determining the user’s IP address. In WordPress, this can be done using various plugins that allow you to customize your content based on the location of your visitors. These plugins work by detecting the IP address of the visitor and then serving content that is specifically tailored to their location.

    How can Geo-Targeting benefit my WordPress site?

    Geo-Targeting can significantly enhance the user experience on your WordPress site. By delivering content that is relevant to a user’s location, you can increase engagement, improve conversion rates, and boost your SEO efforts. For instance, you can display local news, weather updates, or special offers that are specific to a user’s location.

    Are there any free Geo-Targeting plugins for WordPress?

    Yes, there are several free Geo-Targeting plugins available for WordPress. These include GeoTargeting Lite, WP Geolocation, and GeoIP Detection. However, the features offered by free plugins may be limited compared to premium options.

    How can I set up Geo-Targeting on my WordPress site?

    Setting up Geo-Targeting on your WordPress site involves installing a Geo-Targeting plugin, configuring the settings according to your needs, and then applying the Geo-Targeting rules to your content. The exact process may vary depending on the plugin you choose.

    Can I use Geo-Targeting to display different languages on my WordPress site?

    Yes, Geo-Targeting can be used to display different languages on your WordPress site. By detecting the location of your visitors, you can automatically serve content in their native language, thereby enhancing their user experience.

    Is Geo-Targeting legal?

    Yes, Geo-Targeting is legal. However, it’s important to respect user privacy and comply with data protection regulations. Always inform your users if you’re using Geo-Targeting and give them the option to opt-out if they wish.

    Can Geo-Targeting affect my site’s SEO?

    Geo-Targeting can have both positive and negative impacts on your site’s SEO. On the positive side, it can improve your site’s relevance and engagement, which are key ranking factors. On the negative side, if not implemented correctly, it can lead to duplicate content issues.

    Can I use Geo-Targeting for mobile users?

    Yes, Geo-Targeting can be used for mobile users. Most Geo-Targeting plugins for WordPress are responsive and work seamlessly across all devices.

    What are some best practices for using Geo-Targeting on my WordPress site?

    Some best practices for using Geo-Targeting on your WordPress site include testing your Geo-Targeting setup thoroughly, using a reliable Geo-Targeting plugin, respecting user privacy, and regularly updating your Geo-Targeting rules to ensure they remain relevant.

    Can I use Geo-Targeting to display different ads to different users?

    Yes, Geo-Targeting can be used to display different ads to different users. This can be particularly useful for businesses that operate in multiple locations or for advertisers who want to target specific geographical markets.