Skip to content

isDisabled

The isDisabled hook allows you to control whether htag is allowed to show ads. This function is checked before new ad requests are made, giving you the ability to dynamically disable ad serving based on user consent, business logic, or external conditions.

window.htag = window.htag || {};
window.htag.isDisabled = async function() {
// Check business hours (example: only show ads during business hours)
const currentHour = new Date().getHours();
if (currentHour < 9 || currentHour > 17) {
console.log('htag disabled: outside business hours');
return true;
}
return false;
};

None.

  • Promise: A promise that resolves to:
    • true: htag is disabled and should not show ads
    • false: htag is enabled and can show ads