Added Matomo tracking pixel

This commit is contained in:
Hendrik Schneider 2019-10-19 21:15:30 +02:00
parent da24705b17
commit 9ca90d930f
3 changed files with 23 additions and 11 deletions

View file

@ -1,7 +1,7 @@
Gem::Specification.new do |s|
s.name = 'jekyll-analytics'
s.version = '0.1.11'
s.version = '0.1.12'
s.date = '2018-05-04'
s.summary = "Jekyll plugin "
s.description = "Plugin to easily add web analytics to your jekyll site without modifying your templates. Supported are: Google Analytics, Piwik, Matomo, MPulse"

View file

@ -1,6 +1,12 @@
class Matomo
SETUP_CODE = """
<!-- Matomo -->
<!-- Matomo Image Tracker -->
<img src=\"%{url}?idsite=%{siteId}&amp;rec=1\" style=\"border:0\" alt=\"\" />
<!-- End Matomo -->
<script type=\"text/javascript\">
var _paq = _paq || [];
_paq.push(['trackPageView']);

View file

@ -13,17 +13,23 @@ class MatomoTest < Test::Unit::TestCase
assert_equal(matomoAnalytics.render(),
"""
<!-- Matomo -->
<!-- Matomo Image Tracker -->
<img src=\"my.matomo.server/path?idsite=1&amp;rec=1\" style=\"border:0\" alt=\"\" />
<!-- End Matomo -->
<script type=\"text/javascript\">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u=\'//\'+\"my.matomo.server/path\";
_paq.push(['setTrackerUrl', u+'/piwik.php']);
_paq.push(['setSiteId', '1']);
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);
})();
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u=\'//\'+\"my.matomo.server/path\";
_paq.push(['setTrackerUrl', u+'/piwik.php']);
_paq.push(['setSiteId', '1']);
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 Matomo Code -->
""")