Prebid.js icon indicating copy to clipboard operation
Prebid.js copied to clipboard

GPT Managed OutOfPage ad slots iframe is not resized

Open danielguedesb opened this issue 4 years ago • 3 comments

Type of issue

bug

Description

Using GPT Managed interstitial slots (https://developers.google.com/publisher-tag/samples/display-web-interstitial-ad), prebid's creative is not resized to its expected size, it stays at 1x1 and the ad is not visible.

Steps to reproduce

  1. Create gpt managed OutOfPage ad slot
  2. Setup prebid with an appropriate configuration and ad units i.e pbjs.addAdUnits({ code: 'GAM_AD_UNIT_CODE', mediaTypes: { banner: { sizes: [[300, 250], [300,600], [320,480], [336,280], [480,320]] } }, ortb2Imp: { instl:1 }, bids: [{ bidder: 'appnexus' ... }] })
  3. Request bids, Prebid wins and prebid's universal creative is served (https://cdn.jsdelivr.net/npm/prebid-universal-creative@latest/dist/creative.js)

Expected results

Ad Iframe resized to match hb_size size

Actual results

Ad Iframe remains at 1x1 but contains width and height attributes with its expected values. I.e. width=300 height=600

Other information

GPT Managed OutOfPage slots render the add inside a second iframe:

ad_slot_div [ id=ad_slot_id_0__container ] --- Iframe1 [ id=google_ads_iframe_ad_unit_code_0 ] ------ Iframe2 [ id=ad_iframe ] -------- Prebid Universal Creative code

danielguedesb avatar Dec 16 '21 16:12 danielguedesb

seems to be a partial dupe of #interstitial

patmmccann avatar Dec 16 '21 16:12 patmmccann

Setting frameElement's style.width and style.height after this sets the correct size:

doc.defaultView.frameElement.style.width = width + 'px';
doc.defaultView.frameElement.style.height = height + 'px';

It doesn't seem to cause any issue / unwanted behaviour at first glance but I'm keen on hearing other opinions. Thoughts?

danielguedesb avatar Dec 16 '21 19:12 danielguedesb

It does look like this is a duplicate of https://github.com/prebid/Prebid.js/issues/5917. Chris and I discussed and put a suggestion over there. Closing this. @danielguedesb - you can re-open if you disagree that it's a duplicate.

bretg avatar Dec 16 '21 20:12 bretg