Show WordPress Blocks only to visitors from specific referring domains with Conditional Blocks Pro.
Referer blocks allow you to display unique content such as discount codes, upsells, or just friendly messages to visitors who came to your site from a specific domain referer. (Aka another domain such as google.com)
How do referer blocks work?
A referer is a website that links to your site. Conditional Blocks can detect if the visitor came to your WordPress site from a referring site’s domain.
Set up referers on a WordPress block
It’s easy to set up domain referrers 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 separating 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 an 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>Code language: HTML, XML (xml)
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 to edit the link manually or use a plugin that removes the no referrer attribute from all links on the site.
Sites like twitter.com use their own URL shortener ( t.co ) to redirect links from tweets. You’ll need to use the short domain in the domain referer settings.