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

Pass interactionId parameter and fd=1 in Adform adapter. #1259

Merged
merged 1 commit into from
Jun 12, 2017
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
9 changes: 6 additions & 3 deletions src/adapters/adform.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ function AdformAdapter() {
};

function _callBids(params) {
var bid, _value, _key, i, j, k, l;
var bid, _value, _key, i, j, k, l, reqParams;
var bids = params.bids;
var request = [];
var callbackName = '_adf_' + utils.getUniqueIdentifierStr();
var globalParams = [ [ 'adxDomain', 'adx.adform.net' ], [ 'url', null ], [ 'tid', null ], [ 'callback', '$$PREBID_GLOBAL$$.' + callbackName ] ];
var globalParams = [ [ 'adxDomain', 'adx.adform.net' ], ['fd', 1], [ 'url', null ], [ 'tid', null ], [ 'callback', '$$PREBID_GLOBAL$$.' + callbackName ] ];

for (i = 0, l = bids.length; i < l; i++) {
bid = bids[i];
Expand All @@ -28,7 +28,9 @@ function AdformAdapter() {
}
}

request.push(formRequestUrl(bid.params));
reqParams = bid.params;
reqParams.transactionId = bid.transactionId;
request.push(formRequestUrl(reqParams));
}

request.unshift('//' + globalParams[0][1] + '/adx/?rp=4');
Expand Down Expand Up @@ -76,6 +78,7 @@ function AdformAdapter() {
bidObject.width = adItem.width;
bidObject.height = adItem.height;
bidObject.dealId = adItem.deal_id;
bidObject.transactionId = bid.transactionId;
bidmanager.addBidResponse(bid.placementCode, bidObject);
} else {
bidObject = bidfactory.createBid(STATUSCODES.NO_BID, bid);
Expand Down
18 changes: 12 additions & 6 deletions test/spec/adapters/adform_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,16 @@ describe('Adform adapter', () => {
assert.equal(_query.callback.split('.')[1], '_adf_callback');
assert.equal(_query.tid, 145);
assert.equal(_query.rp, 4);
assert.equal(_query.fd, 1);
assert.equal(_query.url, encodeURIComponent('some// there'));
});

it('should correctly form bid items', () => {
const _items = parseUrl(adLoader.loadScript.args[0][0]).items;

assert.deepEqual(_items[0], { mid: '1' });
assert.deepEqual(_items[1], { mid: '2', someVar: 'someValue' });
assert.deepEqual(_items[2], { mid: '3', pdom: 'home' });
assert.deepEqual(_items[0], { mid: '1', transactionId: 'transactionId' });
assert.deepEqual(_items[1], { mid: '2', someVar: 'someValue', transactionId: 'transactionId' });
assert.deepEqual(_items[2], { mid: '3', pdom: 'home', transactionId: 'transactionId' });
});
});

Expand All @@ -60,6 +61,7 @@ describe('Adform adapter', () => {
assert.equal(_bidObject.width, 90);
assert.equal(_bidObject.height, 90);
assert.equal(_bidObject.dealId, 'deal-1');
assert.equal(_bidObject.transactionId, 'transactionId');
});

it('should correctly form empty bid response object', () => {
Expand Down Expand Up @@ -111,6 +113,7 @@ describe('Adform adapter', () => {
});

beforeEach(() => {
var transactionId = 'transactionId';
_adapter = adapter();
utils.getUniqueIdentifierStr = () => 'callback';
sandbox = sinon.sandbox.create();
Expand All @@ -126,7 +129,8 @@ describe('Adform adapter', () => {
url: 'some// there'
},
adxDomain: 'newdomain',
tid: 45
tid: 45,
transactionId: transactionId
},
{
bidId: '123',
Expand All @@ -136,7 +140,8 @@ describe('Adform adapter', () => {
mid: 2,
tid: 145,
someVar: 'someValue'
}
},
transactionId: transactionId
},
{
bidId: 'a1b',
Expand All @@ -145,7 +150,8 @@ describe('Adform adapter', () => {
params: {
mid: 3,
pdom: 'home'
}
},
transactionId: transactionId
}
]});
});
Expand Down