diff --git a/man/Makefile b/man/Makefile
index e63aad7e64f..3d24bac210f 100644
--- a/man/Makefile
+++ b/man/Makefile
@@ -20,7 +20,9 @@ DSTFILES := \
$(MDDIR)/source/grassdocs.css \
$(MDDIR)/scripts/hook_list_scripts.py \
$(MDDIR)/overrides/partials/footer.html \
- $(MDDIR)/overrides/partials/actions.html
+ $(MDDIR)/overrides/partials/actions.html \
+ $(MDDIR)/overrides/partials/integrations/analytics/matomo.html \
+ $(MDDIR)/overrides/javascripts/consent.js
categories = \
d:display \
@@ -273,6 +275,18 @@ $(MDDIR)/overrides/partials/actions.html: mkdocs/overrides/partials/actions.html
$(MDDIR)/overrides/partials:
$(MKDIR) $@
+$(MDDIR)/overrides/partials/integrations/analytics/matomo.html: mkdocs/overrides/partials/integrations/analytics/matomo.html | $(MDDIR)/overrides/partials/integrations/analytics
+ $(INSTALL_DATA) $< $@
+
+$(MDDIR)/overrides/partials/integrations/analytics:
+ $(MKDIR) $@
+
+$(MDDIR)/overrides/javascripts/consent.js: mkdocs/overrides/javascripts/consent.js | $(MDDIR)/overrides/javascripts
+ $(INSTALL_DATA) $< $@
+
+$(MDDIR)/overrides/javascripts:
+ $(MKDIR) $@
+
build-mkdocs:
@cd $(MDDIR) ; SITE_NAME="GRASS GIS $(GRASS_VERSION_NUMBER) Reference Manual" \
COPYRIGHT="© 2003-$(GRASS_VERSION_DATE) GRASS Development Team, GRASS GIS $(GRASS_VERSION_NUMBER) Reference Manual" \
diff --git a/man/mkdocs/grassdocs.css b/man/mkdocs/grassdocs.css
index 852b63d2ff9..6515981ae34 100644
--- a/man/mkdocs/grassdocs.css
+++ b/man/mkdocs/grassdocs.css
@@ -10,6 +10,10 @@
--gs-white-color--lighter: rgba(255, 255, 255, 0.322);
--gs-white-color--lightest: rgba(255, 255, 255, 0.071);
--gs-black-color: rgb(0, 0, 0); /* Black */
+ --gs-gray-color: rgb(135, 135, 135); /* Gray */
+ --gs-gray-color--light: rgba(135, 135, 135, 0.541);
+ --gs-gray-color--lighter: rgba(135, 135, 135, 0.322);
+ --gs-gray-color--lightest: rgba(135, 135, 135, 0.071);
--gs-primary-color: rgb(76, 176, 91); /* Dark green */
--gs-primary-color--light: rgba(76, 176, 91, 0.541);
@@ -170,3 +174,16 @@
.md-typeset table:not([class]) tbody tr:hover {
background-color: transparent;
}
+
+/* Analytics consent styling */
+#__consent > aside > form > p {
+ font-size: 0.7rem;
+}
+
+/* Sets the checkbox colors for analytics consent */
+.md-typeset [type=checkbox]:checked+.task-list-indicator:before {
+ background-color: var(--gs-secondary-color);
+}
+.md-typeset .task-list-indicator:before {
+ background-color: var(--gs-gray-color--lighter);
+}
diff --git a/man/mkdocs/mkdocs.yml b/man/mkdocs/mkdocs.yml
index e9c89c23628..2d6d45f08c1 100644
--- a/man/mkdocs/mkdocs.yml
+++ b/man/mkdocs/mkdocs.yml
@@ -44,6 +44,39 @@ theme:
# Customization
extra:
homepage: ./index.html
+ analytics:
+ provider: matomo
+ url: https://2022.foss4g.org/matomo/
+ site_id: '2'
+ consent:
+ actions:
+ - accept
+ - manage
+
+ cookies:
+ analytics:
+ name: Matomo
+ checked: true
+ github:
+ name: GitHub
+ checked: true
+
+ title: Analytics Consent
+ description: >-
+ Matomo
+ This website uses the open source web analytics service
+ Matomo.
+ Matomo uses technologies that enable the recognition of
+ the user across pages for the analysis of user behaviour.
+ In our case no cookies are collected. The information collected by
+ Matomo about the use of this website is stored on our server.
+ GitHub
+ This website uses the GitHub API to fetch
+ OSGeo/grass
+ and OSGeo/grass-addons statistics.
+
+ For more information, please read our
+ privacy policy.
# Hooks
hooks:
@@ -53,6 +86,10 @@ hooks:
extra_css:
- grassdocs.css
+# Custom JavaScript
+extra_javascript:
+ - javascripts/consent.js
+
# Plugins
plugins:
- search
diff --git a/man/mkdocs/overrides/javascripts/consent.js b/man/mkdocs/overrides/javascripts/consent.js
new file mode 100644
index 00000000000..a212df17316
--- /dev/null
+++ b/man/mkdocs/overrides/javascripts/consent.js
@@ -0,0 +1,17 @@
+var consent = __md_get("__consent")
+console.debug(consent);
+if (consent && consent.analytics) {
+ /* The user accepted the cookie */
+ console.debug("User accepted Analytics");
+ _paq.push([ function() {
+ if (this.isUserOptedOut()) {
+ // ... change form to say user is currently opted out ...
+ console.debug("Switching form opt-out to opt-in");
+ _paq.push([ 'forgetUserOptOut' ]);
+ }
+ } ]);
+} else {
+ /* The user rejected the cookie */
+ _paq.push([ 'optUserOut' ]); // Matomo opt-out
+ console.debug("User rejected Analytics");
+}
diff --git a/man/mkdocs/overrides/partials/footer.html b/man/mkdocs/overrides/partials/footer.html
index a713e2e6db8..df411fd60b4 100644
--- a/man/mkdocs/overrides/partials/footer.html
+++ b/man/mkdocs/overrides/partials/footer.html
@@ -87,7 +87,7 @@