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

DeepIntent Bid Adapter : add gpp and coppa compliance support #11239

Merged
merged 14 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
15 changes: 15 additions & 0 deletions modules/deepintentBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { generateUUID, deepSetValue, deepAccess, isArray, isInteger, logError, logWarn } from '../src/utils.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER, VIDEO} from '../src/mediaTypes.js';
import {config} from '../src/config.js';
const BIDDER_CODE = 'deepintent';
const GVL_ID = 541;
const BIDDER_ENDPOINT = 'https://prebid.deepintent.com/prebid';
Expand Down Expand Up @@ -98,6 +99,20 @@ export const spec = {
deepSetValue(openRtbBidRequest, 'regs.ext.gdpr', (bidderRequest.gdprConsent.gdprApplies ? 1 : 0));
}

// GPP Consent
if (bidderRequest?.gppConsent?.gppString) {
deepSetValue(openRtbBidRequest, 'regs.gpp', bidderRequest.gppConsent.gppString);
deepSetValue(openRtbBidRequest, 'regs.gpp_sid', bidderRequest.gppConsent.applicableSections);
} else if (bidderRequest?.ortb2?.regs?.gpp) {
deepSetValue(openRtbBidRequest, 'regs.gpp', bidderRequest.ortb2.regs.gpp);
deepSetValue(openRtbBidRequest, 'regs.gpp_sid', bidderRequest.ortb2.regs.gpp_sid);
}

// coppa compliance
if (config.getConfig('coppa') === true) {
parthshah51999 marked this conversation as resolved.
Show resolved Hide resolved
deepSetValue(openRtbBidRequest, 'regs.coppa', 1);
}

injectEids(openRtbBidRequest, validBidRequests);

return {
Expand Down
39 changes: 38 additions & 1 deletion test/spec/modules/deepintentBidAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {expect} from 'chai';
import {spec} from 'modules/deepintentBidAdapter.js';
import {config} from '../../../src/config.js';
import * as utils from '../../../src/utils.js';

describe('Deepintent adapter', function () {
Expand Down Expand Up @@ -357,5 +358,41 @@ describe('Deepintent adapter', function () {
let response = spec.interpretResponse(invalidResponse, bRequest);
expect(response[0].mediaType).to.equal(undefined);
});
})
});
describe('GPP and coppa', function() {
it('Request params check with GPP Consent', function () {
let bidderReq = {gppConsent: {gppString: 'gpp-string-test', applicableSections: [5]}};
let bRequest = spec.buildRequests(request, bidderReq);
let data = JSON.parse(bRequest.data);
expect(data.regs.gpp).to.equal('gpp-string-test');
expect(data.regs.gpp_sid[0]).to.equal(5);
});
it('Request params check with GPP Consent read from ortb2', function () {
let bidderReq = {
ortb2: {
regs: {
gpp: 'gpp-test-string',
gpp_sid: [5]
}
}
};
let bRequest = spec.buildRequests(request, bidderReq);
let data = JSON.parse(bRequest.data);
expect(data.regs.gpp).to.equal('gpp-test-string');
expect(data.regs.gpp_sid[0]).to.equal(5);
});
it('should include coppa flag in bid request if coppa is set to true', () => {
let sandbox = sinon.sandbox.create();
sandbox.stub(config, 'getConfig').callsFake(key => {
const config = {
'coppa': true
};
return config[key];
});
const bRequest = spec.buildRequests(request);
let data = JSON.parse(bRequest.data);
expect(data.regs.coppa).to.equal(1);
sandbox.restore();
});
});
});