Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support sizemapping for responsive ads #87

Closed
prebid opened this issue Oct 28, 2015 · 22 comments
Closed

Support sizemapping for responsive ads #87

prebid opened this issue Oct 28, 2015 · 22 comments
Assignees
Labels
Milestone

Comments

@prebid
Copy link
Collaborator

prebid commented Oct 28, 2015

As a publisher using GPT's sizemapping feature, I'd like Prebid.js to auto detect the browser size and read from my GPT sizemapping array, so that Prebid.js can send out ad requests for different ad sizes depending on the user's browser size.

Acceptance Criteria

  1. On load, Prebid.js detects the browser size.
  2. Prebid.js reads an optional passed in sizemapping array for screen width>ad sizes
  3. Prebid.js will use the optimal sizes in sizemapping, instead of the sizes passed in the adUnits, as the size to pass into header bidding partners.
  4. Prebid.js will clean up the targeting, so that if GPT refreshes the ad call, the same header bidding ad from the previous round will not be served twice.

GPT's sizemapping feature:
https://support.google.com/dfp_premium/answer/3423562?hl=en

If user resizes the browser and GPT refreshes the ad slots with different sizes, header bidding partners cannot easily participate in that round of auction
Because GPT does not have a callback when it detects the resize of a page. Thus when GPT issues a new ad request when it detects a page resize, header bidding partners do not have time or the opportunity to run an auction.

@geoff616
Copy link

For mappings defined inside googletag.cmd like in the example here: https://support.google.com/dfp_premium/answer/4578089?hl=en the mapping variable isn't accessible from outside that function's scope.

It is possible to pull out the sizes defined inside the googletag object by iterating over: googletag.pubads().X to pull out the valid sizes for each slot, but this involves something like accessing: googletag.pubads().X[0].I.j[0].j to get the sizes for one of the slots.

Do you think we can assume the mapping will be defined as a global? If not, do you think it makes sense to pull the out of the object directly? Another option appears to be parsing the DFP log, but that is less obvious than pulling out of each slot in the googletag object.

Re numbers 1-3 above, would you prefer prebid to determine the size of the window and parse the sizes out of the mapping itself, or just copy what DFP has determined are valid sizes inside the googletag object? The latter appears to be simpler to implement, have less risk of getting out of sync with DFP, and would be more straight forward in cases where there are multiple size mapping arrays applying to different kinds of slots on the same page (i.e. one size mapping for 2 leaderboards and another size mapping for 2 sidebars).

@nickjacob
Copy link
Collaborator

the 2nd option would be awesome. Found this API which I think will work -- when you call getSizes() it checks the sizemapping against (what looks like) the window, so it's the eligible sizes

I was using one of the obsfucated property paths in another project & it changed when google recompiled GPT, but hopefully this one is a real (just undocumented) api --

screen shot 2015-10-29 at 1 31 46 pm

slot.getSizes()

@7LayersDesign
Copy link

getSizes() is what we have been using for our responsive slot size checks. We also got burned by a GPT recompile when using the GPT object keys. I really wish Google would update GPT. Last I checked the getSizes() is undocumented, but we have not had issues with it failing. Would be nice if they would at least update the docs so we know what is safe or not.

@mkendall07
Copy link
Member

Thanks for the idea @geoff616 & @nickjacob unfortunately the way we integrate with GPT is after the auction takes place so we need to know the sizes up front. In order to use slot.getSizes() we need to wait for GPT to load before calling the bidders. If there is another way or this can be done without waiting for GPT I'd be interested in learning more.

@prebid
Copy link
Collaborator Author

prebid commented Dec 1, 2015

We're working on this ticket this week and should have the proposed solution out in the ticket description in 2 weeks.

@mjwhaley
Copy link

@mkendall07 Has there been any update on this subject?

I have pushed live a client with a responsive website and we are now seeing some winning ad's delivering into the wrong size ad sizes. Most ad units have multiple sizes and we are using sizemappling to deliver different sizes based on the users screen size. I'm assuming the wrong size adverts and size mapping are linked.

@BartVB
Copy link
Contributor

BartVB commented Dec 22, 2015

There seems to be a mostly functional version with responsive sizes in git. We are also waiting for this to stabilise. In the meantime we use something like this:

var BrowserWidth = window.innerWidth && document.documentElement.clientWidth ? Math.min(window.innerWidth, document.documentElement.clientWidth) : window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth;

