Adds Matomo (aka Piwik) integration (#310)
* adds Matomo (aka Pwiki) integration * adds tracking code in header
This commit is contained in:
parent
0ff0c5ad6b
commit
7677fbd01a
4 changed files with 46 additions and 4 deletions
|
@ -32,6 +32,13 @@
|
|||
•
|
||||
<a href="{{ site.url }}">{{ site.url-pretty }}</a>
|
||||
{% endif %}
|
||||
|
||||
{% if site.matomo %}
|
||||
•
|
||||
{% if site.matomo.opt-out %}
|
||||
<a href="http://{{- site.matomo.uri -}}/index.php?module=CoreAdminHome&action=optOut" target="_blank" class="text_muted">Do-not-Track</a>
|
||||
{% endif %}
|
||||
{% endif%}
|
||||
</p>
|
||||
<!-- Please don't remove this, keep my open source work credited :) -->
|
||||
<p class="theme-by text-muted">
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
{% elsif site.avatar %}
|
||||
<meta property="og:image" content="{{ site.url }}{{ site.avatar }}" />
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
<!-- Twitter summary cards -->
|
||||
<meta name="twitter:card" content="summary" />
|
||||
|
@ -117,4 +117,8 @@
|
|||
<meta name="twitter:image" content="{{ site.url }}{{ site.avatar }}" />
|
||||
{% endif %}
|
||||
|
||||
{% if site.matomo %}
|
||||
{% include matomo.html %}
|
||||
{% endif %}
|
||||
|
||||
</head>
|
||||
|
|
17
_includes/matomo.html
Normal file
17
_includes/matomo.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
{% if site.matomo %}
|
||||
<!-- Matomo -->
|
||||
<script type="text/javascript">
|
||||
var _paq = _paq || [];
|
||||
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
|
||||
_paq.push(['trackPageView']);
|
||||
_paq.push(['enableLinkTracking']);
|
||||
(function() {
|
||||
var u="//{{- site.matomo.uri -}}/";
|
||||
_paq.push(['setTrackerUrl', u+'piwik.php']);
|
||||
_paq.push(['setSiteId', '{{- site.matomo.site_id -}}']);
|
||||
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
|
||||
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
|
||||
})();
|
||||
</script>
|
||||
<!-- End Piwik Code -->
|
||||
{% endif %}
|
Loading…
Add table
Add a link
Reference in a new issue