diff --git a/src/adapters/appnexus.js b/src/adapters/appnexus.js index 0a3b8f7284b..4dc1a368cbc 100644 --- a/src/adapters/appnexus.js +++ b/src/adapters/appnexus.js @@ -61,6 +61,7 @@ AppNexusAdapter = function AppNexusAdapter() { } jptCall = utils.tryAppendQueryString(jptCall, 'code', inventoryCode); + jptCall = utils.tryAppendQueryString(jptCall, 'traffic_source_code', (utils.getBidIdParameter('trafficSourceCode', bid.params))); //sizes takes a bit more logic var sizeQueryString = ''; diff --git a/test/spec/adapters/appnexus_spec.js b/test/spec/adapters/appnexus_spec.js new file mode 100644 index 00000000000..c29bd3dfdbe --- /dev/null +++ b/test/spec/adapters/appnexus_spec.js @@ -0,0 +1,43 @@ +import {expect} from 'chai'; +import Adapter from '../../../src/adapters/appnexus'; +import bidManager from '../../../src/bidmanager'; +import adLoader from '../../../src/adloader'; + +describe('AppNexus Adapter', () => { + + let adapter; + + const REQUEST = { + 'bidderCode': 'appnexus', + 'requestId': 'd3e07445-ab06-44c8-a9dd-5ef9af06d2a6', + 'bidderRequestId': '7101db09af0db2', + 'bids': [ + { + 'bidder': 'appnexus', + 'params': { + 'placementId': '4799418', + 'trafficSourceCode' : 'source' + }, + 'placementCode': '/19968336/header-bid-tag1', + 'sizes': [ + [728, 90], + [970, 90] + ], + 'bidId': '84ab500420319d', + 'bidderRequestId': '7101db09af0db2', + 'requestId': 'd3e07445-ab06-44c8-a9dd-5ef9af06d2a6' + } + ], + 'start': 1469479810130 + }; + + sinon.stub(bidManager, 'addBidResponse'); + const adLoaderStub = sinon.stub(adLoader, 'loadScript'); + + describe('callBids', () => { + adapter = new Adapter(); + adapter.callBids(REQUEST); + expect(adLoaderStub.getCall(0).args[0]).to.contain('traffic_source_code=source'); + }); + +});