Skip to content

Commit abe74af

Browse files
kakikeiahmadlob
authored andcommitted
Adgeneration Bid Adpter: add Criteo system and ID5 system and update test. (#8642)
* update Adgeneration to add Criteo system and ID5 systems. * Change method name. * Correction_of_code_and_test_specs. * Adding adgext_id5_id_link_type parameter to ID5 object.
1 parent d1238a0 commit abe74af

File tree

2 files changed

+76
-5
lines changed

2 files changed

+76
-5
lines changed

modules/adgenerationBidAdapter.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,16 @@ export const spec = {
2525
* @return ServerRequest Info describing the request to the server.
2626
*/
2727
buildRequests: function (validBidRequests, bidderRequest) {
28-
const ADGENE_PREBID_VERSION = '1.3.0';
28+
const ADGENE_PREBID_VERSION = '1.4.0';
2929
let serverRequests = [];
3030
for (let i = 0, len = validBidRequests.length; i < len; i++) {
3131
const validReq = validBidRequests[i];
3232
const DEBUG_URL = 'https://api-test.scaleout.jp/adsv/v1';
3333
const URL = 'https://d.socdm.com/adsv/v1';
3434
const url = validReq.params.debug ? DEBUG_URL : URL;
35+
const criteoId = getCriteoId(validReq);
36+
const id5id = getId5Id(validReq);
37+
const id5LinkType = getId5LinkType(validReq);
3538
let data = ``;
3639
data = tryAppendQueryString(data, 'posall', 'SSPLOC');
3740
const id = getBidIdParameter('id', validReq.params);
@@ -45,10 +48,14 @@ export const spec = {
4548
data = tryAppendQueryString(data, 'pbver', '$prebid.version$');
4649
data = tryAppendQueryString(data, 'sdkname', 'prebidjs');
4750
data = tryAppendQueryString(data, 'adapterver', ADGENE_PREBID_VERSION);
51+
data = tryAppendQueryString(data, 'adgext_criteo_id', criteoId);
52+
data = tryAppendQueryString(data, 'adgext_id5_id', id5id);
53+
data = tryAppendQueryString(data, 'adgext_id5_id_link_type', id5LinkType);
4854
// native以外にvideo等の対応が入った場合は要修正
4955
if (!validReq.mediaTypes || !validReq.mediaTypes.native) {
5056
data = tryAppendQueryString(data, 'imark', '1');
5157
}
58+
5259
// TODO: is 'page' the right value here?
5360
data = tryAppendQueryString(data, 'tp', bidderRequest.refererInfo.page);
5461
if (isIos()) {
@@ -275,6 +282,22 @@ function getCurrencyType() {
275282
* @param validReq request
276283
* @return {null|string}
277284
*/
285+
function getCriteoId(validReq) {
286+
return (validReq.userId && validReq.userId.criteoId) ? validReq.userId.criteoId : null
287+
}
288+
289+
function getId5Id(validReq) {
290+
return validId5(validReq) ? validReq.userId.id5id.uid : null
291+
}
292+
293+
function getId5LinkType(validReq) {
294+
return validId5(validReq) ? validReq.userId.id5id.ext.linkType : null
295+
}
296+
297+
function validId5(validReq) {
298+
return validReq.userId && validReq.userId.id5id && validReq.userId.id5id.uid && validReq.userId.id5id.ext.linkType
299+
}
300+
278301
function getHyperId(validReq) {
279302
if (validReq.userId && validReq.userId.novatiq && validReq.userId.novatiq.snowflake.syncResponse === 1) {
280303
return validReq.userId.novatiq.snowflake.id;

test/spec/modules/adgenerationBidAdapter_spec.js

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,41 @@ describe('AdgenerationAdapter', function () {
101101
snowflake: {'id': 'novatiqId', syncResponse: 1}
102102
}
103103
}
104+
},
105+
{ // bannerWithAdgextCriteoId
106+
bidder: 'adg',
107+
params: {
108+
id: '58278', // banner
109+
},
110+
adUnitCode: 'adunit-code',
111+
sizes: [[320, 100]],
112+
bidId: '2f6ac468a9c15e',
113+
bidderRequestId: '14a9f773e30243',
114+
auctionId: '4aae9f05-18c6-4fcd-80cf-282708cd584a',
115+
transactionTd: 'f76f6dfd-d64f-4645-a29f-682bac7f431a',
116+
userId: {
117+
criteoId: 'criteo-id-test-1234567890'
118+
}
119+
},
120+
{ // bannerWithAdgextId5Id
121+
bidder: 'adg',
122+
params: {
123+
id: '58278', // banner
124+
},
125+
adUnitCode: 'adunit-code',
126+
sizes: [[320, 100]],
127+
bidId: '2f6ac468a9c15e',
128+
bidderRequestId: '14a9f773e30243',
129+
auctionId: '4aae9f05-18c6-4fcd-80cf-282708cd584a',
130+
transactionTd: 'f76f6dfd-d64f-4645-a29f-682bac7f431a',
131+
userId: {
132+
id5id: {
133+
ext: {
134+
linkType: 2
135+
},
136+
uid: 'id5-id-test-1234567890'
137+
}
138+
}
104139
}
105140
];
106141
const bidderRequest = {
@@ -109,10 +144,12 @@ describe('AdgenerationAdapter', function () {
109144
}
110145
};
111146
const data = {
112-
banner: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=300x250%2C320x100&currency=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.3.0&imark=1&tp=https%3A%2F%2Fexample.com`,
113-
bannerUSD: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=300x250%2C320x100&currency=USD&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.3.0&imark=1&tp=https%3A%2F%2Fexample.com`,
114-
native: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=1x1&currency=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.3.0&tp=https%3A%2F%2Fexample.com`,
115-
bannerWithHyperId: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=320x100&currency=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.3.0&imark=1&tp=https%3A%2F%2Fexample.com&hyper_id=novatiqId`,
147+
banner: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=300x250%2C320x100&currency=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.4.0&imark=1&tp=https%3A%2F%2Fexample.com`,
148+
bannerUSD: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=300x250%2C320x100&currency=USD&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.4.0&imark=1&tp=https%3A%2F%2Fexample.com`,
149+
native: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=1x1&currency=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.4.0&tp=https%3A%2F%2Fexample.com`,
150+
bannerWithHyperId: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=320x100&currency=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.4.0&imark=1&tp=https%3A%2F%2Fexample.com&hyper_id=novatiqId`,
151+
bannerWithAdgextCriteoId: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=320x100&currency=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`,
152+
bannerWithAdgextId5Id: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=320x100&currency=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`,
116153
};
117154
it('sends bid request to ENDPOINT via GET', function () {
118155
const request = spec.buildRequests(bidRequests, bidderRequest)[0];
@@ -149,6 +186,17 @@ describe('AdgenerationAdapter', function () {
149186
});
150187
expect(request.data).to.equal(data.bannerWithHyperId);
151188
});
189+
190+
it('should attache params to the bannerWithAdgextCriteoId request', function () {
191+
const request = spec.buildRequests(bidRequests, bidderRequest)[3];
192+
expect(request.data).to.equal(data.bannerWithAdgextCriteoId);
193+
});
194+
195+
it('should attache params to the bannerWithAdgextId5Id request', function () {
196+
const request = spec.buildRequests(bidRequests, bidderRequest)[4];
197+
expect(request.data).to.equal(data.bannerWithAdgextId5Id);
198+
});
199+
152200
it('allows setConfig to set bidder currency for JPY', function () {
153201
config.setConfig({
154202
currency: {

0 commit comments

Comments
 (0)