Skip to content

Commit

Permalink
fix for #8421, Update ad generation adapter 1.5.0 (#9911)
Browse files Browse the repository at this point in the history
* fix for #8421

* update adapter version

* update test spec
  • Loading branch information
banakemi authored May 8, 2023
1 parent 122f67d commit b6d949f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 21 deletions.
39 changes: 24 additions & 15 deletions modules/adgenerationBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,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.4.0';
const ADGENE_PREBID_VERSION = '1.5.0';
let serverRequests = [];
for (let i = 0, len = validBidRequests.length; i < len; i++) {
const validReq = validBidRequests[i];
Expand Down Expand Up @@ -59,7 +59,6 @@ export const spec = {
data = tryAppendQueryString(data, 'imark', '1');
}

// TODO: is 'page' the right value here?
data = tryAppendQueryString(data, 'tp', bidderRequest.refererInfo.page);
if (isIos()) {
const hyperId = getHyperId(validReq);
Expand Down Expand Up @@ -210,35 +209,45 @@ function appendChildToBody(ad, data) {
return ad.replace(/<\/\s?body>/, `${data}</body>`);
}

/**
* create APVTag
* @return {string}
*/
function createAPVTag() {
const APVURL = 'https://cdn.apvdr.com/js/VideoAd.min.js';
let apvScript = document.createElement('script');
apvScript.type = 'text/javascript';
apvScript.id = 'apv';
apvScript.src = APVURL;
return apvScript.outerHTML;
return `<script type="text/javascript" id="apv" src="${APVURL}"></script>`
}

/**
* create ADGBrowserMTag
* @return {string}
*/
function createADGBrowserMTag() {
const ADGBrowserMURL = 'https://i.socdm.com/sdk/js/adg-browser-m.js';
return `<script type="text/javascript" src="${ADGBrowserMURL}"></script>`;
}

/**
* create APVTag & insertVast
* @param targetId
* @param vastXml
* @return {string}
*/
function insertVASTMethodForAPV(targetId, vastXml) {
let apvVideoAdParam = {
s: targetId
};
let script = document.createElement(`script`);
script.type = 'text/javascript';
script.innerHTML = `(function(){ new APV.VideoAd(${escapeUnsafeChars(JSON.stringify(apvVideoAdParam))}).load('${vastXml.replace(/\r?\n/g, '')}'); })();`;
return script.outerHTML;
return `<script type="text/javascript">(function(){ new APV.VideoAd(${escapeUnsafeChars(JSON.stringify(apvVideoAdParam))}).load('${vastXml.replace(/\r?\n/g, '')}'); })();</script>`
}

/**
* create ADGBrowserMTag & insertVast
* @param vastXml
* @param marginTop
* @return {string}
*/
function insertVASTMethodForADGBrowserM(vastXml, marginTop) {
const script = document.createElement(`script`);
script.type = 'text/javascript';
script.innerHTML = `window.ADGBrowserM.init({vastXml: '${vastXml.replace(/\r?\n/g, '')}', marginTop: '${marginTop}'});`;
return script.outerHTML;
return `<script type="text/javascript">window.ADGBrowserM.init({vastXml: '${vastXml.replace(/\r?\n/g, '')}', marginTop: '${marginTop}'});</script>`
}

/**
Expand Down
12 changes: 6 additions & 6 deletions test/spec/modules/adgenerationBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ 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.4.0&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.4.0&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.4.0&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.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&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`,
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`,
banner: `posall=SSPLOC&id=58278&sdktype=0&hb=true&t=json3&sizes=300x250%2C320x100&currency=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.5.0&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.5.0&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.5.0&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.5.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&currency=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.5.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&currency=JPY&pbver=${prebid.version}&sdkname=prebidjs&adapterver=1.5.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];
Expand Down

0 comments on commit b6d949f

Please sign in to comment.