diff --git a/src/adapters/adbutler.js b/src/adapters/adbutler.js index 00f8d4db1a2a..a0005e89e4f9 100644 --- a/src/adapters/adbutler.js +++ b/src/adapters/adbutler.js @@ -105,11 +105,16 @@ var AdButlerAdapter = function AdButlerAdapter() { } function buildRequest(bid,adIndex,pageID){ - var accountID = utils.getBidIdParameter('accountID', bid.params); - var zoneID = utils.getBidIdParameter('zoneID', bid.params); - var keyword = utils.getBidIdParameter('keyword', bid.params); - - var requestURI = location.protocol + '//servedbyadbutler.com/adserve/;type=hbr;'; + var accountID = utils.getBidIdParameter('accountID', bid.params), + zoneID = utils.getBidIdParameter('zoneID', bid.params), + keyword = utils.getBidIdParameter('keyword', bid.params), + domain = utils.getBidIdParameter('domain', bid.params); + + if(typeof domain === 'undefined' || domain.length === 0){ + domain = 'servedbyadbutler.com'; + } + + var requestURI = location.protocol + '//' + domain + '/adserve/;type=hbr;'; requestURI += 'ID='+encodeURIComponent(accountID)+';'; requestURI += 'setID='+encodeURIComponent(zoneID)+';'; requestURI += 'pid='+encodeURIComponent(pageID)+';'; diff --git a/test/spec/adapters/adbutler_spec.js b/test/spec/adapters/adbutler_spec.js index 465ef89bfe67..172c22052107 100644 --- a/test/spec/adapters/adbutler_spec.js +++ b/test/spec/adapters/adbutler_spec.js @@ -83,7 +83,33 @@ describe('adbutler adapter tests', function () { var requestURI = stubLoadScript.getCall(0).args[0]; expect(requestURI).to.have.string(';kw=fish;'); - }) + }); + + it('should use custom domain string',function(){ + var params = { + bidderCode: 'adbutler', + bids: [ + { + bidId: '3c9408cdbf2f68', + sizes: [[300, 250]], + bidder: 'adbutler', + params: { + accountID: '107878', + zoneID: '86133', + domain: 'servedbyadbutler.com.dan.test' + }, + requestId: '10b327aa396609', + placementCode: '/123456/header-bid-tag-1' + } + ] + }; + + adapter().callBids(params); + + var requestURI = stubLoadScript.getCall(0).args[0]; + + expect(requestURI).to.have.string('.dan.test'); + }); }); describe('bid responses',function(){