Skip to content

Commit

Permalink
PulsePoint Bid Adapter: support timeout/tmax (prebid#9465)
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 prebid#509

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

* ET-1850: Fixing prebid#866

* Minor fix

* Adding mandatory parameters to Bid

* ET-12672 - passing tmax value to PulsePoint bidder

* ET-12672 - using 500ms as a default and adding formatting

Co-authored-by: anand-venkatraman <[email protected]>
  • Loading branch information
ProfessorEugene and anand-venkatraman authored Jan 26, 2023
1 parent 9a5f08c commit 60f96ab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions modules/pulsepointBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const DEFAULT_BID_TTL = 20;
const DEFAULT_CURRENCY = 'USD';
const DEFAULT_NET_REVENUE = true;
const KNOWN_PARAMS = ['cp', 'ct', 'cf', 'video', 'battr', 'bcat', 'badv', 'bidfloor'];
const DEFAULT_TMAX = 500;

/**
* PulsePoint Bid Adapter.
Expand Down Expand Up @@ -54,6 +55,7 @@ export const spec = {
user: user(bidRequests[0], bidderRequest),
regs: regs(bidderRequest),
source: source(bidRequests[0].schain),
tmax: bidderRequest.timeout || DEFAULT_TMAX,
};
return {
method: 'POST',
Expand Down
12 changes: 11 additions & 1 deletion test/spec/modules/pulsepointBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import {expect} from 'chai';
import {spec} from 'modules/pulsepointBidAdapter.js';
import {deepClone} from 'src/utils.js';
import { config } from 'src/config.js';

describe('PulsePoint Adapter Tests', function () {
const slotConfigs = [{
Expand Down Expand Up @@ -225,6 +224,8 @@ describe('PulsePoint Adapter Tests', function () {
expect(ortbRequest.imp[1].banner).to.not.equal(null);
expect(ortbRequest.imp[1].banner.w).to.equal(728);
expect(ortbRequest.imp[1].banner.h).to.equal(90);
// tmax
expect(ortbRequest.tmax).to.equal(500);
});

it('Verify parse response', function () {
Expand Down Expand Up @@ -918,4 +919,13 @@ describe('PulsePoint Adapter Tests', function () {
}
});
});

it('Verify bid request timeouts', function () {
const mkRequest = (bidderRequest) => spec.buildRequests(slotConfigs, bidderRequest).data;
// assert default is used when no bidderRequest.timeout value is available
expect(mkRequest(bidderRequest).tmax).to.equal(500)

// assert bidderRequest value is used when available
expect(mkRequest(Object.assign({}, { timeout: 6000 }, bidderRequest)).tmax).to.equal(6000)
});
});

0 comments on commit 60f96ab

Please sign in to comment.