Skip to content

Commit

Permalink
update example formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
dgirardi committed Mar 26, 2024
1 parent 0eafac1 commit ed407f9
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions integrationExamples/gpt/top-level-paapi/tl_paapi_example.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,31 +108,31 @@
});

function raa() {
const cfg = pbjs.getPAAPIConfig();
return Promise.all(
Object.entries(cfg).map(([adUnitCode, auctionConfig]) => {
return navigator.runAdAuction({
seller: window.location.origin,
decisionLogicUrl: new URL('decisionLogic.js', window.location).toString(),
resolveToConfig: false,
...auctionConfig
}).then(urn => {
if (urn) {
// if we have a paapi winner, replace the adunit div
// with an iframe that renders it
const iframe = document.createElement('iframe');
Object.assign(iframe, {
src: urn,
frameBorder: 0,
scrolling: 'no',
}, auctionConfig.requestedSize);
const div = document.getElementById(adUnitCode);
div.parentElement.insertBefore(iframe, div);
div.remove();
return true;
}
});
})
Object.entries(pbjs.getPAAPIConfig())
.map(([adUnitCode, auctionConfig]) => {
return navigator.runAdAuction({
seller: window.location.origin,
decisionLogicUrl: new URL('decisionLogic.js', window.location).toString(),
resolveToConfig: false,
...auctionConfig
}).then(urn => {
if (urn) {
// if we have a paapi winner, replace the adunit div
// with an iframe that renders it
const iframe = document.createElement('iframe');
Object.assign(iframe, {
src: urn,
frameBorder: 0,
scrolling: 'no',
}, auctionConfig.requestedSize);
const div = document.getElementById(adUnitCode);
div.parentElement.insertBefore(iframe, div);
div.remove();
return true;
}
});
})
).then(won => won.every(el => el));
}

Expand Down

0 comments on commit ed407f9

Please sign in to comment.