Adds Matomo (aka Piwik) integration (#310)

* adds Matomo (aka Pwiki) integration

* adds tracking code in header
This commit is contained in:
OCram85 2018-01-22 08:14:52 +01:00 committed by Dean Attali
parent 0ff0c5ad6b
commit 7677fbd01a
4 changed files with 46 additions and 4 deletions

View File

@ -101,9 +101,8 @@ share-links-active:
# Remove this if you don't want a link in the footer # Remove this if you don't want a link in the footer
url-pretty: "MyWebsite.com" # eg. "deanattali.com/beautiful-jekyll" url-pretty: "MyWebsite.com" # eg. "deanattali.com/beautiful-jekyll"
# --- Misc --- # # --- Web Statistics Section --- #
# Fill in your Disqus shortname (NOT the userid) if you want to support Disqus comments # ...Beautiful Jekyll integrates with Google Analytics and Matomo(aka Piwik)
#disqus: ""
# Fill in your Google Analytics ID to track your website using GA # Fill in your Google Analytics ID to track your website using GA
#google_analytics: "" #google_analytics: ""
@ -111,6 +110,21 @@ url-pretty: "MyWebsite.com" # eg. "deanattali.com/beautiful-jekyll"
# Google Tag Manager ID # Google Tag Manager ID
#gtm: "" #gtm: ""
# Matomo (aka Piwik) Web statistics
# Uncomment this Matomo options to enable tacking:
# - Provide a valid site id given by your Matomo instance.
# - Enter the Matomo URI without the protocoll.
# - Enable/ Disable the Opt-Out feature for users. This will ad a Do-Not-Track option in the footer section.
# matomo:
# site_id: "9"
# uri: "demo.wiki.pro"
# opt-out: true
# --- Misc --- #
# Fill in your Disqus shortname (NOT the userid) if you want to support Disqus comments
#disqus: ""
# Facebook App ID # Facebook App ID
# fb_app_id: "" # fb_app_id: ""

View File

@ -32,6 +32,13 @@
 •   • 
<a href="{{ site.url }}">{{ site.url-pretty }}</a> <a href="{{ site.url }}">{{ site.url-pretty }}</a>
{% endif %} {% endif %}
{% if site.matomo %}
&nbsp;&bull;&nbsp;
{% 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> </p>
<!-- Please don't remove this, keep my open source work credited :) --> <!-- Please don't remove this, keep my open source work credited :) -->
<p class="theme-by text-muted"> <p class="theme-by text-muted">

View File

@ -117,4 +117,8 @@
<meta name="twitter:image" content="{{ site.url }}{{ site.avatar }}" /> <meta name="twitter:image" content="{{ site.url }}{{ site.avatar }}" />
{% endif %} {% endif %}
{% if site.matomo %}
{% include matomo.html %}
{% endif %}
</head> </head>

17
_includes/matomo.html Normal file
View 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 %}