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

Dailymotion bid adapter: add publisher restrictions in consent enforcement #12185

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 17 additions & 7 deletions modules/dailymotionBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { deepAccess } from '../src/utils.js';
import { config } from '../src/config.js';
import { userSync } from '../src/userSync.js';

const DAILYMOTION_VENDOR_ID = 573;

/**
* Get video metadata from bid request
*
Expand Down Expand Up @@ -110,7 +112,7 @@ function isUserSyncEnabled() {

export const spec = {
code: 'dailymotion',
gvlid: 573,
gvlid: DAILYMOTION_VENDOR_ID,
supportedMediaTypes: [VIDEO],

/**
Expand Down Expand Up @@ -157,13 +159,21 @@ export const spec = {
deepAccess(bidderRequest, 'gdprConsent.vendorData.hasGlobalConsent') === true ||
(
// Vendor consent
deepAccess(bidderRequest, 'gdprConsent.vendorData.vendor.consents.573') === true &&
// Purposes
[1, 3, 4].every(v => deepAccess(bidderRequest, `gdprConsent.vendorData.purpose.consents.${v}`) === true) &&
// Flexible purposes
deepAccess(bidderRequest, `gdprConsent.vendorData.vendor.consents.${DAILYMOTION_VENDOR_ID}`) === true &&

// Purposes with legal basis "consent". These are not flexible, so if publisher requires legitimate interest (2) it cancels them
[1, 3, 4].every(v =>
deepAccess(bidderRequest, `gdprConsent.vendorData.publisher.restrictions.${v}.${DAILYMOTION_VENDOR_ID}`) !== 0 &&
deepAccess(bidderRequest, `gdprConsent.vendorData.publisher.restrictions.${v}.${DAILYMOTION_VENDOR_ID}`) !== 2 &&
deepAccess(bidderRequest, `gdprConsent.vendorData.purpose.consents.${v}`) === true
) &&

// Purposes with legal basis "legitimate interest" (default) or "consent" (when specified as such by publisher)
[2, 7, 9, 10].every(v =>
deepAccess(bidderRequest, `gdprConsent.vendorData.purpose.consents.${v}`) === true ||
deepAccess(bidderRequest, `gdprConsent.vendorData.purpose.legitimateInterests.${v}`) === true
deepAccess(bidderRequest, `gdprConsent.vendorData.publisher.restrictions.${v}.${DAILYMOTION_VENDOR_ID}`) !== 0 &&
(deepAccess(bidderRequest, `gdprConsent.vendorData.publisher.restrictions.${v}.${DAILYMOTION_VENDOR_ID}`) === 1
? deepAccess(bidderRequest, `gdprConsent.vendorData.purpose.consents.${v}`) === true
: deepAccess(bidderRequest, `gdprConsent.vendorData.purpose.legitimateInterests.${v}`) === true)
)
);

Expand Down
Loading