From 9d7759229370ffb4869f1d364b8d1de3264f557a Mon Sep 17 00:00:00 2001 From: kakikei Date: Wed, 22 Jun 2022 14:59:47 +0900 Subject: [PATCH 1/4] update Adgeneration to add Criteo system and ID5 systems. --- modules/adgenerationBidAdapter.js | 19 ++++++- .../modules/adgenerationBidAdapter_spec.js | 56 +++++++++++++++++-- 2 files changed, 70 insertions(+), 5 deletions(-) diff --git a/modules/adgenerationBidAdapter.js b/modules/adgenerationBidAdapter.js index 94527c5d051..a6b8fdc9bb6 100644 --- a/modules/adgenerationBidAdapter.js +++ b/modules/adgenerationBidAdapter.js @@ -25,13 +25,15 @@ export const spec = { * @return ServerRequest Info describing the request to the server. */ buildRequests: function (validBidRequests, bidderRequest) { - const ADGENE_PREBID_VERSION = '1.3.0'; + const ADGENE_PREBID_VERSION = '1.4.0'; let serverRequests = []; for (let i = 0, len = validBidRequests.length; i < len; i++) { const validReq = validBidRequests[i]; const DEBUG_URL = 'https://api-test.scaleout.jp/adsv/v1'; const URL = 'https://d.socdm.com/adsv/v1'; const url = validReq.params.debug ? DEBUG_URL : URL; + const criteoId = getcriteoId(validReq); + const id5id = getid5id(validReq); let data = ``; data = tryAppendQueryString(data, 'posall', 'SSPLOC'); const id = getBidIdParameter('id', validReq.params); @@ -49,6 +51,14 @@ export const spec = { if (!validReq.mediaTypes || !validReq.mediaTypes.native) { data = tryAppendQueryString(data, 'imark', '1'); } + + if (criteoId != null) { + data = tryAppendQueryString(data, 'adgext_criteo_id', criteoId); + } + + if (id5id != null) { + data = tryAppendQueryString(data, 'adgext_id5_id', id5id); + } // TODO: is 'page' the right value here? data = tryAppendQueryString(data, 'tp', bidderRequest.refererInfo.page); if (isIos()) { @@ -275,6 +285,13 @@ function getCurrencyType() { * @param validReq request * @return {null|string} */ +function getcriteoId(validReq) { + return (validReq.userId && validReq.userId.criteoId) ? validReq.userId.criteoId : null +} + +function getid5id(validReq) { + return (validReq.userId && validReq.userId.id5id && validReq.userId.id5id.uid) ? validReq.userId.id5id.uid : null +} function getHyperId(validReq) { if (validReq.userId && validReq.userId.novatiq && validReq.userId.novatiq.snowflake.syncResponse === 1) { return validReq.userId.novatiq.snowflake.id; diff --git a/test/spec/modules/adgenerationBidAdapter_spec.js b/test/spec/modules/adgenerationBidAdapter_spec.js index ac5ab220880..2efc2c478da 100644 --- a/test/spec/modules/adgenerationBidAdapter_spec.js +++ b/test/spec/modules/adgenerationBidAdapter_spec.js @@ -101,6 +101,41 @@ describe('AdgenerationAdapter', function () { snowflake: {'id': 'novatiqId', syncResponse: 1} } } + }, + { // bannerWithAdgextCriteoId + bidder: 'adg', + params: { + id: '58278', // banner + }, + adUnitCode: 'adunit-code', + sizes: [[320, 100]], + bidId: '2f6ac468a9c15e', + bidderRequestId: '14a9f773e30243', + auctionId: '4aae9f05-18c6-4fcd-80cf-282708cd584a', + transactionTd: 'f76f6dfd-d64f-4645-a29f-682bac7f431a', + userId: { + criteoId: 'criteo-hogehogehogehogehoge123456789' + } + }, + { // bannerWithAdgextId5Id + bidder: 'adg', + params: { + id: '58278', // banner + }, + adUnitCode: 'adunit-code', + sizes: [[320, 100]], + bidId: '2f6ac468a9c15e', + bidderRequestId: '14a9f773e30243', + auctionId: '4aae9f05-18c6-4fcd-80cf-282708cd584a', + transactionTd: 'f76f6dfd-d64f-4645-a29f-682bac7f431a', + userId: { + id5id: { + ext: { + linkType: 2 + }, + uid: 'id5-hogehogehogehogehoge123456789' + } + } } ]; const bidderRequest = { @@ -109,10 +144,12 @@ describe('AdgenerationAdapter', function () { } }; const data = { - banner: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=300x250%2C320x100¤cy=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.3.0&imark=1&tp=https%3A%2F%2Fexample.com`, - bannerUSD: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=300x250%2C320x100¤cy=USD&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.3.0&imark=1&tp=https%3A%2F%2Fexample.com`, - native: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=1x1¤cy=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.3.0&tp=https%3A%2F%2Fexample.com`, - bannerWithHyperId: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=320x100¤cy=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.3.0&imark=1&tp=https%3A%2F%2Fexample.com&hyper_id=novatiqId`, + banner: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=300x250%2C320x100¤cy=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.4.0&imark=1&tp=https%3A%2F%2Fexample.com`, + bannerUSD: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=300x250%2C320x100¤cy=USD&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.4.0&imark=1&tp=https%3A%2F%2Fexample.com`, + native: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=1x1¤cy=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.4.0&tp=https%3A%2F%2Fexample.com`, + bannerWithHyperId: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=320x100¤cy=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.4.0&imark=1&tp=https%3A%2F%2Fexample.com&hyper_id=novatiqId`, + bannerWithAdgextCriteoId: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=320x100¤cy=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.4.0&imark=1&adgext_criteo_id=criteo-hogehogehogehogehoge123456789&tp=https%3A%2F%2Fexample.com`, + bannerWithAdgextId5Id: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=320x100¤cy=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.4.0&imark=1&adgext_id5_id=id5-hogehogehogehogehoge123456789&tp=https%3A%2F%2Fexample.com`, }; it('sends bid request to ENDPOINT via GET', function () { const request = spec.buildRequests(bidRequests, bidderRequest)[0]; @@ -149,6 +186,17 @@ describe('AdgenerationAdapter', function () { }); expect(request.data).to.equal(data.bannerWithHyperId); }); + + it('should attache params to the bannerWithAdgextCriteoId request', function () { + const request = spec.buildRequests(bidRequests, bidderRequest)[3]; + expect(request.data).to.equal(data.bannerWithAdgextCriteoId); + }); + + it('should attache params to the bannerWithAdgextId5Id request', function () { + const request = spec.buildRequests(bidRequests, bidderRequest)[4]; + expect(request.data).to.equal(data.bannerWithAdgextId5Id); + }); + it('allows setConfig to set bidder currency for JPY', function () { config.setConfig({ currency: { From 091cba9a3b9811bc17c8e7ea9525d7d71e17cdcd Mon Sep 17 00:00:00 2001 From: kakikei Date: Wed, 29 Jun 2022 10:31:30 +0900 Subject: [PATCH 2/4] Change method name. --- modules/adgenerationBidAdapter.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/adgenerationBidAdapter.js b/modules/adgenerationBidAdapter.js index a6b8fdc9bb6..7acbc19c735 100644 --- a/modules/adgenerationBidAdapter.js +++ b/modules/adgenerationBidAdapter.js @@ -32,8 +32,8 @@ export const spec = { const DEBUG_URL = 'https://api-test.scaleout.jp/adsv/v1'; const URL = 'https://d.socdm.com/adsv/v1'; const url = validReq.params.debug ? DEBUG_URL : URL; - const criteoId = getcriteoId(validReq); - const id5id = getid5id(validReq); + const criteoId = getCriteoId(validReq); + const id5id = getId5Id(validReq); let data = ``; data = tryAppendQueryString(data, 'posall', 'SSPLOC'); const id = getBidIdParameter('id', validReq.params); @@ -285,11 +285,11 @@ function getCurrencyType() { * @param validReq request * @return {null|string} */ -function getcriteoId(validReq) { +function getCriteoId(validReq) { return (validReq.userId && validReq.userId.criteoId) ? validReq.userId.criteoId : null } -function getid5id(validReq) { +function getId5Id(validReq) { return (validReq.userId && validReq.userId.id5id && validReq.userId.id5id.uid) ? validReq.userId.id5id.uid : null } function getHyperId(validReq) { From 594f52d9d9dcb9e3dfe19a32376cdb9a3f696ce2 Mon Sep 17 00:00:00 2001 From: kakikei Date: Thu, 30 Jun 2022 18:28:08 +0900 Subject: [PATCH 3/4] Correction_of_code_and_test_specs. --- modules/adgenerationBidAdapter.js | 9 ++------- test/spec/modules/adgenerationBidAdapter_spec.js | 8 ++++---- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/modules/adgenerationBidAdapter.js b/modules/adgenerationBidAdapter.js index 7acbc19c735..b362231aabf 100644 --- a/modules/adgenerationBidAdapter.js +++ b/modules/adgenerationBidAdapter.js @@ -47,18 +47,13 @@ export const spec = { data = tryAppendQueryString(data, 'pbver', '$prebid.version$'); data = tryAppendQueryString(data, 'sdkname', 'prebidjs'); data = tryAppendQueryString(data, 'adapterver', ADGENE_PREBID_VERSION); + data = tryAppendQueryString(data, 'adgext_criteo_id', criteoId); + data = tryAppendQueryString(data, 'adgext_id5_id', id5id); // native以外にvideo等の対応が入った場合は要修正 if (!validReq.mediaTypes || !validReq.mediaTypes.native) { data = tryAppendQueryString(data, 'imark', '1'); } - if (criteoId != null) { - data = tryAppendQueryString(data, 'adgext_criteo_id', criteoId); - } - - if (id5id != null) { - data = tryAppendQueryString(data, 'adgext_id5_id', id5id); - } // TODO: is 'page' the right value here? data = tryAppendQueryString(data, 'tp', bidderRequest.refererInfo.page); if (isIos()) { diff --git a/test/spec/modules/adgenerationBidAdapter_spec.js b/test/spec/modules/adgenerationBidAdapter_spec.js index 2efc2c478da..91c34b056dc 100644 --- a/test/spec/modules/adgenerationBidAdapter_spec.js +++ b/test/spec/modules/adgenerationBidAdapter_spec.js @@ -114,7 +114,7 @@ describe('AdgenerationAdapter', function () { auctionId: '4aae9f05-18c6-4fcd-80cf-282708cd584a', transactionTd: 'f76f6dfd-d64f-4645-a29f-682bac7f431a', userId: { - criteoId: 'criteo-hogehogehogehogehoge123456789' + criteoId: 'criteo-id-test-1234567890' } }, { // bannerWithAdgextId5Id @@ -133,7 +133,7 @@ describe('AdgenerationAdapter', function () { ext: { linkType: 2 }, - uid: 'id5-hogehogehogehogehoge123456789' + uid: 'id5-id-test-1234567890' } } } @@ -148,8 +148,8 @@ describe('AdgenerationAdapter', function () { bannerUSD: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=300x250%2C320x100¤cy=USD&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.4.0&imark=1&tp=https%3A%2F%2Fexample.com`, native: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=1x1¤cy=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.4.0&tp=https%3A%2F%2Fexample.com`, bannerWithHyperId: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=320x100¤cy=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.4.0&imark=1&tp=https%3A%2F%2Fexample.com&hyper_id=novatiqId`, - bannerWithAdgextCriteoId: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=320x100¤cy=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.4.0&imark=1&adgext_criteo_id=criteo-hogehogehogehogehoge123456789&tp=https%3A%2F%2Fexample.com`, - bannerWithAdgextId5Id: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=320x100¤cy=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.4.0&imark=1&adgext_id5_id=id5-hogehogehogehogehoge123456789&tp=https%3A%2F%2Fexample.com`, + bannerWithAdgextCriteoId: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=320x100¤cy=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.4.0&adgext_criteo_id=criteo-id-test-1234567890&imark=1&tp=https%3A%2F%2Fexample.com`, + bannerWithAdgextId5Id: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=320x100¤cy=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.4.0&adgext_id5_id=id5-id-test-1234567890&imark=1&tp=https%3A%2F%2Fexample.com`, }; it('sends bid request to ENDPOINT via GET', function () { const request = spec.buildRequests(bidRequests, bidderRequest)[0]; From ae522fad37d8285116c8b5e79f240f15bd748bba Mon Sep 17 00:00:00 2001 From: kakikei Date: Tue, 5 Jul 2022 16:26:38 +0900 Subject: [PATCH 4/4] Adding adgext_id5_id_link_type parameter to ID5 object. --- modules/adgenerationBidAdapter.js | 13 ++++++++++++- test/spec/modules/adgenerationBidAdapter_spec.js | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/modules/adgenerationBidAdapter.js b/modules/adgenerationBidAdapter.js index b362231aabf..b48d9d350e3 100644 --- a/modules/adgenerationBidAdapter.js +++ b/modules/adgenerationBidAdapter.js @@ -34,6 +34,7 @@ export const spec = { const url = validReq.params.debug ? DEBUG_URL : URL; const criteoId = getCriteoId(validReq); const id5id = getId5Id(validReq); + const id5LinkType = getId5LinkType(validReq); let data = ``; data = tryAppendQueryString(data, 'posall', 'SSPLOC'); const id = getBidIdParameter('id', validReq.params); @@ -49,6 +50,7 @@ export const spec = { data = tryAppendQueryString(data, 'adapterver', ADGENE_PREBID_VERSION); data = tryAppendQueryString(data, 'adgext_criteo_id', criteoId); data = tryAppendQueryString(data, 'adgext_id5_id', id5id); + data = tryAppendQueryString(data, 'adgext_id5_id_link_type', id5LinkType); // native以外にvideo等の対応が入った場合は要修正 if (!validReq.mediaTypes || !validReq.mediaTypes.native) { data = tryAppendQueryString(data, 'imark', '1'); @@ -285,8 +287,17 @@ function getCriteoId(validReq) { } function getId5Id(validReq) { - return (validReq.userId && validReq.userId.id5id && validReq.userId.id5id.uid) ? validReq.userId.id5id.uid : null + return validId5(validReq) ? validReq.userId.id5id.uid : null } + +function getId5LinkType(validReq) { + return validId5(validReq) ? validReq.userId.id5id.ext.linkType : null +} + +function validId5(validReq) { + return validReq.userId && validReq.userId.id5id && validReq.userId.id5id.uid && validReq.userId.id5id.ext.linkType +} + function getHyperId(validReq) { if (validReq.userId && validReq.userId.novatiq && validReq.userId.novatiq.snowflake.syncResponse === 1) { return validReq.userId.novatiq.snowflake.id; diff --git a/test/spec/modules/adgenerationBidAdapter_spec.js b/test/spec/modules/adgenerationBidAdapter_spec.js index 91c34b056dc..8583c226e50 100644 --- a/test/spec/modules/adgenerationBidAdapter_spec.js +++ b/test/spec/modules/adgenerationBidAdapter_spec.js @@ -149,7 +149,7 @@ describe('AdgenerationAdapter', function () { native: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=1x1¤cy=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.4.0&tp=https%3A%2F%2Fexample.com`, bannerWithHyperId: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=320x100¤cy=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.4.0&imark=1&tp=https%3A%2F%2Fexample.com&hyper_id=novatiqId`, bannerWithAdgextCriteoId: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=320x100¤cy=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.4.0&adgext_criteo_id=criteo-id-test-1234567890&imark=1&tp=https%3A%2F%2Fexample.com`, - bannerWithAdgextId5Id: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=320x100¤cy=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.4.0&adgext_id5_id=id5-id-test-1234567890&imark=1&tp=https%3A%2F%2Fexample.com`, + bannerWithAdgextId5Id: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=320x100¤cy=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.4.0&adgext_id5_id=id5-id-test-1234567890&adgext_id5_id_link_type=2&imark=1&tp=https%3A%2F%2Fexample.com`, }; it('sends bid request to ENDPOINT via GET', function () { const request = spec.buildRequests(bidRequests, bidderRequest)[0];