Troubleshooting ad pausing and unpausing


Ad Manager
AdSense and Ad Exchange

Why ads might fail to pause

The main reasons why the Consent Tool might not pause the ads, along with solutions, are listed below.

1. The setting is set to "Load non-personalized ads while the user is choosing" instead of "Pause ads while the user is choosing".

If this is the case, change the setting and allow 5 minutes for the Consent Tool to update.

2. The ads are called before the Consent Tool is initiated.

In certain cases, ad units might be called before the Consent Tool has a chance to invoke corresponding pausing mechanism.

3. Some other code on the page initiates refresh() of Ad Manager ad units.

Other scripts on the page can call refresh() of ad units. You can use Google Publisher Console to detect this behavior.

4. Advertising is shown by ad tags other than Ad Manager and AdSense

By default, the Consent Tool only pauses Ad Manager and AdSense tags. If you have tags from other vendors on the site, they can communicate with the Consent Tool using CMP Javascript API, which is a standard part of the IAB's Transparency and Consent Framework. Alternatively, the tags can be paused and unpaused using the Consent Tool's simplified API.

If you use Google Tag Manager to show ad tags, please refer to our GTM integration guide.

Some ad units fail to show

After the user decision, the Consent Tool refreshes all ad units on the page. If new ad units are dynamically added on the page later (for example, when the new content is loaded in an infinite scroll), they need to be refreshed manually using refresh() method after calling display().

Callback queue pausing solution

To help you solve more complicated cases, we've created the ultimate weapon - a queue-based pausing/unpausing solution.

The following code will allow pausing any ads, but is customized for AdManager. Any parts can be ommited if there is no need in them.

// initialize Ad Manager globals
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];

// Consent tool logic ready queue
var consentCallbackQueue = (function(window, undefined) {
    let timeoutCallInSeconds  = 5; // false to disable

    let queue                 = [];
    let startImmediately      = false;
    let consentCallbackCalled = false;

    let addFunction = function (callback) {
        if (startImmediately) {
        } else {

    let runQueue = function () {
        startImmediately = true;, i){
            if (callback !== undefined) {
                queue[i] = undefined;

  	// callback which is executed by CCT code upon consent state determination
    (window.__lxG__consent__ = window.__lxG__consent__ || {}).consentCallback = function(consentState){
        consentCallbackCalled = true;

        if (consentState === null) {
            // consent not applicable, non-eu user, executing queue right away
        } else if (consentState === -1) {
            // eu user, consent interface shown, cmp loaded, user has not decided yet
        } else if (consentState === 0) {
            // eu user, consent rejected, for custom advertisements systems be sure to turn on anonymous ads here
        } else if (consentState === 1) {
            // eu user, consent accepted, executing the queue

    // in case of network problems in loading consent.js
    if (timeoutCallInSeconds) {
        setTimeout(function () {
            if (!consentCallbackCalled) {
                // notify code there is no consent
                if (console && console.log) {
                	// debug message
                    console.log('consentCallbackQueue timeout call');

                // force-disable personalized ads, if not implemented in __lxG__consent__.consentCallback
                if (window.googletag.pubads) {
                } else {
                    window.googletag.cmd.unshift(function () {
                // calling function to trigger logic
        }, timeoutCallInSeconds*1000);

    return {
        push: addFunction

// function to display AdManager slot by it`s div ID
// it supports automatic slot refresh if disableInitialLoad was called before
function displayAndRefreshSlotById(slotId) {
    consentCallbackQueue.push(function () {
        googletag.cmd.push(function () {
            if (window.google_DisableInitialLoad) {
                googletag.pubads().getSlots().forEach(function (slot) {
                    if (slot.getSlotElementId() == slotId) {
            } else {

// you should replace 
// googletag.cmd.push(function () {
//     googletag.display('div-id-1');
// });
// with
// displayAndRefreshSlotById('div-id-1');

The core of the logic is a special callbacks queue, which is consecutively executed upon consent determination (either user decides in the UI or consent state is read from the cookies). This queue mechanism is also fully functional for non-EU users, so no need for geo-based logic branching.

In the example above, there is also an utility function (displayAndRefreshSlotById) which incorporates adding callback to the consent queue and triggering display and refresh for the AdManager slot found by its div ID. Implementaion may vary for other advertising systems.

Back to top