You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+65-24Lines changed: 65 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -255,38 +255,58 @@ var orejimeConfig = {
255
255
256
256
### Third-party scripts configuration
257
257
258
-
For each third-party script you want Orejime to manage, you must modify its `<script>` tag so that the browser doesn't load it anymore. Orejime will take care of loading it when the user consents to it.
258
+
Scripts that require user consent must not be executed when the page load.
259
+
Orejime will take care of loading them when the user has consented.
259
260
260
-
On inline scripts:
261
-
* set the `type` attribute to `orejime` to keep the browser from executing the script
262
-
* add a `data-purpose` containing the id of a purpose you configured previously
261
+
Those scripts must be tagged with their related purpose from the configuration. This is done by wrapping them with a template tag and a `data-purpose` attribute:
A major overhaul of the configuration took place in this version, as to clarify naming and align more with the GDPR vocabulary.
401
421
422
+
#### Configuration
423
+
402
424
If you were already using version 2, a tool to migrate your current configuration is available here : https://orejime.boscop.fr/#migration.
403
425
426
+
#### Third-party scripts
427
+
428
+
Previous versions of Orejime required you to alter third party script tags.
429
+
This behavior has changed, and you should now leave scripts untouched and wrap them in a template, as documented in [scripts configuration](#third-party-scripts-configuration) ([learn why](./adr/003-purpose-templates.md)).
430
+
431
+
As you can see from the following example, this is simpler and less intrusive:
The current way of setting up third-party scripts is kind of confusing and requires shaky machanics to enable or disable them.
11
+
There might be a leaner way to handle this.
12
+
13
+
## Considerations
14
+
15
+
* Having to modify script attributes is tedious, and can be complicated within some environments.
16
+
* We're relying on hacky mechanics, namely the `type="orejime"` attribute. This makes the implementation in user land hard to explain.
17
+
* The current implementation relies on data attributes to "backup" actual attributes when disabling a script, and tag removal and reinsertion when enabling it. This leads to all sort of edge cases that are hard to pinpoint.
18
+
* The implementation varies depending on the HTML element that must be toggled (scripts are a special case).
19
+
20
+
## Decision
21
+
22
+
Instead of modifying elements, we'll wrap them inside `template` tags.
23
+
This way :
24
+
* The original script or element is left untouched.
25
+
* This is a native and straighforward functionality.
26
+
* One tag and attribute makes for less syntactic bloat than the previous prefix system.
27
+
* With the same amount of code, a single purpose can act on one or many HTML elements.
0 commit comments