pbjs.que.push(function(){
    var adUnits = [
        {
        code: 'div-gpt-ad-firstpost',
          sizes: (BrowserWidth > 740) ? [728, 90] : [300, 250],
          bids: [
            {
                bidder: 'appnexus',
                params: {
                    placementId: (BrowserWidth > 740) ? '1234' : '5678'
                }

Works well enough for the time being.

@mkendall07
Copy link
Member

We are currently working on a solution for this. You can see the work in progress here:
https://github.com/prebid/Prebid.js/tree/gpt_sizemapping

Example usage : https://github.com/prebid/Prebid.js/blob/gpt_sizemapping/integrationExamples/gpt/gpt_sizemapping.html#L130

Any feedback on this solution is welcome. I expect we will merge it in early January once we are confident it's working as expected.

@mjwhaley
Copy link

@mkendall07 @BartVB Do you both think this issue is causing the wrong size ad frame to load around an say larger ad?
I'm currently passing multiple bid offers on the same ad unit to the same SSP as below. Each offer is for a different size with the same ad unit. Is there a way to pass the size with it in an effort to stop the above issue happening.

            bidder: 'appnexus',
            params: {
                placementId: '*******'
            }
        },{
            bidder: 'appnexus',
            params: {
                placementId: '********'
            }
        },{
            bidder: 'appnexus',
            params: {
                placementId: '********'
            }

@mkendall07
Copy link
Member

@mjwhaley any sizes you define into a adUnit are assumed to be "safe" to be delivered there. If you are auto sizing based on screen resolution you need to request only those sizes that would fit into the adjusted size. It sounds like this feature will resolve it for you.

@mjwhaley
Copy link

@mkendall07 Thanks. I will have a look at the solution above. The part i'm find strange is that I'm offering out a 970x250, 970x90 and 300x250 (via the same AdUnit) and the winning bid is a 970x250, but DFP then sizes the window to a 300x250 and then delivers the advert.

@mkendall07
Copy link
Member

You may need another line item with the correct size that matches to the 'hb_size' param. I'm not a DFP expert so I could be wrong.

@mjwhaley
Copy link

mjwhaley commented Jan 8, 2016

@mkendall07 I've been working on this issue for quite few days now and have even setup additional line items in DFP targeting only, but with no luck sorting it.
I have come across something though.
I have set the script up with multiple AppNexus calls per ad unit as below, to hopefully get different bids per adsize.

//UNIT 1
code: 'ad-leader-lg',
sizes: [[970, 90], [728, 90]],
bids: [{
//970x90
bidder: 'appnexus',
params: {
placementId: '',
referrer: '**
',
alt_referrer: '**
'
}
},{
bidder: 'rubicon',
params: {
rp_account: '**
',
rp_site: '**
',
rp_zonesize: '**
'
}
},{
bidder: 'aol',
params: {
placement: '**
',
sizeId: '**
',
alias: '**
'
}
},{
//728x90
bidder: 'appnexus',
params: {
placementId: '**
',
referrer: '**
',
alt_referrer: '**
'
}
},{
bidder: 'rubicon',
params: {
rp_account: '**
',
rp_site: '**
',
rp_zonesize: '**
'
}
},{
bidder: 'aol',
params: {
placement: '**
',
sizeId: '**
*',
alias: '**
*****'
}
}]
},{

But what seems to be happening is the adapter takes the placementId and then adds the sizes of [970, 90], [728, 90] from the beginning on the ad unit setup. So in my example above its offering the placement twice for each size instead of once per size, as i was expecting it to work.

Is this assumption correct?

@chaqu170
Copy link

chaqu170 commented Apr 8, 2016

@mkendall07 - I was wondering what happened to this URL?

https://github.com/prebid/Prebid.js/tree/gpt_sizemapping

@jorgepinon
Copy link

Has any progress been made on this request? I just noticed this is the oldest open issue.

I'm setting up prebid with DFP and would like to know how prebid can honor gpt's sizeMapping.

@minsider
Copy link

Agreed with @jorgepinon, any status update?

I found this #108, not sure if this has fully been integrated and tested.

@mkendall07
Copy link
Member

No progress on this unfortunately. We will review PRs for this feature but it's not a priority to build at the moment.

@dmsinger
Copy link

I'm working on my own work-around for the moment. I have to imagine most sites are responsive in some form nowadays. Subscribing to this. Would love to know when it kicks off, and if I learn anything along the way I can add, even better.
(translation: please do this, and if I can help after doing something like it myself, I will)

@minsider
Copy link

Why was it closed?

@James328
Copy link

Agreed with @jorgepinon @minsider @dmsinger, would be nice to have this functionality. So far it seems like custom JS workarounds are required at the moment

@mkendall07 mkendall07 reopened this Sep 19, 2016
@mkendall07 mkendall07 added this to the Prebid 0.14.0 milestone Sep 19, 2016
@mkendall07 mkendall07 changed the title Support GPT sizemapping Responsive Ads Support sizemapping for responsive ads Sep 19, 2016
@mkendall07
Copy link
Member

I've added a PR for this feature here #651

vzhukovsky added a commit to aol/Prebid.js that referenced this issue May 6, 2017
…nc-with-aol-github to aolgithub-master

* commit '0c6c83cc2bfaeeafa9da967c90d83da4af58e7b3':
  Add change log entry.
  Renaming and fix missing semicolon.
  Update parsing script tag regexp.
  Refactoring. Replace stub bids objects, add additional case for rendering pixels.
  Refactoring. Replace test consts by methods.
  Create separate namespace for aol globals, add unit tests.
  Fix unit tests, remove unnecessary spaces.
  Implement render pixels only once feature.
  Add change log entry.
  Add reporting ID for analytics.
  Add Facebook Audience Network adapter
  fix specs
  update version
  fix jslint errors
  Change to using a closure for the callback from ajax to preserve bidObj
  Ensure cookies get sent in request headers (prebid#1069)
  Rz/ajax (#5) (prebid#1042)
@natanavra
Copy link

natanavra commented Jul 19, 2021

@nickjacob response was very helpful for me
This seems to work well, for those of you who don't have access or a list of the size mapping and need it to work out of the box

the 2nd option would be awesome. Found this API which I think will work -- when you call getSizes() it checks the sizemapping against (what looks like) the window, so it's the eligible sizes

I was using one of the obsfucated property paths in another project & it changed when google recompiled GPT, but hopefully this one is a real (just undocumented) api --

screen shot 2015-10-29 at 1 31 46 pm

slot.getSizes()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests