-
-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Add Matomo analytics and privacy message
- Loading branch information
Showing
6 changed files
with
110 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
man/mkdocs/overrides/partials/integrations/analytics/matomo.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<script> | ||
var u="{{ config.extra.analytics.url }}"; | ||
var siteId = "{{ config.extra.analytics.site_id }}"; | ||
var _paq = window._paq = window._paq || []; | ||
// Call disableCookies before calling trackPageView | ||
_paq.push(['disableCookies']); | ||
_paq.push(['enableLinkTracking']); | ||
_paq.push(['trackPageView']); | ||
_paq.push(['enableHeartBeatTimer', 10]); // Page needs to be open for 10 seconds before tracking | ||
(function() { | ||
_paq.push(['setTrackerUrl', u+'matomo.php']); | ||
_paq.push(['setSiteId', ['2']]); | ||
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; | ||
g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); | ||
})(); | ||
/* Wait for page to load and application to mount */ | ||
document.addEventListener("DOMContentLoaded", function() { | ||
location$.subscribe(function(url) { | ||
/* Add custom page event tracking here */ | ||
_paq.push(['setDocumentTitle', document.title]); | ||
}) | ||
}) | ||
</script> |