Skip to content

Commit

Permalink
Fix for bug #866 (#867)
Browse files Browse the repository at this point in the history
* ET-1691: Pulsepoint Analytics adapter for Prebid. (#1)

* ET-1691: Adding pulsepoint analytics and tests for pulsepoint adapter

* ET-1691: Adding pulsepoint analytics and tests for pulsepoint adapter

* ET-1691: cleanup

* ET-1691: minor

* ET-1691: revert package.json change

* Adding bidRequest to bidFactory.createBid method as per #509

* ET-1765: Adding support for additional params in PulsePoint adapter (#2)

* ET-1850: Fixing #866

* Minor fix
  • Loading branch information
anand-venkatraman authored and Nate Cozi committed Dec 16, 2016
1 parent 7650968 commit 62b2fab
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/adapters/pulsepoint.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var bidfactory = require('../bidfactory.js');
var bidmanager = require('../bidmanager.js');
var adloader = require('../adloader.js');
var utils = require('../utils.js');

var PulsePointAdapter = function PulsePointAdapter() {

Expand All @@ -19,8 +20,18 @@ var PulsePointAdapter = function PulsePointAdapter() {
var bids = params.bids;
for (var i = 0; i < bids.length; i++) {
var bidRequest = bids[i];
requestBid(bidRequest);
}
}

function requestBid(bidRequest) {
try {
var ppBidRequest = new window.pp.Ad(bidRequestOptions(bidRequest));
ppBidRequest.display();
} catch(e) {
//register passback on any exceptions while attempting to fetch response.
utils.logError('pulsepoint.requestBid', 'ERROR', e);
bidResponseAvailable(bidRequest);
}
}

Expand Down
14 changes: 14 additions & 0 deletions test/spec/adapters/pulsepoint_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,18 @@ describe("PulsePoint Adapter Tests", () => {
expect(bidCall.args[1]).to.be.a('object');
});

//related to issue https://github.com/prebid/Prebid.js/issues/866
it('Verify Passbacks when window.pp is not available', () => {
window.pp = function() {};
pulsepointAdapter.callBids(slotConfigs);
let placement = bidManager.addBidResponse.firstCall.args[0];
let bid = bidManager.addBidResponse.firstCall.args[1];
//verify that we passed back without exceptions, should window.pp be already taken.
expect(placement).to.equal('/DfpAccount1/slot1');
expect(bid.bidderCode).to.equal('pulsepoint');
expect(bid).to.not.have.property('ad');
expect(bid).to.not.have.property('cpm');
expect(bid.adId).to.equal('bid12345');
});

});

0 comments on commit 62b2fab

Please sign in to comment.