An open API service indexing awesome lists of open source software.

https://github.com/wikimatze/matomo-middleman

Tracking code for matomo
https://github.com/wikimatze/matomo-middleman

middleman middleman-extension ruby

Last synced: about 2 months ago
JSON representation

Tracking code for matomo

Awesome Lists containing this project

README

        

# Matomo-Middleman
[![Gem Version](https://badge.fury.io/rb/matomo-middleman.svg)](https://badge.fury.io/rb/matomo-middleman)

It's an extension for the [Middleman](http://middlemanapp.com/) static site generator
to use [Matomo](https://matomo.org/) tracking (previously known as [Piwik](https://matomo.org/blog/2018/01/piwik-is-now-matomo/)).

## Installation

Clone the repository `git clone [email protected]:wikimatze/matomo-middleman.git ~/git/matomo-middleman`.
Then add the following line to your `Gemfile`:

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

Run `bundle install`.

## Configuration

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

```ruby
activate :matomomiddleman do |p|
p.domain = ''
p.url = ''
p.id = 1
end
```

## Helper

This plugin will add the following helper method:

```erb
<%= matomo %>
```

which will expand to

```erb

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);
})();


```