Changing Ad Size Based on Browser Width in DFP

后端 未结 3 1456
Happy的楠姐
Happy的楠姐 2021-01-23 16:42

In DFP Small Business / DoubleClick, I generated the following ad tag for an ad unit with three different sizes along with one creative for each specified sizes. So there are th

3条回答
  •  遇见更好的自我
    2021-01-23 17:19

    You cannot really control the width of the line-item that will be served to the user based on his device width/height straight from dfp configuration.

    What you can do is - . While triggering the ad specify the size according to the device width/height. For e.g if the device is smaller than 600px in width then only use the smallest ad size to trigger. E.g

     if(window.innerWidth < 800){
         googletag.defineSlot('ADID', [[292, 195]], 'domid')
      }
    

    Check these two demo links, they trigger the same adunit with different sizes.

    320x50 - http://tinyurl.com/q2x3562

    300x250 - http://tinyurl.com/o3vx4qk

提交回复
热议问题