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

talkads Bid Adapter: update params access in case of different ad servers #8390

Merged
merged 4 commits into from
May 9, 2022
Merged
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
13 changes: 8 additions & 5 deletions modules/talkadsBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import {ajax} from '../src/ajax.js';

const CURRENCY = 'EUR';
const BIDDER_CODE = 'talkads';
const GVLID = 1074;

export const spec = {
code: BIDDER_CODE,
gvlid: GVLID,
supportedMediaTypes: [ NATIVE, BANNER ],
params: null,

/**
* Determines whether or not the given bid request is valid.
Expand All @@ -31,7 +32,7 @@ export const spec = {
utils.logError('VALIDATION FAILED : the parameter "bidder_url" must be defined');
return false;
}
this.params = poBid.params;

return !!(poBid.nativeParams || poBid.sizes);
}, // isBidRequestValid

Expand All @@ -54,6 +55,7 @@ export const spec = {
}
return loOne;
});
let laParams = paValidBidRequests[0].params;
const loServerRequest = {
cur: CURRENCY,
timeout: poBidderRequest.timeout,
Expand All @@ -71,7 +73,7 @@ export const spec = {
loServerRequest.gdpr.consent = poBidderRequest.gdprConsent.consentString;
}
}
const lsUrl = this.params.bidder_url + '/' + this.params.tag_id;
const lsUrl = laParams.bidder_url + '/' + laParams.tag_id;
return {
method: 'POST',
url: lsUrl,
Expand All @@ -86,7 +88,7 @@ export const spec = {
* @param poPidRequest Request original server request
* @return An array of bids which were nested inside the server.
*/
interpretResponse: (poServerResponse, poPidRequest) => {
interpretResponse: function (poServerResponse, poPidRequest) {
utils.logInfo('interpretResponse : ', poServerResponse);
if (!poServerResponse.body) {
return [];
Expand Down Expand Up @@ -120,8 +122,9 @@ export const spec = {
*/
onBidWon: function (poBid) {
utils.logInfo('onBidWon : ', poBid);
let laParams = poBid.params[0];
if (poBid.pbid) {
ajax(this.params.bidder_url + 'won/' + poBid.pbid);
ajax(laParams.bidder_url + 'won/' + poBid.pbid);
}
}, // onBidWon
};
Expand Down
4 changes: 3 additions & 1 deletion test/spec/modules/talkadsBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ describe('TalkAds adapter', function () {
ttl: 60,
creativeId: 'c123a456',
netRevenue: false,
params: [Object.assign({}, commonBidRequest.params)],
}
spec.onBidWon(loBid)
expect(server.requests.length).to.equals(0);
Expand All @@ -222,7 +223,8 @@ describe('TalkAds adapter', function () {
ttl: 60,
creativeId: 'c123a456',
netRevenue: false,
pbid: '6147833a65749742875ace47'
pbid: '6147833a65749742875ace47',
params: [Object.assign({}, commonBidRequest.params)],
}
spec.onBidWon(loBid)
expect(server.requests[0].url).to.equals('https://test.natexo-programmatic.com/tad/tag/prebidwon/6147833a65749742875ace47');
Expand Down