Skip to content

Commit

Permalink
Merge branch 'prebid:master' into master_native
Browse files Browse the repository at this point in the history
  • Loading branch information
PrecisoSRL authored Sep 5, 2024
2 parents 66e3793 + 9c16cfb commit 8887626
Show file tree
Hide file tree
Showing 109 changed files with 10,630 additions and 8,905 deletions.
132 changes: 132 additions & 0 deletions integrationExamples/gpt/symitridap_segments_example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<html>
<head>
<script async src="../../build/dev/prebid.js"></script>
<script async src="https://www.googletagservices.com/tag/js/gpt.js"></script>
<script>
var FAILSAFE_TIMEOUT = 3300;
var PREBID_TIMEOUT = 2000;

var adUnits = [{
code: 'div-gpt-ad-1460505748561-0',
mediaTypes: {
banner: {
sizes: [[300, 250], [300,600]],
}
},
// Replace this object to test a new Adapter!
bids: [
{
bidder: 'appnexus',
params: {
placementId: 13144370
}
},
{
bidder: 'sovrn',
params: {
tagid: 1
}
}
]

}];

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

</script>

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

pbjs.que.push(function() {
pbjs.setConfig({
debug: true,
ortb2: {
user: {
data: [
// DAP segment taxonomy inserted here
]
},
site: {
ext: {
data: {
// DAP SAID will be inserted here
}
}
},
imp: {
ext: {
data: {
// DAP SAID will be inserted here
}
}
}
},
realTimeData: {
auctionDelay: 2000,
dataProviders: [
{
name: "symitriDap",
waitForIt: true,
params: {
apiHostname: "api.dap.symitri.net",
apiVersion: "x1",
domain: "prebid.org",
identityValue: "test@invalid.com",
identityType: "hid"
}
}
]
}
});
pbjs.addAdUnits(adUnits);
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);

</script>

<script>
googletag.cmd.push(function () {
googletag.defineSlot('/19968336/header-bid-tag-0', [[300, 250], [300, 600]], 'div-gpt-ad-1460505748561-0').addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>

<script>!function(a){var e="https://s.go-mpulse.net/boomerang/",t="addEventListener";if("False"=="True")a.BOOMR_config=a.BOOMR_config||{},a.BOOMR_config.PageParams=a.BOOMR_config.PageParams||{},a.BOOMR_config.PageParams.pci=!0,e="https://s2.go-mpulse.net/boomerang/";if(window.BOOMR_API_key="5G3ZS-8L7PG-U23WM-5CA4K-LQ3YP",function(){function n(e){a.BOOMR_onload=e&&e.timeStamp||(new Date).getTime()}if(!a.BOOMR||!a.BOOMR.version&&!a.BOOMR.snippetExecuted){a.BOOMR=a.BOOMR||{},a.BOOMR.snippetExecuted=!0;var i,_,o,r=document.createElement("iframe");if(a[t])a[t]("load",n,!1);else if(a.attachEvent)a.attachEvent("onload",n);r.src="javascript:void(0)",r.title="",r.role="presentation",(r.frameElement||r).style.cssText="width:0;height:0;border:0;display:none;",o=document.getElementsByTagName("script")[0],o.parentNode.insertBefore(r,o);try{_=r.contentWindow.document}catch(O){i=document.domain,r.src="javascript:var d=document.open();d.domain='"+i+"';void(0);",_=r.contentWindow.document}_.open()._l=function(){var a=this.createElement("script");if(i)this.domain=i;a.id="boomr-if-as",a.src=e+"5G3ZS-8L7PG-U23WM-5CA4K-LQ3YP",BOOMR_lstart=(new Date).getTime(),this.body.appendChild(a)},_.write("<bo"+'dy onload="document._l();">'),_.close()}}(),"".length>0)if(a&&"performance"in a&&a.performance&&"function"==typeof a.performance.setResourceTimingBufferSize)a.performance.setResourceTimingBufferSize();!function(){if(BOOMR=a.BOOMR||{},BOOMR.plugins=BOOMR.plugins||{},!BOOMR.plugins.AK){var e=""=="true"?1:0,t="",n="ghh4w4yxem66iyi6ijxa-f-a8f1ed317-clientnsv4-s.akamaihd.net",i="false"=="true"?2:1,_={"ak.v":"32","ak.cp":"540505","ak.ai":parseInt("351538",10),"ak.ol":"0","ak.cr":17,"ak.ipv":4,"ak.proto":"http/1.1","ak.rid":"322de403","ak.r":36326,"ak.a2":e,"ak.m":"dscx","ak.n":"essl","ak.bpcip":"49.207.203.0","ak.cport":5172,"ak.gh":"23.47.149.85","ak.quicv":"","ak.tlsv":"tls1.2","ak.0rtt":"","ak.csrc":"-","ak.acc":"bbr","ak.t":"1629373038","ak.ak":"hOBiQwZUYzCg5VSAfCLimQ==admFPBlxVf0VKeanKFKUThzq+or23aIaVFP5DBXpeOGEuvD5mQz0UZbvK242Y8cupS91bsNaM7uJT3/O00EszGTxlFhkv439YkTWfyegvqVlJhcrZ7jcRkIoyrmjoBqDZoF0WaG4rhwmNzkKEv6T1noRYwEWwRHOG8p7osPXWy5as6KkmhOYUiYk8S5hQj+HFzhYI5YUTx+8urmHdpVIDBkramcrT2V89mb0cH5L2bSGS2hahAA3Kkf+0Dul7r5hDFQaVTf17e4oKdM1G8cKVF5LGRxRl3v4Rn6tBJ+fjrJ7XYQWV30w1LPwcAmSfRX8iTCK4xzHwG1fwDFHb5tWVsxHeEkRgNN3/KhnrCjxKtaROjJeWypJf/rjn1HWHwy7uVVsP9f/HRN3drCCkEvJBmu6yi0jzFFCoeEkbUEoq+8=","ak.pv":"396","ak.dpoabenc":"","ak.tf":i};if(""!==t)_["ak.ruds"]=t;var o={i:!1,av:function(e){var t="http.initiator";if(e&&(!e[t]||"spa_hard"===e[t]))_["ak.feo"]=void 0!==a.aFeoApplied?1:0,BOOMR.addVar(_)},rv:function(){var a=["ak.bpcip","ak.cport","ak.cr","ak.csrc","ak.gh","ak.ipv","ak.m","ak.n","ak.ol","ak.proto","ak.quicv","ak.tlsv","ak.0rtt","ak.r","ak.acc","ak.t","ak.tf"];BOOMR.removeVar(a)}};BOOMR.plugins.AK={akVars:_,akDNSPreFetchDomain:n,init:function(){if(!o.i){var a=BOOMR.subscribe;a("before_beacon",o.av,null,null),a("onbeacon",o.rv,null,null),o.i=!0}return this},is_complete:function(){return!0}}}}()}(window);</script></head>

<body>
<h2>Prebid.js Test</h2>
<h5>Div-1</h5>
<div id='div-gpt-ad-1460505748561-0'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1460505748561-0'); });
</script>
</div>
<h5>Segments Sent to Bidding Adapter</h5>
<div id="user-segments"></div>
</body>
</html>
2 changes: 1 addition & 1 deletion libraries/creative-renderer-display/renderer.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion libraries/creative-renderer-native/renderer.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 72 additions & 0 deletions libraries/detectBrowserUtils/detectBrowserUtils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import { logError } from '../../src/utils.js';

/**
* Detects the browser using either userAgent or userAgentData
* @return {string} The name of the detected browser or 'unknown' if unable to detect
*/
export function detectBrowser() {
try {
if (navigator.userAgent) {
return detectBrowserFromUserAgent(navigator.userAgent);
} else if (navigator.userAgentData) {
return detectBrowserFromUserAgentData(navigator.userAgentData);
}
} catch (error) {
logError('Error detecting browser:', error);
}
return 'unknown';
}

/**
* Detects the browser from the user agent string
* @param {string} userAgent - The user agent string from the browser
* @return {string} The name of the detected browser or 'unknown' if unable to detect
*/
export function detectBrowserFromUserAgent(userAgent) {
const browserRegexPatterns = {
opera: /Opera|OPR/,
edge: /Edg/,
chrome: /Chrome|CriOS/,
safari: /Safari/,
firefox: /Firefox/,
ie: /MSIE|Trident/,
};

// Check for Chrome first to avoid confusion with Safari
if (browserRegexPatterns.chrome.test(userAgent)) {
return 'chrome';
}

// Now we can safely check for Safari
if (browserRegexPatterns.safari.test(userAgent) && !browserRegexPatterns.chrome.test(userAgent)) {
return 'safari';
}

// Check other browsers
for (const browser in browserRegexPatterns) {
if (browserRegexPatterns[browser].test(userAgent)) {
return browser;
}
}

return 'unknown';
}

/**
* Detects the browser from the NavigatorUAData object
* @param {NavigatorUAData} userAgentData - The user agent data object from the browser
* @return {string} The name of the detected browser or 'unknown' if unable to detect
*/
export function detectBrowserFromUserAgentData(userAgentData) {
const brandNames = userAgentData.brands.map(brand => brand.brand);

if (brandNames.includes('Microsoft Edge')) {
return 'edge';
} else if (brandNames.includes('Opera')) {
return 'opera';
} else if (brandNames.some(brand => brand === 'Chromium' || brand === 'Google Chrome')) {
return 'chrome';
}

return 'unknown';
}
35 changes: 35 additions & 0 deletions libraries/paapiTools/buyerOrigins.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
This list is several known buyer origins for PAAPI auctions.
Bidders should add anyone they like to it.
It is not intended to be comphensive nor maintained by the Core team.
Rather, Bid adapters should simply append additional constants whenever
the need arises in their adapter.
The goal is to reduce expression of common constants over many
bid adapters attempting to define interestGroupBuyers
in advance of network traffic.
Bidders should consider updating their interstGroupBuyer list
with server communication for auctions initiated after the first bid response.
Known buyers without current importers are commented out. If you need one, uncomment it.
*/

export const BO_CSR_ONET = 'https://csr.onet.pl';
// export const BO_DOUBLECLICK_GOOGLEADS = 'https://googleads.g.doubleclick.net';
// export const BO_DOUBLECLICK_TD = 'https://td.doubleclick.net';
// export const BO_RTBHOUSE = 'https://f.creativecdn.com';
// export const BO_CRITEO_US = 'https://fledge.us.criteo.com';
// export const BO_CRITEO_EU = 'https://fledge.eu.criteo.com';
// export const BO_CRITEO_AS = 'https://fledge.as.criteo.com';
// export const BO_CRITEO_GRID_MERCURY = 'https://grid-mercury.criteo.com';
// export const BO_CRITEO_BIDSWITCH_TRADR = 'https://tradr.bsw-sb.criteo.com';
// export const BO_CRITEO_BIDSWITCH_SANDBOX = 'https://dsp-paapi-sandbox.bsw-ig.criteo.com';
// export const BO_APPSPOT = 'https://fledge-buyer-testing-1.uc.r.appspot.com';
// export const BO_OPTABLE = 'https://ads.optable.co';
// export const BO_ADROLL = 'https://x.adroll.com';
// export const BO_ADFORM = 'https://a2.adform.net';
// export const BO_RETARGETLY = 'https://cookieless-campaign.prd-00.retargetly.com';
// export const BO_AUDIGENT = 'https://proton.ad.gt';
// export const BO_YAHOO = 'https://pa.ybp.yahoo.com';
// export const BO_DOTOMI = 'https://usadmm.dotomi.com';
24 changes: 24 additions & 0 deletions libraries/userSyncUtils/userSyncUtils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
export function getUserSyncParams(gdprConsent, uspConsent, gppConsent) {
let params = {};

if (gdprConsent) {
if (typeof gdprConsent.gdprApplies === 'boolean') {
params['gdpr'] = Number(gdprConsent.gdprApplies);
}

if (typeof gdprConsent.consentString === 'string') {
params['gdpr_consent'] = gdprConsent.consentString;
}
}

if (uspConsent) {
params['us_privacy'] = encodeURIComponent(uspConsent);
}

if (gppConsent?.gppString) {
params['gpp'] = gppConsent.gppString;
params['gpp_sid'] = gppConsent.applicableSections?.toString();
}

return params;
}
4 changes: 4 additions & 0 deletions libraries/vidazooUtils/bidderUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ export function buildRequestData(bid, topWindowUrl, sizes, bidderRequest, bidder
const pagecat = deepAccess(bidderRequest, 'ortb2.site.pagecat', []);
const contentData = deepAccess(bidderRequest, 'ortb2.site.content.data', []);
const userData = deepAccess(bidderRequest, 'ortb2.user.data', []);
const contentLang = deepAccess(bidderRequest, 'ortb2.site.content.language') || document.documentElement.lang;
const coppa = deepAccess(bidderRequest, 'ortb2.regs.coppa', 0);

if (isFn(bid.getFloor)) {
const floorInfo = bid.getFloor({
Expand Down Expand Up @@ -278,6 +280,8 @@ export function buildRequestData(bid, topWindowUrl, sizes, bidderRequest, bidder
gpid: gpid,
cat: cat,
contentData,
contentLang,
coppa,
userData: userData,
pagecat: pagecat,
transactionId: ortb2Imp?.ext?.tid,
Expand Down
4 changes: 1 addition & 3 deletions modules/33acrossBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ function isBidRequestValid(bid) {
}

function _validateBasic(bid) {
const invalidBidderName = bid.bidder !== BIDDER_CODE && !BIDDER_ALIASES.includes(bid.bidder);

if (invalidBidderName || !bid.params) {
if (!bid.params) {
return false;
}

Expand Down
12 changes: 8 additions & 4 deletions modules/adagioAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ function handlerAuctionInit(event) {
// Check if Adagio is on the bid requests.
const adagioBidRequest = event.bidderRequests.find(bidRequest => isAdagio(bidRequest.bidderCode));

const rtdUid = deepAccess(adagioBidRequest, 'ortb2.site.ext.data.adg_rtd.uid');
const rtdUid = deepAccess(event.bidderRequests[0], 'ortb2.site.ext.data.adg_rtd.uid');
cache.addPrebidAuctionIdRef(prebidAuctionId, rtdUid);

cache.auctions[prebidAuctionId] = {};
Expand Down Expand Up @@ -214,13 +214,16 @@ function handlerAuctionInit(event) {
bannerSize => bannerSize
).sort();

const sortedBidderCodes = bidders.sort()
const sortedBidderNames = bidders.sort();

const bidSrcMapper = (bidder) => {
// bidderCode in the context of the bidderRequest is the name given to the bidder in the adunit.
// It is not always the "true" bidder code, it can also be its alias
const request = event.bidderRequests.find(br => br.bidderCode === bidder)
return request ? request.bids[0].src : null
}
const biddersSrc = sortedBidderCodes.map(bidSrcMapper).join(',');
const biddersSrc = sortedBidderNames.map(bidSrcMapper).join(',');
const biddersCode = sortedBidderNames.map(bidder => adapterManager.resolveAlias(bidder)).join(',');

// if adagio was involved in the auction we identified it with rtdUid, if not use the prebid auctionId
const auctionId = rtdUid || prebidAuctionId;
Expand All @@ -238,14 +241,15 @@ function handlerAuctionInit(event) {
url_dmn: w.location.hostname,
mts: mediaTypesKeys.join(','),
ban_szs: bannerSizes.join(','),
bdrs: sortedBidderCodes.join(','),
bdrs: sortedBidderNames.join(','),
pgtyp: deepAccess(event.bidderRequests[0], 'ortb2.site.ext.data.pagetype', null),
plcmt: deepAccess(adUnits[0], 'ortb2Imp.ext.data.placement', null),
t_n: adgRtdSession.testName || null,
t_v: adgRtdSession.testVersion || null,
s_id: adgRtdSession.id || null,
s_new: adgRtdSession.new || null,
bdrs_src: biddersSrc,
bdrs_code: biddersCode,
};

if (adagioBidRequest && adagioBidRequest.bids) {
Expand Down
Loading

0 comments on commit 8887626

Please sign in to comment.