Skip to content
Open
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
27 changes: 21 additions & 6 deletions modules/adgenerationBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const spec = {
buildRequests: function (validBidRequests, bidderRequest) {
// convert Native ORTB definition to old-style prebid native definition
validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);
const ADGENE_PREBID_VERSION = '1.6.3';
const ADGENE_PREBID_VERSION = '1.6.4';
let serverRequests = [];
for (let i = 0, len = validBidRequests.length; i < len; i++) {
const validReq = validBidRequests[i];
Expand All @@ -52,6 +52,10 @@ export const spec = {
const gpid = deepAccess(validReq, 'ortb2Imp.ext.gpid');
const sua = deepAccess(validReq, 'ortb2.device.sua');
const uid2 = deepAccess(validReq, 'userId.uid2.id');
const topics = getTopics(validReq);
const cdep = deepAccess(validReq, 'ortb2.device.ext.cdep');
const hyperId = getHyperId(validReq);

let data = ``;
data = tryAppendQueryString(data, 'posall', 'SSPLOC');
const id = getBidIdParameter('id', validReq.params);
Expand All @@ -73,18 +77,16 @@ export const spec = {
data = tryAppendQueryString(data, 'gpid', gpid);
data = tryAppendQueryString(data, 'uach', sua ? JSON.stringify(sua) : null);
data = tryAppendQueryString(data, 'schain', validReq.schain ? JSON.stringify(validReq.schain) : null);
data = tryAppendQueryString(data, 'cdep', cdep);

// native以外にvideo等の対応が入った場合は要修正
if (!validReq.mediaTypes || !validReq.mediaTypes.native) {
data = tryAppendQueryString(data, 'imark', '1');
}

data = tryAppendQueryString(data, 'tp', bidderRequest.refererInfo.page);

const hyperId = getHyperId(validReq);
if (hyperId != null) {
data = tryAppendQueryString(data, 'hyper_id', hyperId);
}
data = tryAppendQueryString(data, 'hyper_id', hyperId);
data = tryAppendQueryString(data, 'ptopics', topics ? JSON.stringify(topics) : null);

// remove the trailing "&"
if (data.lastIndexOf('&') === data.length - 1) {
Expand Down Expand Up @@ -337,4 +339,17 @@ function getHyperId(validReq) {
return null;
}

function getTopics(validReq) {
// 600,601 used Chromium Topics API taxonomy. Held for future Chromium Topics API taxonomies 602-609
const userData = deepAccess(validReq, 'ortb2.user.data');
if (!userData || !Array.isArray(userData)) {
return null;
}
const topics = userData.filter(data => data?.ext?.segtax >= 600 && data?.ext?.segtax <= 609);
if (topics.length > 0) {
return topics;
}
return null;
}

registerBidder(spec);
68 changes: 62 additions & 6 deletions test/spec/modules/adgenerationBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,57 @@ describe('AdgenerationAdapter', function () {
}
},
schain: {ver: '1.0', complete: 1, nodes: [{asi: 'indirectseller.com', sid: '00001', hp: 1}]}
},
{ // bannerWithTopics
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',
ortb2: {
device: {
ext: {
cdep: 'fake_label_only_1.1'
}
},
user: {
data: [
{
ext: {
segtax: 600,
segclass: 'm1'
},
segment: [
{id: '1'},
{id: '2'}
]
},
{
ext: {
segtax: 600,
segclass: 'm2'
},
segment: [
{id: '3'}
]
},
{
ext: {
segtax: 599,
segclass: 'm2'
},
segment: [
{id: '3'}
]
}
]
}
}
}
];
const bidderRequest = {
Expand All @@ -184,12 +235,13 @@ describe('AdgenerationAdapter', function () {
}
};
const data = {
banner: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=300x250%2C320x100&currency=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.6.3&imark=1&tp=https%3A%2F%2Fexample.com`,
bannerUSD: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=300x250%2C320x100&currency=USD&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.6.3&imark=1&tp=https%3A%2F%2Fexample.com`,
native: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=1x1&currency=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.6.3&tp=https%3A%2F%2Fexample.com`,
bannerWithHyperId: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=320x100&currency=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.6.3&imark=1&tp=https%3A%2F%2Fexample.com&hyper_id=novatiqId`,
bannerWithAdgextCriteoId: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=320x100&currency=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.6.3&adgext_criteo_id=criteo-id-test-1234567890&imark=1&tp=https%3A%2F%2Fexample.com`,
bannerWithAdgextIds: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=320x100&currency=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.6.3&adgext_id5_id=id5-id-test-1234567890&adgext_id5_id_link_type=2&adgext_imuid=i.KrAH6ZAZTJOnH5S4N2sogA&adgext_uid2=AgAAAAVacu1uAxgAxH%2BHJ8%2BnWlS2H4uVqr6i%2BHBDCNREHD8WKsio%2Fx7D8xXFuq1cJycUU86yXfTH9Xe%2F4C8KkH%2B7UCiU7uQxhyD7Qxnv251pEs6K8oK%2BBPLYR%2B8BLY%2FsJKesa%2FkoKwx1FHgUzIBum582tSy2Oo%2B7C6wYUaaV4QcLr%2F4LPA%3D&gpid=%2F1111%2Fhomepage%23300x250&uach=%7B%22source%22%3A2%2C%22platform%22%3A%7B%22brand%22%3A%22macOS%22%7D%2C%22browsers%22%3A%5B%7B%22brand%22%3A%22Chromium%22%2C%22version%22%3A%5B%22112%22%5D%7D%2C%7B%22brand%22%3A%22Google%20Chrome%22%2C%22version%22%3A%5B%22112%22%5D%7D%2C%7B%22brand%22%3A%22Not%3AA-Brand%22%2C%22version%22%3A%5B%2299%22%5D%7D%5D%2C%22mobile%22%3A0%7D&schain=%7B%22ver%22%3A%221.0%22%2C%22complete%22%3A1%2C%22nodes%22%3A%5B%7B%22asi%22%3A%22indirectseller.com%22%2C%22sid%22%3A%2200001%22%2C%22hp%22%3A1%7D%5D%7D&imark=1&tp=https%3A%2F%2Fexample.com`,
banner: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=300x250%2C320x100&currency=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.6.4&imark=1&tp=https%3A%2F%2Fexample.com`,
bannerUSD: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=300x250%2C320x100&currency=USD&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.6.4&imark=1&tp=https%3A%2F%2Fexample.com`,
native: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=1x1&currency=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.6.4&tp=https%3A%2F%2Fexample.com`,
bannerWithHyperId: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=320x100&currency=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.6.4&imark=1&tp=https%3A%2F%2Fexample.com&hyper_id=novatiqId`,
bannerWithAdgextCriteoId: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=320x100&currency=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.6.4&adgext_criteo_id=criteo-id-test-1234567890&imark=1&tp=https%3A%2F%2Fexample.com`,
bannerWithAdgextIds: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=320x100&currency=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.6.4&adgext_id5_id=id5-id-test-1234567890&adgext_id5_id_link_type=2&adgext_imuid=i.KrAH6ZAZTJOnH5S4N2sogA&adgext_uid2=AgAAAAVacu1uAxgAxH%2BHJ8%2BnWlS2H4uVqr6i%2BHBDCNREHD8WKsio%2Fx7D8xXFuq1cJycUU86yXfTH9Xe%2F4C8KkH%2B7UCiU7uQxhyD7Qxnv251pEs6K8oK%2BBPLYR%2B8BLY%2FsJKesa%2FkoKwx1FHgUzIBum582tSy2Oo%2B7C6wYUaaV4QcLr%2F4LPA%3D&gpid=%2F1111%2Fhomepage%23300x250&uach=%7B%22source%22%3A2%2C%22platform%22%3A%7B%22brand%22%3A%22macOS%22%7D%2C%22browsers%22%3A%5B%7B%22brand%22%3A%22Chromium%22%2C%22version%22%3A%5B%22112%22%5D%7D%2C%7B%22brand%22%3A%22Google%20Chrome%22%2C%22version%22%3A%5B%22112%22%5D%7D%2C%7B%22brand%22%3A%22Not%3AA-Brand%22%2C%22version%22%3A%5B%2299%22%5D%7D%5D%2C%22mobile%22%3A0%7D&schain=%7B%22ver%22%3A%221.0%22%2C%22complete%22%3A1%2C%22nodes%22%3A%5B%7B%22asi%22%3A%22indirectseller.com%22%2C%22sid%22%3A%2200001%22%2C%22hp%22%3A1%7D%5D%7D&imark=1&tp=https%3A%2F%2Fexample.com`,
bannerWithTopics: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=320x100&currency=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.6.4&cdep=fake_label_only_1.1&imark=1&tp=https%3A%2F%2Fexample.com&ptopics=%5B%7B%22ext%22%3A%7B%22segtax%22%3A600%2C%22segclass%22%3A%22m1%22%7D%2C%22segment%22%3A%5B%7B%22id%22%3A%221%22%7D%2C%7B%22id%22%3A%222%22%7D%5D%7D%2C%7B%22ext%22%3A%7B%22segtax%22%3A600%2C%22segclass%22%3A%22m2%22%7D%2C%22segment%22%3A%5B%7B%22id%22%3A%223%22%7D%5D%7D%5D`,
};
it('sends bid request to ENDPOINT via GET', function () {
const request = spec.buildRequests(bidRequests, bidderRequest)[0];
Expand Down Expand Up @@ -236,6 +288,10 @@ describe('AdgenerationAdapter', function () {
const request = spec.buildRequests(bidRequests, bidderRequest)[4];
expect(request.data).to.equal(data.bannerWithAdgextIds);
});
it('should attache params to the bannerWithTopics request', function () {
const request = spec.buildRequests(bidRequests, bidderRequest)[5];
expect(request.data).to.equal(data.bannerWithTopics);
});

it('allows setConfig to set bidder currency for JPY', function () {
config.setConfig({
Expand Down