Showing content in WordPress to visitors who are coming from specific referring domains is now possible with Gutenberg + Conditional Blocks.
Referer blocks allow you to display unique content such as discount codes, upsells, or just friendly messages to visitors who are coming to your site from a specific domain referer.
This is a premium condition to change the visibility of WordPress content using Conditional Blocks Pro.
(P.S This block is a Reusable Block + Conditions. It won’t be shown if you’ve purchased Conditional Blocks Pro)
How do referer blocks work?
A referer is the website that links to your site. Conditional Blocks can detect if the visitor has come to your site from a referring site’s domain. You can then specifically target visitors by displaying selected blocks that have the initial website domain set as a referer condition.
Try it out with our site, we have a referer block setup on our homepage from wordpress.org:
- Go to our WordPress plugin page: https://wordpress.org/plugins/conditional-blocks/
- Click on any link from the plugin that goes back to conditionalblocks.com
- You should see a unique block on our homepage that states you’ve come from wordpress.org because wordpress.org is the referer.
Set up referers on a block
It’s easy to set up domain referers on a Gutenberg Block.
- Make sure you have Conditional Blocks Pro up and running.
- Select the block that you want to appear only for the specific domain referer.
- In the right sidebar select Conditions Pro and write the domain you want.
Note: you should write the domain without
www. You can also add multiple domains by comma seperating them like so
conditionalblocks.com, wordpress.org google.com.
There are several reasons why domain refers may not show up as expected, so please look over the following reasons.
HTTP Referer not available
This feature relies on the HTTP referer being sent from the referring domain and properly being read by your website server. Conditional Blocks won’t be able to detect the referring domain if the information is not available.
Some sites don’t want to pass referer information.
Some websites will remove all referring information on their links. This happens when they purposely don’t want the referring information to be passed on. We recommend that you inspect the html of the referring site to verify if they are disabling the information.
rel="noreferrer" inside a html link will hide all referer information from the linked website. The link will look like this as HTML:
<a href="https://conditionalblocks.com" rel="noreferrer">Click Here</a>
You can ask the website owner to not use the
rel="noreferrer" for any links to your site.
WordPress & No Referrer
Some WordPress sites may strip out the referer information by default. In this case it’s possible edit the link manually or use a plugin that removes the no referrer attribute from all links on the site.