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

New PAAPI module: topLevelPaapi #11379

Merged
merged 28 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
854afb5
refactor size logic
dgirardi Apr 17, 2024
60159d2
fill in requestedSize on auction configs
dgirardi Apr 17, 2024
5650e3e
topLevelPaapi
dgirardi Apr 17, 2024
365802c
WIP
dgirardi Apr 18, 2024
457accc
getPAAPIBids
dgirardi Apr 18, 2024
42f7abd
include size in paapi bids
dgirardi Apr 22, 2024
c1ba3a1
update TL example
dgirardi Apr 22, 2024
bfbfd1d
Merge branch 'master' into paapi-tls-improve
dgirardi Apr 22, 2024
82f72fe
slightly nicer example
dgirardi Apr 22, 2024
3200b11
slight improvement
dgirardi Apr 22, 2024
1c594f8
refactor
dgirardi Apr 23, 2024
ac43f5b
add PAAPI_ERROR event
dgirardi Apr 23, 2024
ff72e38
use optable in TL example
dgirardi Apr 23, 2024
5db17b9
allow async bid retrieval on render: safeframes
dgirardi Apr 23, 2024
f390f45
allow async bid retrieval on render: renderAd
dgirardi Apr 23, 2024
c94413f
do not force string on requestedSize
dgirardi Apr 23, 2024
914cc14
support rendering of paapi bids
dgirardi Apr 23, 2024
d25db1e
include auctionConfig in events
dgirardi Apr 23, 2024
77e5c2d
fix tests
dgirardi Apr 23, 2024
a9ce33d
overrideWinner; autorun by default
dgirardi Apr 24, 2024
6b57c9d
autorun & overrideWinner
dgirardi Apr 24, 2024
5f37d8f
Merge branch 'master' into paapi-tls-improve
dgirardi Apr 24, 2024
1f2b752
fix tests
dgirardi Apr 24, 2024
d6bd7b0
emit BID_WON for paapi bids
dgirardi Apr 25, 2024
319345c
add no ad server example
dgirardi Apr 25, 2024
361068c
improve bid override logic
dgirardi Apr 25, 2024
807db56
Merge branch 'master' into paapi-tls-improve
dgirardi Jun 3, 2024
07c9ff3
fix lint
dgirardi Jun 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
188 changes: 0 additions & 188 deletions integrationExamples/gpt/top-level-paapi/tl_paapi_example.html

This file was deleted.

134 changes: 134 additions & 0 deletions integrationExamples/top-level-paapi/gam-contextual.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
<html xmlns="http://www.w3.org/1999/html">
<head>
<script src="shared/example-setup.js"></script>
<script src="../../build/dev/prebid.js"></script>

<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>

<script>
var FAILSAFE_TIMEOUT = 3300;
var PREBID_TIMEOUT = 3000;
var adUnits = [{
code: 'div-1',
mediaTypes: {
banner: {
sizes: [[300, 250]],
}
},
ortb2Imp: {
ext: {
ae: 1
}
},
bids: [
{
bidder: 'optable',
params: {
site: 'daa30ba1-5613-4a2c-b7f0-34e2c033202a'
},
},
{
bidder: 'contextual',
params: {
site: 'daa30ba1-5613-4a2c-b7f0-34e2c033202a'
}
}
],
}
]
;

var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];

var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(function () {
googletag.pubads().disableInitialLoad();
});

pbjs.que.push(function () {
pbjs.setConfig({
debug: true,
paapi: {
enabled: true,
gpt: {
autoconfig: false
},
topLevelSeller: {
auctionConfig: {
seller: window.location.origin,
decisionLogicURL: new URL('shared/decisionLogic.js', window.location).toString(),
},
overrideWinner: true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this would mean, if pbjs has a tls pa winner, go with that instead of a possble gam contextual winner? right?

Copy link
Collaborator Author

@dgirardi dgirardi May 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - depending on what you mean by GAM contextual winner. It means that when Prebid is asked to render a contextual ("normal") bid, it will instead render a PAAPI winning bid if it has one for the slot.

In the typical GAM flow (at least typical in our examples, including this one) the bid that is potentially replaced is the Prebid bid that won the Prebid auction, and then the GAM auction, to be replaced by the winner of the PAAPI auction.

}
},
});

pbjs.addAdUnits(adUnits);
requestBids();
});

function requestBids() {
pbjs.adserverRequestSent = false;
pbjs.requestBids({
bidsBackHandler: sendAdserverRequest,
timeout: PREBID_TIMEOUT
});
}

function sendAdserverRequest() {
if (pbjs.adserverRequestSent) return;
pbjs.adserverRequestSent = true;
googletag.cmd.push(function () {
pbjs.que.push(function () {
pbjs.setTargetingForGPTAsync();
googletag.pubads().refresh();
});
});
}

setTimeout(function () {
sendAdserverRequest();
}, FAILSAFE_TIMEOUT);

googletag.cmd.push(function () {
googletag.defineSlot('/41758329/integ-test', [[300, 250], [300, 600]], 'div-1').setTargeting('creative', 'banner-safeframe').addService(googletag.pubads());

googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>
</head>

<body>
<h2>GAM contextual + Publisher as top level PAAPI seller example</h2>

<p>
This example starts PAAPI auctions at the same time as GAM targeting. The flow is
similar to a typical GAM auction, but if Prebid wins, and got a
PAAPI bid, it is rendered instead of the contextual bid.
</p>
<div id="controls">
<script>addExampleControls(requestBids)</script>
</div>
<h5>Div-1</h5>
<div id="div-1" style='min-width: 300px; min-height: 250px;'>
<script type='text/javascript'>
googletag.cmd.push(function () {
googletag.display('div-1');
});
</script>
</div>
<div style="margin-top: 20px">
<h2>Instructions</h2>
<p>Start local server with:</p>
<code>gulp serve-fast --https</code>
<p>Chrome flags:</p>
<code>--enable-features=CookieDeprecationFacilitatedTesting:label/treatment_1.2/force_eligible/true
--privacy-sandbox-enrollment-overrides=https://localhost:9999</code>
<p>Join interest group at <a href="https://www.optable.co/">https://www.optable.co/</a>
</p>
</div>
</body>
</html>
Loading