mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Add documentation for new analytics integration
This commit is contained in:
parent
dad1ac39d5
commit
deaf7aebc2
@ -152,7 +152,7 @@ directory:
|
|||||||
MkDocs will now use the new partial when rendering the theme. This can be done
|
MkDocs will now use the new partial when rendering the theme. This can be done
|
||||||
with any file.
|
with any file.
|
||||||
|
|
||||||
### Overriding blocks <small>recommended</small> { data-toc-label="Overiding blocks" }
|
### Overriding blocks <small>recommended</small> { data-toc-label="Overriding blocks" }
|
||||||
|
|
||||||
Besides overriding partials, it's also possible to override (and extend)
|
Besides overriding partials, it's also possible to override (and extend)
|
||||||
_template blocks_, which are defined inside the templates and wrap specific
|
_template blocks_, which are defined inside the templates and wrap specific
|
||||||
|
@ -18,18 +18,29 @@ analytics providers][2] can be used, too.
|
|||||||
|
|
||||||
[:octicons-file-code-24: Source][3] · :octicons-milestone-24: Default: _none_
|
[:octicons-file-code-24: Source][3] · :octicons-milestone-24: Default: _none_
|
||||||
|
|
||||||
After heading over to your [Google Analytics][1] account to [create a new
|
Material for MkDocs integrates with both, Google Analytics 4 and the now phasing
|
||||||
property][4] in order to obtain a unique tracking id of the form
|
out Universal Analytics (`UA-*`). Depending on the prefix of the property, add
|
||||||
`UA-XXXXXXXX-X`, add it to `mkdocs.yml`:
|
the following to `mkdocs.yml`:
|
||||||
|
|
||||||
``` yaml
|
=== "Google Analytics 4"
|
||||||
google_analytics:
|
|
||||||
- UA-XXXXXXXX-X
|
``` yaml
|
||||||
- auto
|
extra:
|
||||||
```
|
analytics:
|
||||||
|
provider: google
|
||||||
|
property: G-XXXXXXXXXX
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "Universal Analytics"
|
||||||
|
|
||||||
|
``` yaml
|
||||||
|
extra:
|
||||||
|
analytics:
|
||||||
|
provider: google
|
||||||
|
property: UA-XXXXXXXX-X
|
||||||
|
```
|
||||||
|
|
||||||
[3]: https://github.com/squidfunk/mkdocs-material/blob/master/src/partials/integrations/analytics.html
|
[3]: https://github.com/squidfunk/mkdocs-material/blob/master/src/partials/integrations/analytics.html
|
||||||
[4]: https://support.google.com/analytics/answer/1042508
|
|
||||||
|
|
||||||
#### Site search tracking
|
#### Site search tracking
|
||||||
|
|
||||||
@ -43,6 +54,12 @@ search tracking:
|
|||||||
4. Scroll down and enable __site search settings__
|
4. Scroll down and enable __site search settings__
|
||||||
5. Set the __query parameter__ to `q`.
|
5. Set the __query parameter__ to `q`.
|
||||||
|
|
||||||
|
_Site search tracking is not supported with Google Analytics 4 due to the much
|
||||||
|
more complicated manual setup. If you want to set up site search tracking
|
||||||
|
yourself, [this tutorial][4] might be a good start._
|
||||||
|
|
||||||
|
[4]: https://www.analyticsmania.com/post/track-site-search-with-google-tag-manager-and-google-analytics/
|
||||||
|
|
||||||
## Customization
|
## Customization
|
||||||
|
|
||||||
### Other analytics providers
|
### Other analytics providers
|
||||||
|
Loading…
Reference in New Issue
Block a user