Skip to content

Commit b72adf3

Browse files
squidfunkalexvoss
andcommitted
Updated documentation for custom cookies
Co-authored-by: alexvoss <[email protected]>
1 parent ea9446e commit b72adf3

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

docs/setup/ensuring-data-privacy.md

+13-2
Original file line numberDiff line numberDiff line change
@@ -547,15 +547,25 @@ const url ="https://polyfill.io/v3/polyfill.min.js"
547547
### Custom cookies
548548

549549
If you've customized the [cookie consent] and added a `custom` cookie, the user
550-
will be prompted to accept your custom cookie. Use [additional JavaScript] to
551-
check whether the user accepted it:
550+
will be prompted to accept or reject your custom cookie. Once the user accepts
551+
or rejects the cookie consent, or [changes the settings], the page reloads[^1].
552+
Use [additional JavaScript] to query the result:
553+
554+
[^1]:
555+
We reload the page to make interop with custom cookies simpler. If Material
556+
for MkDocs would implement a callback-based approach, the author would need
557+
to make sure to correctly update all scripts that use cookies. Additionally,
558+
the cookie consent is only answered initially, which is why we consider this
559+
to be a good trade-off of DX and UX.
552560

553561
=== ":octicons-file-code-16: `docs/javascripts/consent.js`"
554562

555563
``` js
556564
var consent = __md_get("__consent")
557565
if (consent && consent.custom) {
558566
/* The user accepted the cookie */
567+
} else {
568+
/* The user rejected the cookie */
559569
}
560570
```
561571

@@ -567,3 +577,4 @@ check whether the user accepted it:
567577
```
568578

569579
[additional JavaScript]: ../customization.md#additional-javascript
580+
[changes the settings]: #change-cookie-settings

0 commit comments

Comments
 (0)