How to Geotarget Blocks in the WordPress Block Editor (Gutenberg)

Want to geotarget blocks in the new WordPress "Gutenberg" block editor?

With WordPress 5.0 - launched in December 2018 - WordPress got a brand new editor. Dubbed Gutenberg while under development, this editor brings a new block-based approach to content creation in WordPress.

Beyond giving you more flexibility to create content, this block-based approach also opens up some really interesting ways to geotarget your WordPress content.

With Geotargeting WP and Geotargeting Pro, you can geotarget individual blocks in the WordPress block editor. Or, you can also geotarget groups of blocks, rather than just a single block.

In this post, we'll show you step-by-step how to geotarget WordPress Gutenberg blocks with Geotargeting Pro.

Let's dig in...

How to Geotarget Blocks in the WordPress Block Editor (Gutenberg)

Step 1: Install and Activate Geotargeting Pro

To geotarget Gutenberg blocks in WordPress, you'll need the Geotargeting Pro plugin from Geotargeting WP.

This plugin is free to download and includes a 14-day free trial, so you can follow this tutorial without spending a penny. After the 14-day trial is up, plans start at just $9 per month.

To get started, sign up for Geotargeting WP and download the Geotargeting Pro plugin. Then, install and activate the plugin at your WordPress site.

Once you've done that, go to the API Keys section of your Geotargeting WP account and:

  • Add your website to the Allowed domains box

  • Note the API Key and API Secret - you'll need to copy and paste them into the plugin's interface

geotargetingwp dashboard


Then, go to the GeoTargetingWP tab in your WordPress dashboard and paste in your API key and API secret:

geotargetingwp settings


Once you save your changes, your WordPress site should be connected to your Geotargeting WP account and you're ready to start adding geotargeting to Gutenberg blocks.

Step 2: Add One of Geotargeting Pro's Geotargeting Blocks

Next, open the block editor for the content that you want to add geotargeting to:

block editor geotargetingwp


To geotarget Gutenberg blocks, you'll essentially "wrap" the block(s) that you want to geotarget in one of the new Geotargeting blocks that Geotargeting Pro adds.

To add one of these blocks, open the insert block interface and find the Geotargeting section. Choose the block that applies to the type of geotargeting you want to implement:

geotargeting wordpress block


For example, to geotarget at a country level, you'd choose the Target Countries block.

Step 3: Configure Geotargeting Rules

Next, use the Block sidebar to choose which countries or regions you want to target. Note that you can use both Include and Exclude rules to target countries.

For example, to target blocks to only visitors from Argentina, you'd configure it like this:

gutenberg block


Geotargeting Pro will also add text to the block itself to help you keep track of which countries you're targeting, but this text will not display to visitors on the front-end of your site.

Step 4: Add Regular Gutenberg Blocks "Inside" The Geotargeting Block

Now, to add the content that you want to geotarget, you can add regular Gutenberg blocks inside the geotargeting block:

gutenberg geotargeted block add block


Or, you can also drag existing blocks into the geotargeting block.

For example, if you wanted to geotarget one paragraph block and one button block, it might look like below. To verify that the blocks are going to be geotargeted, you can hover over the geotargeting block and look for the blue outline - any blocks inside that blue outline will be geotargeted according to your rules:

gutenberg geotargeted block


And that's it! Once you publish or update your content, all the blocks "inside" a geotargeting block will only display to visitors from the countries that you defined in the geotargeting block's settings.

You can also add multiple geotargeting blocks (and sub-blocks), each with their own unique set of geotargeting rules.

That's How to Geotarget WordPress Gutenberg Blocks

We hope you found this guide on how to geotarget Gutenberg blocks helpful. And remember - Geotargeting Pro isn't just for Gutenberg blocks, you can also use it to geotarget entire posts, widgets, menu items, and a whole lot more!

To get started for free, head here to sign up for your 14-day free trial.