Skip to content

Commit

Permalink
PulsePoint Adapter GDPR support (#2471)
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

* Adding mandatory parameters to Bid

* Pulsepoint Bid Adapter - GDPR support

* minor update

* minor update

* Fixing review comment
  • Loading branch information
anand-venkatraman authored and jsnellbaker committed May 1, 2018
1 parent d28c4a8 commit a0fee37
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
13 changes: 12 additions & 1 deletion modules/pulsepointBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ export const spec = {
!!(bid && bid.params && bid.params.cp && bid.params.ct)
),

buildRequests: bidRequests => {
buildRequests: (bidRequests, bidderRequest) => {
const request = {
id: bidRequests[0].bidderRequestId,
imp: bidRequests.map(slot => impression(slot)),
site: site(bidRequests),
app: app(bidRequests),
device: device(),
};
applyGdpr(bidderRequest, request);
return {
method: 'POST',
url: '//bid.contextweb.com/header/ortb',
Expand Down Expand Up @@ -304,6 +305,16 @@ function adSize(slot) {
return [1, 1];
}

/**
* Applies GDPR parameters to request.
*/
function applyGdpr(bidderRequest, ortbRequest) {
if (bidderRequest && bidderRequest.gdprConsent) {
ortbRequest.regs = { ext: { gdpr: bidderRequest.gdprConsent.gdprApplies ? 1 : 0 } };
ortbRequest.user = { ext: { consent: bidderRequest.gdprConsent.consentString } };
}
}

/**
* Parses the native response from the Bid given.
*/
Expand Down
21 changes: 21 additions & 0 deletions test/spec/modules/pulsepointBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,4 +273,25 @@ describe('PulsePoint Adapter Tests', () => {
expect(ortbRequest.app.storeurl).to.equal('http://pulsepoint.com/apps');
expect(ortbRequest.app.domain).to.equal('pulsepoint.com');
});

it('Verify GDPR', () => {
const bidderRequest = {
gdprConsent: {
gdprApplies: true,
consentString: 'serialized_gpdr_data'
}
};
const request = spec.buildRequests(slotConfigs, bidderRequest);
expect(request.url).to.equal('//bid.contextweb.com/header/ortb');
expect(request.method).to.equal('POST');
const ortbRequest = JSON.parse(request.data);
// user object
expect(ortbRequest.user).to.not.equal(null);
expect(ortbRequest.user.ext).to.not.equal(null);
expect(ortbRequest.user.ext.consent).to.equal('serialized_gpdr_data');
// regs object
expect(ortbRequest.regs).to.not.equal(null);
expect(ortbRequest.regs.ext).to.not.equal(null);
expect(ortbRequest.regs.ext.gdpr).to.equal(1);
});
});

0 comments on commit a0fee37

Please sign in to comment.