How to hide or display ads by Referrer URL

With Advanced Ads Pro, you can display or hide an ad only for users coming to your site from a specific URL, e.g., from the Google search, Facebook, or your newsletter.

You don’t have to make any changes to display an ad on all browsers and devices.

To display an ad to a visitor coming from a specific referrer URL, search for the Visitor conditions meta box and add the Referrer URL condition.

Advanced Ads Referrer URL condition
Once you added the Referrer URL condition, you can choose from various methods to check it.


Display ads only for visitors from Google

A very basic setup to display ads for visitors from Google only would be this one:

Hide ads from direct visitors

You can also use the plugin to hide ads from direct visitors. Simply enter your referrer URL like in the example below (URL here:

When the referrer doesn’t work

The Referrer URL condition doesn’t work when the visitor…

  • entered the site URL in the browser address bar itself.
  • visited the site by a browser-maintained bookmark.
  • visited the site as the first page in the window/tab.
  • switched from an HTTPS-URL to an HTTP-URL.
  • switched from an HTTPS-URL to a different HTTPS-URL.
  • has security software installed (antivirus/firewall/etc.), which strips the referrer URL from all requests.
  • is behind a proxy that strips the referrer URL from all requests.
  • visited the site programmatically without setting the referrer header (search bots!)
  • the source link uses rel=”noreferrer” (now set by default in the WordPress editor, remove it in text mode)


Many services like email newsletters or some URL shorteners are secured. So setting the referrer doesn’t work for them. The best way to ensure this works is to manually set a link on an unsecured site.

Subscribe to our newsletter and get 2 add-ons for free!

* indicates required

What else you need to know

The visitor’s referrer URL is stored as a cookie (advanced_ads_pro_visitor_referrer) in the browser. It is valid 365 days by default. If you want to change this value, adjust the constant in the wp-config.php of your installation.

No referrer URL is stored if the visitor came directly to your site. However, on the second page impression, the first visited page is used as the referer URL. You might use the behavior for rules on direct visits.

Make it better

Increase your ad management skills without spending more time.
Join over 150,000 publishers and AdOpts increasing their ad revenue.