-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
60 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
function initMatomo () { | ||
const matomo = document.getElementById('matomo') | ||
const _paq = window._paq = window._paq || [] | ||
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */ | ||
if (matomo.dataset.cookieDisabed) { | ||
_paq.push(['disableCookies']) | ||
} | ||
_paq.push(['trackPageView']) | ||
_paq.push(['enableLinkTracking']) | ||
insertMatomo(_paq, matomo.dataset.url, matomo.dataset.id) | ||
} | ||
|
||
function insertMatomo (_paq, url, id) { | ||
_paq.push(['setTrackerUrl', url + 'matomo.php']) | ||
_paq.push(['setSiteId', id]) | ||
const d = document; const g = d.createElement('script'); const s = d.getElementsByTagName('script')[0] | ||
g.type = 'text/javascript'; g.async = true; g.src = url + 'matomo.js'; s.parentNode.insertBefore(g, s) | ||
} | ||
|
||
initMatomo() |
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,4 @@ | ||
{% load static %} | ||
<!-- Matomo --> | ||
<script id="matomo" data-cookieDisabled={{ cookie_disabled }} data-url="{{ url }}" data-id="{{ id }}" async src="{% static 'matomo.js' %}"></script> | ||
<!-- End Matomo Code --> |
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,3 @@ | ||
### Added | ||
|
||
- added matomo integration |
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