From 16c6e4191ee0011c8c9c542a92c23f7e7c918491 Mon Sep 17 00:00:00 2001 From: Jurij Sinickij Date: Wed, 3 May 2017 12:00:16 +0300 Subject: [PATCH] Pass through transactionId and set fd=1 --- src/adapters/adform.js | 9 ++++++--- test/spec/adapters/adform_spec.js | 18 ++++++++++++------ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/adapters/adform.js b/src/adapters/adform.js index 660c1c585b0..31eceba0b0d 100644 --- a/src/adapters/adform.js +++ b/src/adapters/adform.js @@ -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]; @@ -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'); @@ -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); diff --git a/test/spec/adapters/adform_spec.js b/test/spec/adapters/adform_spec.js index 80511be92ac..8888dbfe899 100644 --- a/test/spec/adapters/adform_spec.js +++ b/test/spec/adapters/adform_spec.js @@ -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' }); }); }); @@ -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', () => { @@ -111,6 +113,7 @@ describe('Adform adapter', () => { }); beforeEach(() => { + var transactionId = 'transactionId'; _adapter = adapter(); utils.getUniqueIdentifierStr = () => 'callback'; sandbox = sinon.sandbox.create(); @@ -126,7 +129,8 @@ describe('Adform adapter', () => { url: 'some// there' }, adxDomain: 'newdomain', - tid: 45 + tid: 45, + transactionId: transactionId }, { bidId: '123', @@ -136,7 +140,8 @@ describe('Adform adapter', () => { mid: 2, tid: 145, someVar: 'someValue' - } + }, + transactionId: transactionId }, { bidId: 'a1b', @@ -145,7 +150,8 @@ describe('Adform adapter', () => { params: { mid: 3, pdom: 'home' - } + }, + transactionId: transactionId } ]}); });