@@ -18,18 +18,29 @@ analytics providers][2] can be used, too.
18
18
19
19
[ :octicons-file-code-24: Source] [ 3 ] · :octicons-milestone-24: Default: _ none_
20
20
21
- After heading over to your [ Google Analytics] [ 1 ] account to [ create a new
22
- property] [ 4 ] in order to obtain a unique tracking id of the form
23
- ` UA-XXXXXXXX-X ` , add it to ` mkdocs.yml ` :
24
-
25
- ``` yaml
26
- google_analytics :
27
- - UA-XXXXXXXX-X
28
- - auto
29
- ` ` `
21
+ Material for MkDocs integrates with both, Google Analytics 4 and the now phasing
22
+ out Universal Analytics (` UA-* ` ). Depending on the prefix of the property, add
23
+ the following to ` mkdocs.yml ` :
24
+
25
+ === "Google Analytics 4"
26
+
27
+ ``` yaml
28
+ extra:
29
+ analytics:
30
+ provider: google
31
+ property: G-XXXXXXXXXX
32
+ ```
33
+
34
+ === "Universal Analytics"
35
+
36
+ ``` yaml
37
+ extra:
38
+ analytics:
39
+ provider: google
40
+ property: UA-XXXXXXXX-X
41
+ ```
30
42
31
43
[ 3 ] : https://github.com/squidfunk/mkdocs-material/blob/master/src/partials/integrations/analytics.html
32
- [4]: https://support.google.com/analytics/answer/1042508
33
44
34
45
#### Site search tracking
35
46
@@ -43,6 +54,12 @@ search tracking:
43
54
4 . Scroll down and enable __ site search settings__
44
55
5 . Set the __ query parameter__ to ` q ` .
45
56
57
+ _ Site search tracking is not supported with Google Analytics 4 due to the much
58
+ more complicated manual setup. If you want to set up site search tracking
59
+ yourself, [ this tutorial] [ 4 ] might be a good start._
60
+
61
+ [ 4 ] : https://www.analyticsmania.com/post/track-site-search-with-google-tag-manager-and-google-analytics/
62
+
46
63
## Customization
47
64
48
65
### Other analytics providers
0 commit comments