Skip to content

Commit

Permalink
Emx bid adapter: gdpr user sync update (#5611)
Browse files Browse the repository at this point in the history
* adding ccpa support for emx_digital adapter

* emx_digital ccpa compliance: lint fix

* emx 3.0 compliance update

* fix outstream renderer issue, update test spec

* refactor formatVideoResponse function to use core-js/find

* Added GVLID to Adapter, Updated getUserSyncs to accept and leverage gdprConsent

* Added testing coverage for gdpr in getUserSyncs

Co-authored-by: Nick Colletti <nick.colletti@emxdigital.com>
Co-authored-by: Nick Colletti <gnomish@gmail.com>
Co-authored-by: Kiyoshi Hara <Kiyoshi.Hara@emxdigital.com>
Co-authored-by: Dan Bogdan <daniel.bogdan@emxdigital.com>
  • Loading branch information
5 people authored Aug 18, 2020
1 parent 97713dd commit f983af2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 8 deletions.
14 changes: 12 additions & 2 deletions modules/emx_digitalBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ export const emxAdapter = {

export const spec = {
code: BIDDER_CODE,
gvlid: 183,
supportedMediaTypes: [BANNER, VIDEO],
isBidRequestValid: function (bid) {
if (!bid || !bid.params) {
Expand Down Expand Up @@ -279,12 +280,21 @@ export const spec = {
}
return emxBidResponses;
},
getUserSyncs: function (syncOptions) {
getUserSyncs: function (syncOptions, responses, gdprConsent, uspConsent) {
const syncs = [];
if (syncOptions.iframeEnabled) {
let url = 'https://biddr.brealtime.com/check.html';
if (gdprConsent && typeof gdprConsent.consentString === 'string') {
// add 'gdpr' only if 'gdprApplies' is defined
if (typeof gdprConsent.gdprApplies === 'boolean') {
url += `?gdpr=${Number(gdprConsent.gdprApplies)}&gdpr_consent=${gdprConsent.consentString}`;
} else {
url += `?gdpr_consent=${gdprConsent.consentString}`;
}
}
syncs.push({
type: 'iframe',
url: 'https://biddr.brealtime.com/check.html'
url: url
});
}
return syncs;
Expand Down
23 changes: 17 additions & 6 deletions test/spec/modules/emx_digitalBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -612,12 +612,23 @@ describe('emx_digital Adapter', function () {
});

describe('getUserSyncs', function () {
let syncOptionsIframe = { iframeEnabled: true };
let syncOptionsPixel = { pixelEnabled: true };
it('Should push the correct sync type depending on the config', function () {
let iframeSync = spec.getUserSyncs(syncOptionsIframe);
expect(iframeSync.length).to.equal(1);
expect(iframeSync[0].type).to.equal('iframe');
it('should register the iframe sync url', function () {
let syncs = spec.getUserSyncs({
iframeEnabled: true
});
expect(syncs).to.not.be.an('undefined');
expect(syncs).to.have.lengthOf(1);
expect(syncs[0].type).to.equal('iframe');
});

it('should pass gdpr params', function () {
let syncs = spec.getUserSyncs({ iframeEnabled: true }, {}, {
gdprApplies: false, consentString: 'test'
});
expect(syncs).to.not.be.an('undefined');
expect(syncs).to.have.lengthOf(1);
expect(syncs[0].type).to.equal('iframe');
expect(syncs[0].url).to.contains('gdpr=0');
});
});
});

0 comments on commit f983af2

Please sign in to comment.