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.
Example
Section titled “Example”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;};Parameters
Section titled “Parameters”None.
Return Value
Section titled “Return Value”- Promise
: A promise that resolves to: - true: htag is disabled and should not show ads
- false: htag is enabled and can show ads
Related Concepts
Section titled “Related Concepts”- handlePriorityCreative: Handle priority creative behavior
- handleEmptyGoogle: Handle empty Google responses
- reduceBidRequest: Modify bid requests
- reducePlacementConfig: Modify placement configuration