20 lines
854 B
Twig
20 lines
854 B
Twig
|
|
{# https://developer.matomo.org/guides/tracking-javascript-guide #}
|
||
|
|
{% autoescape 'js' %}
|
||
|
|
// Matomo
|
||
|
|
var _paq = window._paq = window._paq || [];
|
||
|
|
{# tracker methods like "setCustomDimension" should be called before "trackPageView" #}
|
||
|
|
{% if not config.plugins.matomo.enable_cookies %}
|
||
|
|
_paq.push(['disableCookies']);
|
||
|
|
{% endif %}
|
||
|
|
_paq.push(['trackPageView']);
|
||
|
|
_paq.push(['enableLinkTracking']);
|
||
|
|
(function() {
|
||
|
|
var u="//{{ config.plugins.matomo.matomo_url|replace({'https://': '', 'https://': ''})|trim|rtrim('/') }}/";
|
||
|
|
_paq.push(['setTrackerUrl', u+'matomo.php']);
|
||
|
|
_paq.push(['setSiteId', {{ config.plugins.matomo.site_id }}]);
|
||
|
|
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);
|
||
|
|
})();
|
||
|
|
// End Matomo Code
|
||
|
|
{% endautoescape %}
|