Display ads based on URL parameters

With Advanced Ads Pro, you can display or hide an ad based on URL parameters. This option is helpful if you have specific parameters in your URL or want to create additional display conditions.

You don’t have to make any changes to display an ad everywhere. Only use this option to limit where the ad is visible.

To display an ad based on the URL, go to the Display Conditions meta box and add the URL Parameters condition.

URL parameters condition check
Add the URL parameters condition

Once you have added the condition, you can choose from various methods to check it.

Be aware that Advanced Ads does not check the top-level domain. E.g., if your domain is http://example.com/directory/variable, then only /directory/variable is checked against your input. You can add the domain using this code snippet.

Examples of URL parameters checks

Advanced Ads Pro comes with many different types of checks. Here are just some examples of what you might accomplish.

Display ad for subdirectories. URL is http://example.com/capitals/germany/berlin.

The check displays the ad on all pages with /capitals/ in its URL slug.

Display condition URL parameter
This ad unit will only show up on pages with /capitals/ in their URL slug

Hide an ad for visitors who come through a referral link (often used by affiliate programs). The URL is http://example.com/shop/?partnerid=1234.

This ad unit will not show up to visitors who come through a specific referral link

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

* indicates required


The URL parameters condition does not check anchor tags (e.g., https://example.com#anchor).

Changes to the URLs of your page through settings or additional plugins can lead to this condition not working as expected.

The condition works with passive Cache Busting, but we would prefer users not to rely on that in the future.

If you have any questions, don’t hesitate to contact the support.

Make it better

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