You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Both built-in themes support a very easy Google Analytics implementation by providing two variables in your mkdocs.yml and this is really convenient and a great thing.
However, as Google Analytics does have its problems conforming to the new GDPR, and Matomo being a successful competitor in Europe, I would like to kindly request to add a matomo block to the base themes?
As you note, this is already possible via overriding template blocks. Personally, I would be happy to leave that as the only way. However, I can also see the usability benefits of only needed to set a few config values. If this was to happen, then the existing solution should be ripped out and converted to a plugin with the relevant settings as config settings on the plugin itself. Then any other analytics services could have their own (third party) plugins as well with no need for any changes to MkDocs.
However, the existing Google Analytics was in place long before I joined the project and remains for backward compatibility reasons. Therefore we are stuck with it as the default. That being the case, for a transition period, if the existing root level settings are defined, config validation should issue a deprecation warning and activate the appropriate plugin with the settings passed in. At some future date, this special handling of the root level settings would be removed and an error would be raised if they are set.
However, the existing Google Analytics was in place long before I joined the project and remains for backward compatibility reasons.
I see what you mean, and as you rightly state, it's no deal-breaker. However, the question would be: how long should backward compatibility go? I mean it's not bad to tell users to switch at some point. However, the idea using the plugin sounds great, as this would be a way to add a possibly unlimited amount of analytics softwares (maybe even using a specific file, something along the lines of the extra_css and extra_js options) and also make sure there's no hierarchy between them.
So I'll see to get into developing a plugin for that, and until then I'll go with the analytics-block :)
@ChristianKniep I'm afraid we cannot provide integrations for each and every analytics provider out there. However, the documentation states how to add a custom analytics provider, which can even be integrated with the cookie consent.
This is just my opinion but and i dont want to sound rude in any kind:
I would like to see opensource project support each other. Matomo is a REALLY good alternative to the google provider integration already provided as topic one on the Setting up site analytics documentation site.
+1 for "Custom site analytics" though!
Because others may stumble over this issue, here my current very easy Matomo setup for mkdocs:
mkdocs.yml:
extra_javascript:
- javascripts/matomo.js
The default matomo.js:
var_paq=window._paq=window._paq||[];/* tracker methods like "setCustomDimension" should be called before "trackPageView" */_paq.push(['trackPageView']);_paq.push(['enableLinkTracking']);(function(){varu="https://matomo.YOURDOMAINHERE.com/";_paq.push(['setTrackerUrl',u+'matomo.php']);_paq.push(['setSiteId','XXXXXXX']);vard=document,g=d.createElement('script'),s=d.getElementsByTagName('script')[0];g.async=true;g.src=u+'matomo.js';s.parentNode.insertBefore(g,s);})();
In addition to that you can just use the Matomo tracking image in the footer:
As you note, this is already possible via overriding template blocks. Personally, I would be happy to leave that as the only way.
Agree.
However, the existing Google Analytics was in place long before I joined the project ...
Yep, it was in there pretty much from the beginning.
It must have seemed sparkly and important to a young me at the time to have that as a simple config option.
I'm sure we can work through a graceful way to deprecate this.
Activity
waylan commentedon May 15, 2019
As you note, this is already possible via overriding template blocks. Personally, I would be happy to leave that as the only way. However, I can also see the usability benefits of only needed to set a few config values. If this was to happen, then the existing solution should be ripped out and converted to a plugin with the relevant settings as config settings on the plugin itself. Then any other analytics services could have their own (third party) plugins as well with no need for any changes to MkDocs.
However, the existing Google Analytics was in place long before I joined the project and remains for backward compatibility reasons. Therefore we are stuck with it as the default. That being the case, for a transition period, if the existing root level settings are defined, config validation should issue a deprecation warning and activate the appropriate plugin with the settings passed in. At some future date, this special handling of the root level settings would be removed and an error would be raised if they are set.
Of course a PR is welcome.
nathanlesage commentedon May 17, 2019
Thank you for the quick reply!
I see what you mean, and as you rightly state, it's no deal-breaker. However, the question would be: how long should backward compatibility go? I mean it's not bad to tell users to switch at some point. However, the idea using the plugin sounds great, as this would be a way to add a possibly unlimited amount of analytics softwares (maybe even using a specific file, something along the lines of the
extra_cssandextra_jsoptions) and also make sure there's no hierarchy between them.So I'll see to get into developing a plugin for that, and until then I'll go with the
analytics-block :)waylan commentedon May 17, 2019
That's hard to say. I expect we would evaluate that after we have the existing Google Analytics solution broken out into a plugin.
[-]Add Matomo analytics to the built-in themes[/-][+]Support other analytics services[/+]ChristianKniep commentedon Feb 14, 2022
@squidfunk Any chance you are going to review this again? I just got started with mkdocs and insiders and first time use of Google analytics is scary.
squidfunk commentedon Feb 14, 2022
@ChristianKniep I'm afraid we cannot provide integrations for each and every analytics provider out there. However, the documentation states how to add a custom analytics provider, which can even be integrated with the cookie consent.
fly3rman commentedon Mar 14, 2023
This is just my opinion but and i dont want to sound rude in any kind:
I would like to see opensource project support each other. Matomo is a REALLY good alternative to the google provider integration already provided as topic one on the Setting up site analytics documentation site.
+1 for "Custom site analytics" though!
ayeks commentedon Mar 15, 2023
Because others may stumble over this issue, here my current very easy Matomo setup for mkdocs:
mkdocs.yml:
The default matomo.js:
In addition to that you can just use the Matomo tracking image in the footer:
mkdocs.yml:
Javascript für Analytics eingefügt
lovelydinosaur commentedon Apr 12, 2024
Let's close this off in favor of #3630
@waylan assessed this correct back in 2019...
Agree.
Yep, it was in there pretty much from the beginning.
It must have seemed sparkly and important to a young me at the time to have that as a simple config option.
I'm sure we can work through a graceful way to deprecate this.