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

Include us_privacy string in redirects #8

Merged
merged 6 commits into from
Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 9 additions & 2 deletions modules/emx_digitalBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,16 +354,23 @@ export const spec = {
},
getUserSyncs: function (syncOptions, responses, gdprConsent, uspConsent) {
const syncs = [];
const consentParams = [];
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}`;
consentParams.push(`gdpr=${Number(gdprConsent.gdprApplies)}&gdpr_consent=${gdprConsent.consentString}`);
} else {
url += `?gdpr_consent=${gdprConsent.consentString}`;
consentParams.push(`?gdpr_consent=${gdprConsent.consentString}`);
}
}
if (uspConsent && typeof uspConsent.consentString === 'string') {
consentParams.push(`usp=${uspConsent.consentString}`);
}
if (consentParams.length > 0) {
url = url + '?' + consentParams.join('&');
}
syncs.push({
type: 'iframe',
url: url
Expand Down
29 changes: 29 additions & 0 deletions test/spec/modules/emx_digitalBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,7 @@ describe('emx_digital Adapter', function () {
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.equal('https://biddr.brealtime.com/check.html')
});

it('should pass gdpr params', function () {
Expand All @@ -734,6 +735,34 @@ describe('emx_digital Adapter', function () {
expect(syncs).to.have.lengthOf(1);
expect(syncs[0].type).to.equal('iframe');
expect(syncs[0].url).to.contains('gdpr=0');
expect(syncs[0].url).to.equal('https://biddr.brealtime.com/check.html?gdpr=0&gdpr_consent=test')
});

it('should pass us_privacy string', function () {
let syncs = spec.getUserSyncs({ iframeEnabled: true }, {}, {}, {
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('usp=test');
});

it('should pass us_privacy and gdpr strings', function () {
let syncs = spec.getUserSyncs({ iframeEnabled: true }, {},
{
gdprApplies: true,
consentString: 'test'
},
{
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=1');
expect(syncs[0].url).to.contains('usp=test');
expect(syncs[0].url).to.equal('https://biddr.brealtime.com/check.html?gdpr=1&gdpr_consent=test&usp=test')
});
});
});