mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Added guide to set up site analytics
This commit is contained in:
parent
5336c98c50
commit
5d831bbdd1
@ -70,9 +70,9 @@ icons and much more:
|
|||||||
* [Changing the logo and icons][6]
|
* [Changing the logo and icons][6]
|
||||||
* [Setting up navigation][7]
|
* [Setting up navigation][7]
|
||||||
* [Setting up site search][8]
|
* [Setting up site search][8]
|
||||||
* [Adding a git repository][9]
|
* [Setting up site analytics][9]
|
||||||
* [Adding social links][10]
|
* [Adding a git repository][10]
|
||||||
* [Adding site analytics][11]
|
* [Adding social links][11]
|
||||||
* [Adding a comment system][12]
|
* [Adding a comment system][12]
|
||||||
* [Adding an announcement bar][13]
|
* [Adding an announcement bar][13]
|
||||||
<!-- * [Adding a landing page][14] -->
|
<!-- * [Adding a landing page][14] -->
|
||||||
@ -84,9 +84,9 @@ icons and much more:
|
|||||||
[6]: setup/changing-the-logo-and-icons.md
|
[6]: setup/changing-the-logo-and-icons.md
|
||||||
[7]: setup/setting-up-navigation.md
|
[7]: setup/setting-up-navigation.md
|
||||||
[8]: setup/setting-up-site-search.md
|
[8]: setup/setting-up-site-search.md
|
||||||
[9]: setup/adding-a-git-repository.md
|
[9]: setup/setting-up-site-analytics.md
|
||||||
[10]: setup/adding-social-links.md
|
[10]: setup/adding-a-git-repository.md
|
||||||
[11]: setup/adding-site-analytics.md
|
[11]: setup/adding-social-links.md
|
||||||
[12]: setup/adding-a-comment-system.md
|
[12]: setup/adding-a-comment-system.md
|
||||||
[13]: setup/adding-an-announcement-bar.md
|
[13]: setup/adding-an-announcement-bar.md
|
||||||
<!--[14]: setup/adding-a-landing-page.md-->
|
<!--[14]: setup/adding-a-landing-page.md-->
|
||||||
|
@ -13,6 +13,8 @@ configured through `mkdocs.yml`.
|
|||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
|
### Social links
|
||||||
|
|
||||||
[:octicons-file-code-24: Source][1] ·
|
[:octicons-file-code-24: Source][1] ·
|
||||||
:octicons-milestone-24: Default: _none_
|
:octicons-milestone-24: Default: _none_
|
||||||
|
|
||||||
@ -75,7 +77,7 @@ For each entry, the following fields are available:
|
|||||||
|
|
||||||
`name`
|
`name`
|
||||||
|
|
||||||
: :octicons-milestone-24: Default: _domain name from_ `link`, if available –
|
: :octicons-milestone-24: Default: _domain name from_ `link`_, if available_ –
|
||||||
This field is used as the link's `title` attribute and can be set to a
|
This field is used as the link's `title` attribute and can be set to a
|
||||||
discernable name to improve accessibility:
|
discernable name to improve accessibility:
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ theme:
|
|||||||
|
|
||||||
[4]: https://github.com/squidfunk/mkdocs-material/blob/master/src/base.html#L71
|
[4]: https://github.com/squidfunk/mkdocs-material/blob/master/src/base.html#L71
|
||||||
|
|
||||||
### Emoji (icons)
|
### Icons
|
||||||
|
|
||||||
[:octicons-file-code-24: Source][5] · [:octicons-workflow-24: Extension][6]
|
[:octicons-file-code-24: Source][5] · [:octicons-workflow-24: Extension][6]
|
||||||
|
|
||||||
|
75
docs/setup/setting-up-site-analytics.md
Normal file
75
docs/setup/setting-up-site-analytics.md
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
---
|
||||||
|
template: overrides/main.html
|
||||||
|
---
|
||||||
|
|
||||||
|
# Setting up site analytics
|
||||||
|
|
||||||
|
As with any other service that is offered on the web, understanding how your
|
||||||
|
documentation is actually used can be an essential success factor. While
|
||||||
|
Material for MkDocs natively integrates with [Google Analytics][1], other
|
||||||
|
analytics services can be used, too.
|
||||||
|
|
||||||
|
[1]: https://developers.google.com/analytics
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
### Site analytics
|
||||||
|
|
||||||
|
[:octicons-file-code-24: Source][2] · :octicons-milestone-24: Default: _none_
|
||||||
|
|
||||||
|
After heading over to your [Google Analytics][1] account to [create a new
|
||||||
|
property][3] in order to obtain a new tracking id of the form `UA-XXXXXXXX-X`,
|
||||||
|
add it to `mkdocs.yml`:
|
||||||
|
|
||||||
|
``` yaml
|
||||||
|
google_analytics:
|
||||||
|
- UA-XXXXXXXX-X
|
||||||
|
- auto
|
||||||
|
```
|
||||||
|
|
||||||
|
Publish and refresh your site, and you should see events bubbling up.
|
||||||
|
|
||||||
|
[2]: https://github.com/squidfunk/mkdocs-material/blob/master/src/partials/integrations/analytics.html
|
||||||
|
[3]: https://support.google.com/analytics/answer/1042508
|
||||||
|
|
||||||
|
### Site search analytics
|
||||||
|
|
||||||
|
Besides basic page views, _site search_ can also be tracked to better understand
|
||||||
|
how people use your documentation and what they expect to find. To enable
|
||||||
|
search tracking:
|
||||||
|
|
||||||
|
1. Go to your Google Analytics __admin settings__
|
||||||
|
2. Select the property for the respective tracking code
|
||||||
|
3. Go to the __view settings__ tab.
|
||||||
|
4. Scroll down and enable __site search settings__
|
||||||
|
5. Set the __query parameter__ to `q`.
|
||||||
|
|
||||||
|
## Customization
|
||||||
|
|
||||||
|
### Other analytics services
|
||||||
|
|
||||||
|
[:octicons-file-code-24: Source][2] ·
|
||||||
|
:octicons-mortar-board-24: Difficulty: _easy_
|
||||||
|
|
||||||
|
In order to integrate another analytics service provider offering an
|
||||||
|
asynchronous JavaScript-based tracking solution, you can [extend the theme][4]
|
||||||
|
and [override the `analytics` block][5].
|
||||||
|
|
||||||
|
[4]: ../customization.md#extending-the-theme
|
||||||
|
[5]: ../customization.md#overriding-blocks
|
||||||
|
|
||||||
|
### Instant loading
|
||||||
|
|
||||||
|
[:octicons-file-code-24: Source][2] ·
|
||||||
|
:octicons-mortar-board-24: Difficulty: _easy_
|
||||||
|
|
||||||
|
If you're using [instant loading][6], you can use the `DOMContentSwitch` event
|
||||||
|
to listen for navigation events and register a page view event with:
|
||||||
|
|
||||||
|
``` js
|
||||||
|
document.addEventListener("DOMContentSwitch", function() {
|
||||||
|
/* Register page event here */
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
[6]: setting-up-navigation.md#instant-loading
|
@ -138,9 +138,9 @@ nav:
|
|||||||
- Changing the logo and icons: setup/changing-the-logo-and-icons.md
|
- Changing the logo and icons: setup/changing-the-logo-and-icons.md
|
||||||
- Setting up navigation: setup/setting-up-navigation.md
|
- Setting up navigation: setup/setting-up-navigation.md
|
||||||
- Setting up site search: setup/setting-up-site-search.md
|
- Setting up site search: setup/setting-up-site-search.md
|
||||||
|
- Setting up site analytics: setup/setting-up-site-analytics.md
|
||||||
- Adding a git repository: setup/adding-a-git-repository.md
|
- Adding a git repository: setup/adding-a-git-repository.md
|
||||||
- Adding social links: setup/adding-social-links.md
|
- Adding social links: setup/adding-social-links.md
|
||||||
- Adding site analytics: setup/adding-site-analytics.md
|
|
||||||
- Adding a comment system: setup/adding-a-comment-system.md
|
- Adding a comment system: setup/adding-a-comment-system.md
|
||||||
- Adding an announcement bar: setup/adding-an-announcement-bar.md
|
- Adding an announcement bar: setup/adding-an-announcement-bar.md
|
||||||
#- Adding a landing page: setup/adding-a-landing-page.md
|
#- Adding a landing page: setup/adding-a-landing-page.md
|
||||||
|
Loading…
Reference in New Issue
Block a user