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
- Host: GitHub
- URL: https://github.com/wikimatze/matomo-middleman
- Owner: wikimatze
- Created: 2017-12-14T17:57:09.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-11-21T07:55:47.000Z (over 5 years ago)
- Last Synced: 2025-03-25T14:44:47.528Z (2 months ago)
- Topics: middleman, middleman-extension, ruby
- Language: Ruby
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Matomo-Middleman
[](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);
})();
```