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

Updated Bid params #2275

Merged
merged 2 commits into from
Mar 19, 2018
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
36 changes: 16 additions & 20 deletions modules/a4gBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export const spec = {

buildRequests: function(validBidRequests) {
let deliveryUrl = '';
let bidId = '';
const idParams = [];
const sizeParams = [];
const zoneIds = [];
Expand All @@ -33,10 +32,7 @@ export const spec = {
if (!deliveryUrl && typeof bid.params.deliveryUrl === 'string') {
deliveryUrl = bid.params.deliveryUrl;
}
if (!bidId) {
bidId = bid.bidId;
}
idParams.push(bid.adUnitCode);
idParams.push(bid.bidId);
sizeParams.push(bid.sizes.map(size => size.join(SIZE_SEPARATOR)).join(ARRAY_SIZE_SEPARATOR));
zoneIds.push(bid.params.zoneId);
});
Expand All @@ -48,7 +44,6 @@ export const spec = {
return {
method: 'GET',
url: deliveryUrl,
bidId: bidId,
data: {
[IFRAME_PARAM_NAME]: 0,
[LOCATION_PARAM_NAME]: utils.getTopWindowUrl(),
Expand All @@ -62,21 +57,22 @@ export const spec = {
interpretResponse: function(serverResponses, request) {
const bidResponses = [];
utils._each(serverResponses.body, function(response) {
const bidResponse = {
requestId: request.bidId,
cpm: response.cpm,
width: response.width,
height: response.height,
creativeId: response.zoneid,
currency: A4G_CURRENCY,
netRevenue: true,
ttl: A4G_TTL,
ad: response.ad,
adId: response.id
};
bidResponses.push(bidResponse);
if (response.cpm > 0) {
const bidResponse = {
requestId: response.id,
creativeId: response.id,
adId: response.id,
cpm: response.cpm,
width: response.width,
height: response.height,
currency: A4G_CURRENCY,
netRevenue: true,
ttl: A4G_TTL,
ad: response.ad
};
bidResponses.push(bidResponse);
}
});

return bidResponses;
}
};
Expand Down
10 changes: 5 additions & 5 deletions test/spec/modules/a4gBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ describe('a4gAdapterTests', () => {

let requiredKeys = [
'requestId',
'creativeId',
'adId',
'cpm',
'width',
'height',
'ad',
'adId',
'ttl',
'creativeId',
'currency',
'netRevenue',
'currency'
'ttl',
'ad'
];

let resultKeys = Object.keys(result[0]);
Expand Down