Skip to content

Commit c30f105

Browse files
garciapuiggguridi
andauthored
AzerionEdge RTD Module: Compatibility with GDPR/USP Privacy Modules (prebid#11775)
* Azerion Edge RTD Module: Initial release ### Type of change [x] Feature: New RTD Submodule ### Description of change Adds new Azerion Edge RTD module. Maintainer: azerion.com Contact: @garciapuig @mserrate @gguridi * Azerion Edge RTD Module: Initial release. Typo * AzerionEdge RTD Module: Documentation: Required parameters Type of change: Documentation/Feature Description of change: Specifying new required parameters on documentation. Updating examples. * AzerionEdge RTD Module: Compatible with GDPR/USP Privacy Modules (#14) - Added GDPR validation. - We validate against ImproveDigital vendor ID consent and several purposes. - We don't load edge script, nor process the existing data, if consent wasn't given. - Adding support for USP consent. * AzerionEdgeRTDModule: Passing the consent to the script execution (#17) Adding GVL ID to the module configuration Passing the consent to the script execution instead of handling it in prebid (#16) --------- Co-authored-by: Gorka Guridi <[email protected]> --------- Co-authored-by: Gorka Guridi <[email protected]>
1 parent 4422d44 commit c30f105

File tree

3 files changed

+49
-41
lines changed

3 files changed

+49
-41
lines changed

modules/azerionedgeRtdProvider.js

+13-3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ const REAL_TIME_MODULE = 'realTimeData';
1919
const SUBREAL_TIME_MODULE = 'azerionedge';
2020
export const STORAGE_KEY = 'ht-pa-v1-a';
2121

22+
const IMPROVEDIGITAL_GVLID = '253';
23+
2224
export const storage = getStorageManager({
2325
moduleType: MODULE_TYPE_RTD,
2426
moduleName: SUBREAL_TIME_MODULE,
@@ -42,14 +44,21 @@ function getScriptURL(config) {
4244
* Attach script tag to DOM
4345
*
4446
* @param {Object} config
47+
* @param {Object} userConsent
4548
*
4649
* @return {void}
4750
*/
48-
export function attachScript(config) {
51+
export function attachScript(config, userConsent) {
4952
const script = getScriptURL(config);
5053
loadExternalScript(script, SUBREAL_TIME_MODULE, () => {
5154
if (typeof window.azerionPublisherAudiences === 'function') {
52-
window.azerionPublisherAudiences(config.params?.process || {});
55+
const publisherConfig = config.params?.process || {};
56+
window.azerionPublisherAudiences({
57+
...publisherConfig,
58+
gdprApplies: userConsent?.gdpr?.gdprApplies,
59+
gdprConsent: userConsent?.gdpr?.consentString,
60+
uspConsent: userConsent?.usp,
61+
});
5362
}
5463
});
5564
}
@@ -106,7 +115,7 @@ export function setAudiencesToBidders(reqBidsConfigObj, config, audiences) {
106115
* @return {boolean}
107116
*/
108117
function init(config, userConsent) {
109-
attachScript(config);
118+
attachScript(config, userConsent);
110119
return true;
111120
}
112121

@@ -138,6 +147,7 @@ export const azerionedgeSubmodule = {
138147
name: SUBREAL_TIME_MODULE,
139148
init: init,
140149
getBidRequestData: getBidRequestData,
150+
gvlid: IMPROVEDIGITAL_GVLID,
141151
};
142152

143153
submodule(REAL_TIME_MODULE, azerionedgeSubmodule);

modules/azerionedgeRtdProvider.md

-17
Original file line numberDiff line numberDiff line change
@@ -79,23 +79,6 @@ provided to the module when the user gives the relevant permissions on the publi
7979
As Prebid.js utilizes TCF vendor consent for the RTD module to load, the module needs to be labeled
8080
within the Vendor Exceptions.
8181
82-
### Instructions
83-
84-
If the Prebid GDPR enforcement is enabled, the module should be labeled
85-
as exception, as shown below:
86-
87-
```js
88-
[
89-
{
90-
purpose: 'storage',
91-
enforcePurpose: true,
92-
enforceVendor: true,
93-
vendorExceptions: ["azerionedge"]
94-
},
95-
...
96-
]
97-
```
98-
9982
## Testing
10083
10184
To view an example:

test/spec/modules/azerionedgeRtdProvider_spec.js

+36-21
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,17 @@ describe('Azerion Edge RTD submodule', function () {
88
{ id: '1', visits: 123 },
99
{ id: '2', visits: 456 },
1010
];
11-
11+
const IMPROVEDIGITAL_GVLID = '253';
1212
const key = 'publisher123';
1313
const bidders = ['appnexus', 'improvedigital'];
1414
const process = { key: 'value' };
1515
const dataProvider = { name: 'azerionedge', waitForIt: true };
16+
const userConsent = {gdpr: {gdprApplies: 'gdpr-applies', consentString: 'consent-string'}, usp: 'usp'};
17+
18+
const resetAll = () => {
19+
window.azerionPublisherAudiences.resetHistory();
20+
loadExternalScript.resetHistory();
21+
}
1622

1723
let reqBidsConfigObj;
1824
let storageStub;
@@ -33,7 +39,11 @@ describe('Azerion Edge RTD submodule', function () {
3339
let returned;
3440

3541
beforeEach(function () {
36-
returned = azerionedgeRTD.azerionedgeSubmodule.init(dataProvider);
42+
returned = azerionedgeRTD.azerionedgeSubmodule.init(dataProvider, userConsent);
43+
});
44+
45+
it('should have the correct gvlid', () => {
46+
expect(azerionedgeRTD.azerionedgeSubmodule.gvlid).to.equal(IMPROVEDIGITAL_GVLID);
3747
});
3848

3949
it('should return true', function () {
@@ -49,18 +59,21 @@ describe('Azerion Edge RTD submodule', function () {
4959
expect(loadExternalScript.args[0][0]).to.deep.equal(expected);
5060
});
5161

52-
it('should call azerionPublisherAudiencesStub with empty configuration', function () {
53-
expect(window.azerionPublisherAudiences.args[0][0]).to.deep.equal({});
62+
[
63+
['gdprApplies', userConsent.gdpr.gdprApplies],
64+
['gdprConsent', userConsent.gdpr.consentString],
65+
['uspConsent', userConsent.usp],
66+
].forEach(([key, value]) => {
67+
it(`should call azerionPublisherAudiencesStub with ${key}:${value}`, function () {
68+
expect(window.azerionPublisherAudiences.args[0][0]).to.include({[key]: value});
69+
});
5470
});
5571

5672
describe('with key', function () {
5773
beforeEach(function () {
58-
window.azerionPublisherAudiences.resetHistory();
59-
loadExternalScript.resetHistory();
60-
returned = azerionedgeRTD.azerionedgeSubmodule.init({
61-
...dataProvider,
62-
params: { key },
63-
});
74+
resetAll();
75+
const config = { ...dataProvider, params: { key } };
76+
returned = azerionedgeRTD.azerionedgeSubmodule.init(config, userConsent);
6477
});
6578

6679
it('should return true', function () {
@@ -75,22 +88,24 @@ describe('Azerion Edge RTD submodule', function () {
7588

7689
describe('with process configuration', function () {
7790
beforeEach(function () {
78-
window.azerionPublisherAudiences.resetHistory();
79-
loadExternalScript.resetHistory();
80-
returned = azerionedgeRTD.azerionedgeSubmodule.init({
81-
...dataProvider,
82-
params: { process },
83-
});
91+
resetAll();
92+
const config = { ...dataProvider, params: { process } };
93+
returned = azerionedgeRTD.azerionedgeSubmodule.init(config, userConsent);
8494
});
8595

8696
it('should return true', function () {
8797
expect(returned).to.equal(true);
8898
});
8999

90-
it('should call azerionPublisherAudiencesStub with process configuration', function () {
91-
expect(window.azerionPublisherAudiences.args[0][0]).to.deep.equal(
92-
process
93-
);
100+
[
101+
['gdprApplies', userConsent.gdpr.gdprApplies],
102+
['gdprConsent', userConsent.gdpr.consentString],
103+
['uspConsent', userConsent.usp],
104+
...Object.entries(process),
105+
].forEach(([key, value]) => {
106+
it(`should call azerionPublisherAudiencesStub with ${key}:${value}`, function () {
107+
expect(window.azerionPublisherAudiences.args[0][0]).to.include({[key]: value});
108+
});
94109
});
95110
});
96111
});
@@ -111,7 +126,7 @@ describe('Azerion Edge RTD submodule', function () {
111126
);
112127
});
113128

114-
it('does not run apply audiences to bidders', function () {
129+
it('does not apply audiences to bidders', function () {
115130
expect(reqBidsConfigObj.ortb2Fragments.bidder).to.deep.equal({});
116131
});
117132

0 commit comments

Comments
 (0)