GPT (DFP) tag with Responsive design

Bronze Contributor
Bronze Contributor
How can the size of the display ad be changed on the fly (i.e. when the viewport size is changed once the page has loaded) when using the GPT Tag in Tealium?
2 REPLIES 2

GPT (DFP) tag with Responsive design

Employee Emeritus
I'm not sure how to change GPT ad height and width after the ad has shown. I'm guessing you will have to detect the page height/width change and then make another call to GPT to get a new ad with the different sizes. We could update the GPT tag template to support mapping to dynamically set the GPT height/width values. Then, it might work to call utag.view again (when the viewport size changes).. and that would initiate a request to GPT to get a new ad with the new dimensions.

GPT (DFP) tag with Responsive design

Bronze Contributor
Bronze Contributor
You'd have to modify the GPT tag template to disable single request mode, then, using JS, destroy the ad and create a new HTML div with a new unique id. You then need to define a new ad slot using googletag.defineSlot with the new size and then call googletag.display with the new unique id. Its basically a lot of JS.
Public