Skip to content

docs: Add Matomo analytics and privacy message #5173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

cwhite911
Copy link
Contributor

I've added Matomo analytics to the MKDocs documentation.

https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-analytics/

Matomo was not supported by default, so I created it a custom analytics provider. The site will pop up an Analytics Consent form when a user first visits.

Analytics Consent Form

image

They can chose to either Accept or Manage settings. If they Accept the form will disappear setting a cookie to {analytics: true, github: true}. These cookies job is just to remember the visitors preference, on browsers that don't allow cookies the user will be prompted every time This is default behavior of material mkdocs.

Manage Settings View

image

If the user opts out of Matomo no site usage data is sent to Matomo. If they opt-in the following settings are enabled.

 _paq.push(['disableCookies']);
 _paq.push(['enableLinkTracking']);
 _paq.push(['trackPageView']);
 _paq.push(['enableHeartBeatTimer', 10]); // Page needs to be open for 10 seconds before tracking
_paq.push(['setDocumentTitle', document.title]);

The GitHub cookie controls whether the site will make requests to GitHubs API to load repo statistics.

image

If the user declines the stats will not show.

image

If they accept and then decline later the stats will continue to show until the session cache is cleared with the last received data from GitHub.

The analytics consent form text is borrowed from the main https://grass.osgeo.org site and links back to our full privacy policy and other relevant resources.

In compliance with GDPR rules the user has the ability to modify their selections at any time by clicking the newly added Privacy Settings link in the footer.

image

This link will reopen the Analytics Consent form for users to update their settings.

References

Material Mkdocs

Matomo

@github-actions github-actions bot added HTML Related code is in HTML CSS Related code is in CSS JavaScript Related code is in JavaScript docs labels Feb 21, 2025
@cwhite911 cwhite911 requested a review from neteler February 21, 2025 19:38
@cwhite911 cwhite911 self-assigned this Feb 21, 2025
@cwhite911
Copy link
Contributor Author

@neteler are you able to configure things in Matomo or is that OSGeo?

@neteler
Copy link
Member

neteler commented Feb 21, 2025

We use the GFOSS operated Matomo instance. This is managed by @lucadelu.

@neteler
Copy link
Member

neteler commented Feb 24, 2025

FWIW, I have "user access" there: Is there anything I shall configure?

@cwhite911
Copy link
Contributor Author

I've tested it locally on my own instance of Matomo and everything works. So, once we deploy the new site live you just need to confirm that the traffic from the docs is getting sent to the Matomo server. If everything is working the current setup will blend the docs and the rest of the grass.osgeo.org subdomain analytics together.

@cwhite911 cwhite911 moved this from In Progress to Done in GRASS Markdown Documentation Feb 27, 2025
@wenzeslaus wenzeslaus moved this from Done to In Progress in GRASS Markdown Documentation Mar 3, 2025
@cwhite911 cwhite911 moved this from In Progress to Done in GRASS Markdown Documentation Mar 5, 2025
@cwhite911 cwhite911 added this to the 8.5.0 milestone Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS Related code is in CSS docs HTML Related code is in HTML JavaScript Related code is in JavaScript
Projects
Development

Successfully merging this pull request may close these issues.

2 participants