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

Emx gdpr user sync update #5611

Merged
merged 13 commits into from
Aug 18, 2020
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');
});
});
});