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

AdMatic Bid Adapter : consent management features added #10813

Merged
merged 65 commits into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
d49b56a
Admatic Bidder Adaptor
fatihkaya84 Oct 19, 2022
e582645
Update admaticBidAdapter.md
fatihkaya84 Oct 19, 2022
4c4c06a
Update admaticBidAdapter.md
fatihkaya84 Oct 28, 2022
7a23b05
remove floor parameter
fatihkaya84 Oct 31, 2022
7a845b7
Update admaticBidAdapter.js
fatihkaya84 Oct 31, 2022
7a2e0e2
Admatic Bid Adapter: alias and bid floor features activated
fatihkaya84 Nov 4, 2022
de7ac85
Admatic adapter: host param control changed
fatihkaya84 Nov 4, 2022
661c54f
Alias name changed.
fatihkaya84 Nov 4, 2022
42675a0
Revert "Admatic adapter: host param control changed"
fatihkaya84 Nov 4, 2022
6ec8f45
added alias feature and host param
fatihkaya84 Nov 4, 2022
63e1fc6
Revert "added alias feature and host param"
fatihkaya84 Nov 5, 2022
6da6565
Revert "Alias name changed."
fatihkaya84 Nov 5, 2022
549f349
Revert "Admatic Bid Adapter: alias and bid floor features activated"
fatihkaya84 Nov 5, 2022
0b8718e
Revert "Update admaticBidAdapter.js"
fatihkaya84 Nov 5, 2022
e7f6902
Revert "remove floor parameter"
fatihkaya84 Nov 5, 2022
3c797b1
Admatic adapter: host param control && Add new Bidder
fatihkaya84 Nov 5, 2022
f44bbeb
Revert "Admatic adapter: host param control && Add new Bidder"
fatihkaya84 Nov 5, 2022
fb6e36e
Merge branch 'prebid:master' into master
fatihkaya84 Nov 5, 2022
68f2596
commit new features
fatihkaya84 Nov 5, 2022
7fd1f26
Update admaticBidAdapter.js
fatihkaya84 Nov 6, 2022
e883ef6
updated for coverage
fatihkaya84 Nov 12, 2022
6961cae
sync updated
fatihkaya84 Nov 14, 2022
a3b299f
Update adloader.js
fatihkaya84 Nov 14, 2022
84c7b7b
Merge branch 'prebid:master' into master
fatihkaya84 Nov 18, 2022
e254707
AdMatic Bidder: development of user sync url
fatihkaya84 Nov 18, 2022
ba99adf
Update admaticBidAdapter.js
fatihkaya84 Nov 18, 2022
4083ae0
Merge branch 'prebid:master' into master
fatihkaya84 Jan 23, 2023
2fc2b1c
Set currency for AdserverCurrency: bug fix
fatihkaya84 Jan 23, 2023
325d94d
Merge branch 'prebid:master' into master
fatihkaya84 Apr 17, 2023
74f135b
Update admaticBidAdapter.js
fatihkaya84 Apr 17, 2023
e6b1672
update
fatihkaya84 Apr 17, 2023
dcfc9fe
Merge branch 'prebid:master' into master
fatihkaya84 Apr 26, 2023
31e69e8
admatic adapter video params update
fatihkaya84 Apr 26, 2023
60a28ca
Update admaticBidAdapter.js
fatihkaya84 Apr 26, 2023
a5316e7
update
fatihkaya84 Apr 26, 2023
38fd7ab
Update admaticBidAdapter.js
fatihkaya84 Apr 27, 2023
f381a45
update
fatihkaya84 Apr 27, 2023
689ce9d
update
fatihkaya84 Apr 27, 2023
1ca6597
Update admaticBidAdapter_spec.js
fatihkaya84 Apr 27, 2023
b1929ec
Update admaticBidAdapter.js
fatihkaya84 Apr 27, 2023
1216892
Update admaticBidAdapter.js
fatihkaya84 Apr 28, 2023
5d486e3
Revert "Update admaticBidAdapter.js"
fatihkaya84 Apr 28, 2023
473e417
Revert "Update admaticBidAdapter.js"
fatihkaya84 Apr 28, 2023
13b25ff
Revert "Update admaticBidAdapter_spec.js"
fatihkaya84 Apr 28, 2023
93b0e7d
Revert "update"
fatihkaya84 Apr 28, 2023
1c904d1
Revert "update"
fatihkaya84 Apr 28, 2023
c762aeb
Revert "Update admaticBidAdapter.js"
fatihkaya84 Apr 28, 2023
0520e1c
Revert "update"
fatihkaya84 Apr 28, 2023
578c49b
Revert "Update admaticBidAdapter.js"
fatihkaya84 Apr 28, 2023
6b04200
Revert "admatic adapter video params update"
fatihkaya84 Apr 28, 2023
246787c
Merge branch 'prebid:master' into master
fatihkaya84 Apr 28, 2023
941bb03
update
fatihkaya84 Apr 28, 2023
151ba7a
Merge branch 'prebid:master' into master
fatihkaya84 Jun 15, 2023
bbbf361
Update admaticBidAdapter.js
fatihkaya84 Jun 15, 2023
63c6ada
Merge branch 'prebid:master' into master
fatihkaya84 Jul 17, 2023
5ec51d4
Merge branch 'prebid:master' into master
fatihkaya84 Jul 29, 2023
4639682
Merge branch 'prebid:master' into master
fatihkaya84 Aug 8, 2023
2999463
Update admaticBidAdapter_spec.js
fatihkaya84 Aug 8, 2023
3bcbe0f
Merge branch 'prebid:master' into master
fatihkaya84 Oct 7, 2023
090397e
mime_type add
fatihkaya84 Oct 7, 2023
ee09d90
Merge branch 'prebid:master' into master
fatihkaya84 Oct 26, 2023
bd0d50c
add native adapter
fatihkaya84 Oct 26, 2023
8347749
Merge branch 'prebid:master' into master
fatihkaya84 Oct 30, 2023
00bb9b5
Merge branch 'prebid:master' into master
fatihkaya84 Dec 8, 2023
5d9ea45
AdMatic Adapter: Consent Management
fatihkaya84 Dec 9, 2023
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
131 changes: 115 additions & 16 deletions modules/admaticBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {getValue, logError, isEmpty, deepAccess, isArray, getBidIdParameter} from '../src/utils.js';
import {getValue, formatQS, logError, deepAccess, isArray, getBidIdParameter} from '../src/utils.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { config } from '../src/config.js';
import { BANNER, VIDEO, NATIVE } from '../src/mediaTypes.js';
Expand Down Expand Up @@ -56,18 +56,16 @@ export const spec = {
* @return {ServerRequest}
*/
buildRequests: (validBidRequests, bidderRequest) => {
const tmax = bidderRequest.timeout;
const bids = validBidRequests.map(buildRequestObject);
const blacklist = bidderRequest.ortb2;
const ortb = bidderRequest.ortb2;
const networkId = getValue(validBidRequests[0].params, 'networkId');
const host = getValue(validBidRequests[0].params, 'host');
const currency = config.getConfig('currency.adServerCurrency') || 'TRY';
const bidderName = validBidRequests[0].bidder;

const payload = {
user: {
ua: navigator.userAgent
},
blacklist: [],
ortb,
site: {
page: bidderRequest.refererInfo.page,
ref: bidderRequest.refererInfo.page,
Expand All @@ -80,17 +78,59 @@ export const spec = {
ext: {
cur: currency,
bidder: bidderName
}
},
schain: {},
regs: {
ext: {
}
},
user: {
ext: {}
},
at: 1,
tmax: parseInt(tmax)
};

if (!isEmpty(blacklist.badv)) {
payload.blacklist = blacklist.badv;
};
if (bidderRequest && bidderRequest.gdprConsent && bidderRequest.gdprConsent.gdprApplies) {
const consentStr = (bidderRequest.gdprConsent.consentString)
? bidderRequest.gdprConsent.consentString.replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '') : '';
const gdpr = bidderRequest.gdprConsent.gdprApplies ? 1 : 0;
payload.regs.ext.gdpr = gdpr;
payload.regs.ext.consent = consentStr;
}

if (bidderRequest && bidderRequest.coppa) {
payload.regs.ext.coppa = bidderRequest.coppa === true ? 1 : (bidderRequest.coppa === false ? 0 : undefined);
}

if (bidderRequest && bidderRequest.ortb2?.regs?.gpp) {
payload.regs.ext.gpp = bidderRequest.ortb2?.regs?.gpp;
}

if (bidderRequest && bidderRequest.ortb2?.regs?.gpp_sid) {
payload.regs.ext.gpp_sid = bidderRequest.ortb2?.regs?.gpp_sid;
}

if (bidderRequest && bidderRequest.uspConsent) {
payload.regs.ext.uspIab = bidderRequest.uspConsent;
}

if (validBidRequests[0].schain) {
const schain = mapSchain(validBidRequests[0].schain);
if (schain) {
payload.schain = schain;
}
}

if (validBidRequests[0].userIdAsEids) {
const eids = { eids: validBidRequests[0].userIdAsEids };
payload.user.ext = { ...payload.user.ext, ...eids };
}

if (payload) {
switch (bidderName) {
case 'pixad':
SYNC_URL = 'https://static.pixad.com.tr/sync.html';
SYNC_URL = 'https://static.cdn.pixad.com.tr/sync.html';
break;
default:
SYNC_URL = 'https://cdn.serve.admatic.com.tr/showad/sync.html';
Expand All @@ -101,12 +141,36 @@ export const spec = {
}
},

getUserSyncs: function (syncOptions, responses) {
if (syncOptions.iframeEnabled) {
return [{
getUserSyncs: function (syncOptions, responses, gdprConsent, uspConsent, gppConsent) {
if (!hasSynced && syncOptions.iframeEnabled) {
// data is only assigned if params are available to pass to syncEndpoint
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();
}

params = Object.keys(params).length ? `?${formatQS(params)}` : '';

hasSynced = true;
return {
type: 'iframe',
url: SYNC_URL
}];
url: SYNC_URL + params
};
}
},

Expand Down Expand Up @@ -156,6 +220,41 @@ export const spec = {
}
};

var hasSynced = false;

export function resetUserSync() {
hasSynced = false;
}

/**
* @param {object} schain object set by Publisher
* @returns {object} OpenRTB SupplyChain object
*/
function mapSchain(schain) {
if (!schain) {
return null;
}
if (!validateSchain(schain)) {
logError('AdMatic: required schain params missing');
return null;
}
return schain;
}

/**
* @param {object} schain object set by Publisher
* @returns {object} bool
*/
function validateSchain(schain) {
if (!schain.nodes) {
return false;
}
const requiredFields = ['asi', 'sid', 'hp'];
return schain.nodes.every(node => {
return requiredFields.every(field => node[field]);
});
}

function isUrl(str) {
try {
URL(str);
Expand Down
Loading