Skip to content

Commit

Permalink
PulsePoint Adapter - Support for additional parameters. (#784)
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
  • Loading branch information
anand-venkatraman authored and jaiminpanchal27 committed Nov 16, 2016
1 parent 7076dda commit 9117edb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
29 changes: 18 additions & 11 deletions src/adapters/pulsepoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,28 @@ var PulsePointAdapter = function PulsePointAdapter() {
var bids = params.bids;
for (var i = 0; i < bids.length; i++) {
var bidRequest = bids[i];
var callback = bidResponseCallback(bidRequest);
var ppBidRequest = new window.pp.Ad({
cf: bidRequest.params.cf,
cp: bidRequest.params.cp,
ct: bidRequest.params.ct,
cn: 1,
ca: window.pp.requestActions.BID,
cu: bidUrl,
adUnitId: bidRequest.placementCode,
callback: callback
});
var ppBidRequest = new window.pp.Ad(bidRequestOptions(bidRequest));
ppBidRequest.display();
}
}

function bidRequestOptions(bidRequest) {
var callback = bidResponseCallback(bidRequest);
var options = {
cn: 1,
ca: window.pp.requestActions.BID,
cu: bidUrl,
adUnitId: bidRequest.placementCode,
callback: callback
};
for(var param in bidRequest.params) {
if(bidRequest.params.hasOwnProperty(param)) {
options[param] = bidRequest.params[param];
}
}
return options;
}

function bidResponseCallback(bid) {
return function (bidResponse) {
bidResponseAvailable(bid, bidResponse);
Expand Down
6 changes: 5 additions & 1 deletion test/spec/adapters/pulsepoint_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ describe("PulsePoint Adapter Tests", () => {
params: {
cp: "p10000",
ct: "t10000",
cf: "300x250"
cf: "300x250",
param1: "value1",
param2: 2
}
},{
placementCode: "/DfpAccount2/slot2",
Expand Down Expand Up @@ -79,6 +81,8 @@ describe("PulsePoint Adapter Tests", () => {
expect(requests[0].cu).to.equal('http://bid.contextweb.com/header/tag');
expect(requests[0].adUnitId).to.equal('/DfpAccount1/slot1');
expect(requests[0]).to.have.property('callback');
expect(requests[0].param1).to.equal('value1');
expect(requests[0].param2).to.equal(2);
// //slot 2
expect(requests[1].cp).to.equal('p20000');
expect(requests[1].ct).to.equal('t20000');
Expand Down

0 comments on commit 9117edb

Please sign in to comment.