No commit activity in last 3 years
No release in over 3 years
Add tracking code for matomo
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Matomo-Middleman

Gem Version

It's an extension for the Middleman static site generator to use Matomo tracking (previously known as Piwik).

Installation

Clone the repository git clone git@github.com:wikimatze/matomo-middleman.git ~/git/matomo-middleman. Then add the following line to your Gemfile:

gem 'matomo-middleman', path: "/home/wm/git/matomo-middleman/"

Run bundle install.

Configuration

In your config.rb you can configure the settings as follow:

activate :matomomiddleman do |p|
  p.domain = '<your-domain>'
  p.url = '<your-url>'
  p.id = 1
end

Helper

This plugin will add the following helper method:

<%= matomo %>

which will expand to

<script type="text/javascript">
  var _paq = _paq || [];
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
  var u=(("https:" == document.location.protocol) ? "https" : "http") + "://<your-domain>/<your-url>/";
  _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.defer=true; g.async=true;
  g.src=u+'piwik.js';
  s.parentNode.insertBefore(g,s);
  })();
</script>
<noscript><p><img src="https://<your-domain>/<your-url>/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript>