Skip to content

Commit ccee2a3

Browse files
authored
Merge pull request #82 from empreinte-digitale/feature-exemption
Handling consent exemption
2 parents 9c8407a + 1c8378c commit ccee2a3

3 files changed

Lines changed: 27 additions & 2 deletions

File tree

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,14 @@ var orejimeConfig = {
231231

232232
// Optional. If "required" is set to true, Orejime will not allow this app to
233233
// be disabled by the user.
234+
// See "Special cases" below for more information.
234235
// default to false
235236
required: false,
236237

237-
// Optional. If "optOut" is set to true, Orejime will load this app even before
238-
// the user gave explicit consent.We recommend always leaving this "false".
238+
// Optional. If "optOut" is set to true, Orejime will load this app
239+
// even before the user gave explicit consent.
240+
// We recommend always leaving this "false".
241+
// See "Special cases" below for more information.
239242
// defaults to false
240243
optOut: false,
241244

@@ -291,6 +294,17 @@ var orejimeConfig = {
291294

292295
</details>
293296

297+
#### Special cases
298+
299+
##### Exemption
300+
301+
If every app is either `required` or `optOut`, Orejime will not show at startup
302+
(but it will still be possible to open it programmatically).
303+
However, you should consider this use case carefully, and ensure that :
304+
* `required` trackers are truly required for your app to function properly
305+
* `optOut` trackers are exempt from consent, (i.e.
306+
[as defined by the CNIL](https://www.cnil.fr/fr/cookies-solutions-pour-les-outils-de-mesure-daudience))
307+
294308
### Initialization
295309

296310
Now that you included the JS, the CSS, configured existing third-party scripts and defined your configuration, you can initialize an instance. This can be done automatically or manually.

src/components/main.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ export default class Main extends React.Component {
3434
if (manager.confirmed && !manager.changed) {
3535
return false;
3636
}
37+
if (manager.canBypassConsent()) {
38+
return false;
39+
}
3740
return true;
3841
}
3942

src/consent-manager.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ export default class ConsentManager {
5555
return consents;
5656
}
5757

58+
// If every app is either required or optOut, or both,
59+
// there is no need to ask for user consent.
60+
canBypassConsent() {
61+
return this.config.apps.every(
62+
({optOut = false, required = false}) => optOut || required
63+
);
64+
}
65+
5866
declineAll() {
5967
this.config.apps.map((app) => {
6068
this.updateConsent(app, false);

0 commit comments

Comments
 (0)