Skip to content

Disable Rules

Disable Rules allow you to prevent htag from loading ads on specific pages or sections of your website. This is useful for pages where you don’t want to show ads, such as login pages, error pages, or premium content.

Disable Rules are regular expressions that are matched against the current URL. If a match is found, htag will not load any ads on that page. The rules are evaluated both for the canonical URL (if available) and the current URL.

Disable Rules are typically configured through the Adconsole interface, but they can also be added programmatically through the API.

In addition to URL-based disable rules, htag also supports custom disable logic through the window.htag.isDisabled function. This function should return a Promise that resolves to a boolean value indicating whether ads should be disabled.

Here’s an example of how to implement custom disable logic:

window.htag = window.htag || {};
window.htag.isDisabled = async function () {
// Disable ads for premium users
return isPremiumUser();
};

Disable Rules are checked at the following times:

  1. When htag is initialized
  2. When ads are refreshed