@@ -7,12 +7,11 @@ template: overrides/main.html
7
7
As with any other service offered on the web, understanding how your project
8
8
documentation is actually used can be an essential success factor. Material for
9
9
MkDocs natively integrates with [ Google Analytics] and offers a customizable
10
- [ cookie consent] [ extra.consent ] and a [ feedback widget]
11
- [ extra.analytics.feedback] .
10
+ [ cookie consent] and a [ feedback widget] .
12
11
13
12
[ Google Analytics ] : https://developers.google.com/analytics
14
- [ extra. consent] : #cookie-consent
15
- [ extra.analytics. feedback] : #was-this-page-helpful
13
+ [ cookie consent] : ensuring-data-privacy.md #cookie-consent
14
+ [ feedback widget ] : #was-this-page-helpful
16
15
17
16
## Configuration
18
17
98
97
using our <a href="..." target=_blank>feedback form</a>.
99
98
` ` `
100
99
101
- 1. This feature is natively integrated with [Google Analytics][extra. analytics],
100
+ 1. This feature is natively integrated with [Google Analytics][analytics],
102
101
which is why ` provider` and `property` are also required. However, it's also
103
102
possible to provide a [custom feedback integration].
104
103
@@ -108,7 +107,7 @@ extra:
108
107
Both properties, `title` and `ratings`, are required. Note that it's allowed to
109
108
define more than two ratings, e.g. to implement a 1-5 star rating. Since the
110
109
feedback widget sends data to a third-party service, it is, of course, natively
111
- integrated with the [cookie consent][extra.consent] feature[^1].
110
+ integrated with the [cookie consent] feature[^1].
112
111
113
112
[^1] :
114
113
If the user doesn't accept the `analytics` cookie, the feedback widget is
@@ -211,100 +210,20 @@ The following properties must be set for each rating:
211
210
212
211
An alternative to GitHub issues is [Google Forms].
213
212
213
+ [Insiders] : ../insiders/index.md
214
214
[feedback widget] : # feedback
215
- [extra. analytics] : # google-analytics
215
+ [analytics] : # google-analytics
216
216
[feedback report] : ../assets/screenshots/feedback-report.png
217
217
[custom feedback integration] : # custom-site-feedback
218
218
[custom icons] : https://github.com/squidfunk/mkdocs-material/tree/master/material/.icons
219
219
[Google Forms] : https://www.google.com/forms/about/
220
220
221
- # ## Cookie consent
222
-
223
- [:octicons-heart-fill-24:{ .mdx-heart } Insiders][Insiders]{ .mdx-insiders } ·
224
- [:octicons-tag-24 : insiders-2.10.0][Insiders] ·
225
- :octicons-milestone-24 : Default: _none_
226
-
227
- Material for MkDocs ships a native and extensible cookie consent form which
228
- asks the user for his consent prior to sending any data via analytics. Add the
229
- following to `mkdocs.yml` :
230
-
231
- ` ` ` yaml
232
- extra:
233
- consent:
234
- title: Cookie consent
235
- description: >- # (1)!
236
- We use cookies to recognize your repeated visits and preferences, as well
237
- as to measure the effectiveness of our documentation and whether users
238
- find what they're searching for. With your consent, you're helping us to
239
- make our documentation better.
240
- ` ` `
241
-
242
- 1. You can add arbitrary HTML tags in the `description`, e.g. to link to your
243
- terms of service or other parts of the site.
244
-
245
- Note that both, `title` and `description`, are required. If Google Analytics
246
- was configured via `mkdocs.yml`, the cookie consent will automatically include
247
- a setting for the user to disable it. Furthermore, [custom cookies] can be
248
- integrated by using the `cookies` field :
249
-
250
- === "Custom cookie name"
251
-
252
- ` ` ` yaml
253
- extra:
254
- consent:
255
- cookies:
256
- analytics: Custom name # (1)!
257
- ` ` `
258
-
259
- 1. The default name of the `analytics` cookie is `Google Analytics`.
260
-
261
- === "Custom initial state"
262
-
263
- ` ` ` yaml
264
- extra:
265
- consent:
266
- cookies:
267
- analytics:
268
- name: Google Analytics
269
- checked: false
270
- ` ` `
271
-
272
- === "Custom cookie"
273
-
274
- ` ` ` yaml
275
- extra:
276
- consent:
277
- cookies:
278
- analytics: Google Analytics # (1)!
279
- custom: Custom cookie
280
- ` ` `
281
-
282
- 1. If you add a custom cookie to the `cookies` field, the `analytics`
283
- cookie must be added back explicitly, or analytics won't be triggered.
284
-
285
- When a user first visits your site, a cookie consent form is rendered :
286
-
287
- [![extra.consent enabled]][extra.consent enabled]
288
-
289
- In order to comply with GDPR, users must be able to change their cookie settings
290
- at any time. This can be done by creating a simple link as part of any document,
291
- e.g. your privacy policy :
292
-
293
- ` ` ` markdown
294
- [Change cookie settings](#__consent){ .md-button }
295
- ` ` `
296
-
297
- [Insiders] : ../insiders/index.md
298
- [custom cookies] : # custom-cookies
299
- [extra.consent enabled] : ../assets/screenshots/consent.png
300
-
301
221
# # Usage
302
222
303
223
# ## Hiding the feedback widget
304
224
305
- When [Metadata] is enabled, the [feedback widget][extra.analytics.feedback] can
306
- be hidden for a document with custom front matter. Add the following lines at
307
- the top of a Markdown file :
225
+ When [Metadata] is enabled, the [feedback widget] can be hidden for a document
226
+ with custom front matter. Add the following lines at the top of a Markdown file :
308
227
309
228
` ` ` bash
310
229
---
@@ -318,7 +237,6 @@ hide:
318
237
319
238
[Metadata] : extensions/python-markdown.md#metadata
320
239
321
-
322
240
# # Customization
323
241
324
242
# ## Custom site analytics
@@ -395,29 +313,5 @@ generated by users interacting with the feedback widget with the help of some
395
313
- javascripts/feedback.js
396
314
` ` `
397
315
398
- # ## Custom cookies
399
-
400
- If you've customized the [cookie consent][extra.consent] and added a `custom`
401
- cookie, the user will be prompted to accept your custom cookie. Use [additional
402
- JavaScript] to check whether the user accepted it :
403
-
404
- === ":octicons-file-code-16 : docs/javascripts/consent.js"
405
-
406
- ` ` ` js
407
- var consent = __md_get("__consent")
408
- if (consent && consent.custom) {
409
- /* The user accepted the cookie */
410
- }
411
- ` ` `
412
-
413
- === ":octicons-file-code-16 : mkdocs.yml"
414
-
415
- ` ` ` yaml
416
- extra_javascript:
417
- - javascripts/consent.js
418
- ` ` `
419
-
420
316
421
317
{ # feedback style="margin: 0; height: 0" }
422
-
423
- [additional JavaScript] : ../customization.md#additional-javascript
0 commit comments