项目作者: wikimatze

项目描述 :
Tracking code for matomo
高级语言: Ruby
项目地址: git://github.com/wikimatze/matomo-middleman.git
创建时间: 2017-12-14T17:57:09Z
项目社区:https://github.com/wikimatze/matomo-middleman

开源协议:

下载


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:

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

Run bundle install.

Configuration

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

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

Helper

This plugin will add the following helper method:

  1. <%= matomo %>

which will expand to

  1. <script type="text/javascript">
  2. var _paq = _paq || [];
  3. _paq.push(['trackPageView']);
  4. _paq.push(['enableLinkTracking']);
  5. (function() {
  6. var u=(("https:" == document.location.protocol) ? "https" : "http") + "://<your-domain>/<your-url>/";
  7. _paq.push(['setTrackerUrl', u+'piwik.php']);
  8. _paq.push(['setSiteId', 1]);
  9. var d=document, g=d.createElement('script'),
  10. s=d.getElementsByTagName('script')[0];
  11. g.type='text/javascript';
  12. g.defer=true; g.async=true;
  13. g.src=u+'piwik.js';
  14. s.parentNode.insertBefore(g,s);
  15. })();
  16. </script>
  17. <noscript><p><img src="https://<your-domain>/<your-url>/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript>