I tried to collapse a slot and its not working .. apparently dfp mark it as not empty .

googletag.cmd.push(function() {
    googletag.defineSlot('/21323213123/slot', [[1, 1]], 'div-gpt-ad-31331133133-0').setTargeting('site', [ 'foot' ]).setTargeting('category', [ 'home' ]).setTargeting('page', [ '' ]).setTargeting('tag_championnat', [ '' ]).setTargeting('tag_equipe', [ '' ]).setTargeting('page_type', [ 'wp' ]).addService(googletag.pubads()); 

The iframe generated has some tag with javascript in it

1 Answer 1


Collapsing empty slots does not mean not creating them.
DFP will create the slot and then hide it.
Therefore there's no reason to worry about the iframe being generated unless it shows up an empty space.

Also, make sure you add the script in the <head> portion of your page, or it won't work properly.

Collapsing empty div elements

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.