Skip to content

Commit

Permalink
Ogury Bid Adapter: init new user sync iframe (prebid#10158)
Browse files Browse the repository at this point in the history
  • Loading branch information
fermeaux authored and Santiago Carabone committed Aug 22, 2023
1 parent c6d09c0 commit cdcd842
Show file tree
Hide file tree
Showing 2 changed files with 237 additions and 124 deletions.
45 changes: 29 additions & 16 deletions modules/oguryBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const DEFAULT_TIMEOUT = 1000;
const BID_HOST = 'https://mweb-hb.presage.io/api/header-bidding-request';
const TIMEOUT_MONITORING_HOST = 'https://ms-ads-monitoring-events.presage.io';
const MS_COOKIE_SYNC_DOMAIN = 'https://ms-cookie-sync.presage.io';
const ADAPTER_VERSION = '1.4.1';
const ADAPTER_VERSION = '1.5.0';

function getClientWidth() {
const documentElementClientWidth = window.top.document.documentElement.clientWidth
Expand Down Expand Up @@ -46,22 +46,35 @@ function isBidRequestValid(bid) {
}

function getUserSyncs(syncOptions, serverResponses, gdprConsent, uspConsent) {
if (!syncOptions.pixelEnabled) return [];
const consent = (gdprConsent && gdprConsent.consentString) || '';

return [
{
type: 'image',
url: `${MS_COOKIE_SYNC_DOMAIN}/v1/init-sync/bid-switch?iab_string=${(gdprConsent && gdprConsent.consentString) || ''}&source=prebid`
},
{
type: 'image',
url: `${MS_COOKIE_SYNC_DOMAIN}/ttd/init-sync?iab_string=${(gdprConsent && gdprConsent.consentString) || ''}&source=prebid`
},
{
type: 'image',
url: `${MS_COOKIE_SYNC_DOMAIN}/xandr/init-sync?iab_string=${(gdprConsent && gdprConsent.consentString) || ''}&source=prebid`
}
]
if (syncOptions.iframeEnabled) {
return [
{
type: 'iframe',
url: `${MS_COOKIE_SYNC_DOMAIN}/user-sync.html?gdpr_consent=${consent}&source=prebid`
}
];
}

if (syncOptions.pixelEnabled) {
return [
{
type: 'image',
url: `${MS_COOKIE_SYNC_DOMAIN}/v1/init-sync/bid-switch?iab_string=${consent}&source=prebid`
},
{
type: 'image',
url: `${MS_COOKIE_SYNC_DOMAIN}/ttd/init-sync?iab_string=${consent}&source=prebid`
},
{
type: 'image',
url: `${MS_COOKIE_SYNC_DOMAIN}/xandr/init-sync?iab_string=${consent}&source=prebid`
}
];
}

return [];
}

function buildRequests(validBidRequests, bidderRequest) {
Expand Down
Loading

0 comments on commit cdcd842

Please sign in to comment.