Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PulsePoint Bid Adapter: First party data #9114

Merged
merged 47 commits into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
2fba6a2
ET-1691: Pulsepoint Analytics adapter for Prebid. (#1)
anand-venkatraman Oct 14, 2016
ca17acb
Merge remote-tracking branch 'upstream/master'
anand-venkatraman Oct 25, 2016
5da43c3
Adding bidRequest to bidFactory.createBid method as per https://githu…
anand-venkatraman Oct 25, 2016
cf41114
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Nov 8, 2016
62756a9
ET-1765: Adding support for additional params in PulsePoint adapter (#2)
anand-venkatraman Nov 9, 2016
f8fabb7
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Dec 8, 2016
b9af15c
ET-1850: Fixing https://github.com/prebid/Prebid.js/issues/866
anand-venkatraman Dec 8, 2016
6523c25
Merge pull request #3 from pulsepointinc/ET-1850
anand-venkatraman Dec 8, 2016
b5eeb7f
Minor fix
anand-venkatraman Dec 8, 2016
0f33ef5
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Mar 1, 2017
b5dbd34
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Jun 27, 2017
d6fcd11
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Jul 17, 2017
fce16ad
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Aug 15, 2017
9833867
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Sep 22, 2017
70924c5
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Oct 12, 2017
41f4aca
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Nov 13, 2017
aae98a7
Adding mandatory parameters to Bid
anand-venkatraman Nov 13, 2017
6d546ed
Merge from upstream
anand-venkatraman Nov 27, 2017
a04a18f
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Mar 7, 2018
467e9e3
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Apr 20, 2018
af1b3db
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Apr 30, 2018
a438b67
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman May 4, 2018
e2fa8c3
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman May 21, 2018
6db9eb4
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman May 22, 2018
92a6034
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman May 29, 2018
2195429
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Jan 21, 2019
c0e32d5
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman May 18, 2019
832976a
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman May 30, 2019
b780838
Merge branch 'master' of github.com:prebid/Prebid.js
anand-venkatraman Jun 19, 2019
07ccd3d
Merge branch 'master' of github.com:prebid/Prebid.js
anand-venkatraman Jul 10, 2019
8b5815f
Merge branch 'master' of github.com:prebid/Prebid.js
anand-venkatraman Jul 15, 2019
3d0dcc2
Merge branch 'master' of github.com:prebid/Prebid.js
anand-venkatraman Oct 1, 2019
4f24443
Merge branch 'master' of github.com:prebid/Prebid.js
anand-venkatraman Oct 30, 2019
cf94b55
Merge branch 'master' of github.com:prebid/Prebid.js
anand-venkatraman Oct 31, 2019
ac055d1
Merge branch 'master' of github.com:prebid/Prebid.js
anand-venkatraman Nov 7, 2019
66a991b
Merge branch 'master' of github.com:prebid/Prebid.js
anand-venkatraman Dec 9, 2019
4436d00
Merge branch 'master' of github.com:prebid/Prebid.js
anand-venkatraman Jan 23, 2020
7d3b19d
Merge branch 'master' of github.com:prebid/Prebid.js
anand-venkatraman Mar 13, 2020
692c23e
Merge branch 'master' of github.com:prebid/Prebid.js
anand-venkatraman Oct 13, 2020
5066f39
Merge branch 'master' of github.com:prebid/Prebid.js
anand-venkatraman Nov 17, 2020
e59be71
Merge branch 'master' of github.com:prebid/Prebid.js
anand-venkatraman Jan 20, 2021
4fa3fad
Merge branch 'master' of github.com:prebid/Prebid.js
anand-venkatraman Mar 4, 2021
df46692
Merge branch 'prebid:master' into master
anand-venkatraman May 27, 2021
079b395
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Sep 3, 2021
04f456a
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Mar 24, 2022
d575037
Merge branch 'master' of https://github.com/prebid/Prebid.js
anand-venkatraman Oct 12, 2022
ddb85b8
PulsePoint: Firstparty data support
anand-venkatraman Oct 12, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions modules/pulsepointBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,16 @@ function bidResponseAvailable(request, response) {
* Produces an OpenRTBImpression from a slot config.
*/
function impression(slot) {
var firstPartyData = slot.ortb2Imp?.ext || {};
var ext = Object.assign({}, firstPartyData, slotUnknownParams(slot));
return {
id: slot.bidId,
banner: banner(slot),
'native': nativeImpression(slot),
tagid: slot.params.ct.toString(),
video: video(slot),
bidfloor: bidFloor(slot),
ext: ext(slot),
ext: Object.keys(ext).length > 0 ? ext : null,
};
}

Expand Down Expand Up @@ -209,7 +211,7 @@ function video(slot) {
/**
* Unknown params are captured and sent on ext
*/
function ext(slot) {
function slotUnknownParams(slot) {
const ext = {};
const knownParamsMap = {};
KNOWN_PARAMS.forEach(value => knownParamsMap[value] = 1);
Expand Down Expand Up @@ -330,14 +332,16 @@ function site(bidRequests, bidderRequest) {
const pubId = bidRequests && bidRequests.length > 0 ? bidRequests[0].params.cp : '0';
const appParams = bidRequests[0].params.app;
if (!appParams) {
return {
// use the first party data if available, and override only publisher/ref/page properties
var firstPartyData = bidderRequest?.ortb2?.site || {};
return Object.assign({}, firstPartyData, {
publisher: {
id: pubId.toString(),
},
// TODO: does the fallback make sense here?
ref: bidderRequest?.refererInfo?.ref || window.document.referrer,
page: bidderRequest?.refererInfo?.page || ''
}
});
}
return null;
}
Expand Down Expand Up @@ -406,7 +410,8 @@ function adSize(slot, sizes) {
* an openrtb User object.
*/
function user(bidRequest, bidderRequest) {
var ext = {};
var user = bidderRequest?.ortb2?.user || { ext: {} };
var ext = user.ext;
if (bidderRequest) {
if (bidderRequest.gdprConsent) {
ext.consent = bidderRequest.gdprConsent.consentString;
Expand All @@ -418,7 +423,7 @@ function user(bidRequest, bidderRequest) {
ext.eids = eids;
}
}
return { ext };
return user;
}

/**
Expand Down
123 changes: 123 additions & 0 deletions test/spec/modules/pulsepointBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -795,4 +795,127 @@ describe('PulsePoint Adapter Tests', function () {
expect(ortbRequest.imp[0].video.minbitrate).to.equal(200);
expect(ortbRequest.imp[0].video.protocols).to.eql([1, 2, 4]);
});
it('Verify user level first party data', function () {
const bidderRequest = {
refererInfo: {
page: 'https://publisher.com/home',
ref: 'https://referrer'
},
gdprConsent: {
gdprApplies: true,
consentString: 'serialized_gpdr_data'
},
ortb2: {
user: {
yob: 1985,
gender: 'm',
ext: {
data: {
registered: true,
interests: ['cars']
}
}
}
}
};
let request = spec.buildRequests(slotConfigs, bidderRequest);
let ortbRequest = request.data;
expect(ortbRequest).to.not.equal(null);
expect(ortbRequest.user).to.not.equal(null);
expect(ortbRequest.user).to.deep.equal({
yob: 1985,
gender: 'm',
ext: {
data: {
registered: true,
interests: ['cars']
},
consent: 'serialized_gpdr_data'
}
});
});
it('Verify site level first party data', function () {
const bidderRequest = {
refererInfo: {
page: 'https://publisher.com/home',
ref: 'https://referrer'
},
ortb2: {
site: {
content: {
data: [{
name: 'www.iris.com',
ext: {
segtax: 500,
cids: ['iris_c73g5jq96mwso4d8']
}
}]
},
page: 'http://pub.com/news',
ref: 'http://google.com'
}
}
};
let request = spec.buildRequests(slotConfigs, bidderRequest);
let ortbRequest = request.data;
expect(ortbRequest).to.not.equal(null);
expect(ortbRequest.site).to.not.equal(null);
expect(ortbRequest.site).to.deep.equal({
content: {
data: [{
name: 'www.iris.com',
ext: {
segtax: 500,
cids: ['iris_c73g5jq96mwso4d8']
}
}]
},
page: 'https://publisher.com/home',
ref: 'https://referrer',
publisher: {
id: 'p10000'
}
});
});
it('Verify impression/slot level first party data', function () {
const bidderRequests = [{
placementCode: '/DfpAccount1/slot1',
mediaTypes: {
banner: {
sizes: [[1, 1]]
}
},
bidId: 'bid12345',
params: {
cp: 'p10000',
ct: 't10000',
extra_key1: 'extra_val1',
extra_key2: 12345
},
ortb2Imp: {
ext: {
data: {
pbadslot: 'homepage-top-rect',
adUnitSpecificAttribute: '123'
}
}
}
}];
let request = spec.buildRequests(bidderRequests, bidderRequest);
let ortbRequest = request.data;
expect(ortbRequest).to.not.equal(null);
expect(ortbRequest.imp).to.not.equal(null);
expect(ortbRequest.imp).to.have.lengthOf(1);
expect(ortbRequest.imp[0].ext).to.not.equal(null);
expect(ortbRequest.imp[0].ext).to.deep.equal({
prebid: {
extra_key1: 'extra_val1',
extra_key2: 12345
},
data: {
pbadslot: 'homepage-top-rect',
adUnitSpecificAttribute: '123'
}
});
});
});