Skip to content

Commit

Permalink
feature(analytics): ajoute le code de suivi Matomo
Browse files Browse the repository at this point in the history
  • Loading branch information
Guts committed Jul 24, 2024
1 parent b772e8f commit bb3c7a7
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ jobs:
MKDOCS_ENABLE_PLUGIN_SOCIAL: true
MKDOCS_ENABLE_PLUGIN_SOCIAL_CARDS: true
MKDOCS_GIT_COMMITTERS_APIKEY: ${{ secrets.GH_TOKEN_MATERIAL_INSIDERS }}
MKDOCS_GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }}
MKDOCS_MATOMO_URL_BASE: https://matomo.data-wax.com
MKDOCS_MATOMO_SITE_ID: 5

- name: Setup Pages
uses: actions/configure-pages@v5
Expand Down
21 changes: 21 additions & 0 deletions content/theme/partials/integrations/analytics/matomo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<script>
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
_paq.push(["setDomains", ["*.contribuer.geotribu.fr", "*.contribuer.geotribu.fr", "*.geotribu.github.io/site-contribuer"]]);
_paq.push(["enableCrossDomainLinking"]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
_paq.push(["setDoNotTrack", true]);
(function () {
var u = "{{ config.extra.analytics.matomo_url }}/";
_paq.push(['setTrackerUrl', u + 'matomo.php']);
_paq.push(['setSiteId', '{{ config.extra.analytics.matomo_site_id }}']);
var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
g.async = true; g.src = u + 'matomo.js'; s.parentNode.insertBefore(g, s);
})();
</script>
<noscript>
<p><img referrerpolicy="no-referrer-when-downgrade" src="https://matomo.data-wax.com/matomo.php?idsite=5&amp;rec=1"
style="border:0;" alt="" /></p>
</noscript>
4 changes: 4 additions & 0 deletions mkdocs-free.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ theme:

# Customization
extra:
analytics:
provider: matomo
matomo_url: !ENV [MKDOCS_MATOMO_URL_BASE, "https://matomo.data-wax.com"]
matomo_site_id: !ENV [MKDOCS_MATOMO_SITE_ID, 5]
geotribu_main_site: https://geotribu.fr/
consent:
title: Consentement 🍪
Expand Down
4 changes: 4 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ theme:

# Customization
extra:
analytics:
provider: matomo
matomo_url: !ENV [MKDOCS_MATOMO_URL_BASE, "https://matomo.data-wax.com"]
matomo_site_id: !ENV [MKDOCS_MATOMO_SITE_ID, 5]
geotribu_main_site: https://geotribu.fr/
theme_insiders_flavor: true
consent:
Expand Down

0 comments on commit bb3c7a7

Please sign in to comment.