matomo-middleman 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/Gemfile +16 -0
- data/README.md +64 -0
- data/Rakefile +5 -0
- data/lib/matomo-middleman.rb +4 -0
- data/lib/matomo-middleman/extension.rb +35 -0
- data/matomo-middleman.gemspec +25 -0
- metadata +66 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a6b7de4c44d3f32da5906e87377cdd3ba944c4b2
|
4
|
+
data.tar.gz: 0cbc7d88a6b6293ea7627692478abd72ab4abf5d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b1a3fe813df70a56557142616b8fac0eae9446146e147e7ff87765c472590dfa26f4d43bbc9730890399821962a7233b3c525c992798b0e48b0caf9ce967a32e
|
7
|
+
data.tar.gz: 453b2e1445de74ebbcfc0718d7116a3fdd86f6e42be0cc6148816b1892d9501125f0b89539203578df37580329af9bb040a23e5aed64071bd55fa24ccd9381ae
|
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# If you do not have OpenSSL installed, update
|
2
|
+
# the following line to use "http://" instead
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in piwik-middleman.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
group :development do
|
9
|
+
gem 'rake'
|
10
|
+
gem 'rdoc'
|
11
|
+
gem 'yard'
|
12
|
+
end
|
13
|
+
|
14
|
+
group :test do
|
15
|
+
gem 'rspec'
|
16
|
+
end
|
data/README.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# Motomo-Middleman
|
2
|
+
|
3
|
+
It's an extension for the [Middleman](http://middlemanapp.com/) static site generator
|
4
|
+
to use [Matomo](https://matomo.org/) tracking (previously known as [Piwik](https://matomo.org/blog/2018/01/piwik-is-now-matomo/)).
|
5
|
+
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Clone the repository `git clone git@github.com:wikimatze/motomo-middleman.git ~/git/motomo-middleman`.
|
10
|
+
Then add the following line to your `Gemfile`:
|
11
|
+
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'motomo-middleman', path: "/home/wm/git/motomo-middleman/"
|
15
|
+
```
|
16
|
+
|
17
|
+
Run `bundle install`.
|
18
|
+
|
19
|
+
|
20
|
+
## Configuration
|
21
|
+
|
22
|
+
In your `config.rb` you can configure the settings as follow:
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
activate :motomomiddleman do |p|
|
26
|
+
p.domain = '<your-domain>'
|
27
|
+
p.url = '<your-url>'
|
28
|
+
p.id = 1
|
29
|
+
end
|
30
|
+
```
|
31
|
+
|
32
|
+
|
33
|
+
## Helper
|
34
|
+
|
35
|
+
This plugin will add the following helper method:
|
36
|
+
|
37
|
+
```erb
|
38
|
+
<%= motomo %>
|
39
|
+
```
|
40
|
+
|
41
|
+
|
42
|
+
which will expand to
|
43
|
+
|
44
|
+
|
45
|
+
```erb
|
46
|
+
<script type="text/javascript">
|
47
|
+
var _paq = _paq || [];
|
48
|
+
_paq.push(['trackPageView']);
|
49
|
+
_paq.push(['enableLinkTracking']);
|
50
|
+
(function() {
|
51
|
+
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://<your-domain>/<your-url>/";
|
52
|
+
_paq.push(['setTrackerUrl', u+'piwik.php']);
|
53
|
+
_paq.push(['setSiteId', 1]);
|
54
|
+
var d=document, g=d.createElement('script'),
|
55
|
+
s=d.getElementsByTagName('script')[0];
|
56
|
+
g.type='text/javascript';
|
57
|
+
g.defer=true; g.async=true;
|
58
|
+
g.src=u+'piwik.js';
|
59
|
+
s.parentNode.insertBefore(g,s);
|
60
|
+
})();
|
61
|
+
</script>
|
62
|
+
<noscript><p><img src="https://<your-domain>/<your-url>/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript>
|
63
|
+
```
|
64
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# Require core library
|
2
|
+
require 'middleman-core'
|
3
|
+
|
4
|
+
# Extension namespace
|
5
|
+
class MatomoExtension < ::Middleman::Extension
|
6
|
+
option :domain, 'localhost.com', 'An example url for motomo'
|
7
|
+
option :url, 'matomo', 'An example path to your matomo installation'
|
8
|
+
option :id, 1, 'The id for matomo'
|
9
|
+
|
10
|
+
def after_configuration
|
11
|
+
app.config[:matomo_domain] = options.domain
|
12
|
+
app.config[:matomo_url] = options.url
|
13
|
+
app.config[:matomo_id] = options.id
|
14
|
+
end
|
15
|
+
|
16
|
+
helpers do
|
17
|
+
def matomo
|
18
|
+
<<END
|
19
|
+
<script>
|
20
|
+
var _paq = _paq || [];
|
21
|
+
_paq.push(['trackPageView']);
|
22
|
+
_paq.push(['enableLinkTracking']);
|
23
|
+
(function() {
|
24
|
+
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://#{config[:matomo_domain]}/#{config[:matomo_url]}/";
|
25
|
+
_paq.push(['setTrackerUrl', u+'piwik.php']);
|
26
|
+
_paq.push(['setSiteId', 1]);
|
27
|
+
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript';
|
28
|
+
g.defer=true; g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
|
29
|
+
})();
|
30
|
+
</script>
|
31
|
+
<noscript><p><img src="https://#{config[:matomo_domain]}/#{config[:matomo_url]}/piwik.php?idsite=#{config[:matomo_id]}" style="border:0;" alt="" /></p></noscript>
|
32
|
+
END
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "matomo-middleman"
|
6
|
+
s.version = "0.0.1"
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.authors = ["Matthias Guenther"]
|
9
|
+
s.email = ["matze@wikimatze.de"]
|
10
|
+
s.homepage = "https://github.com/wikimatze/matomo-middleman"
|
11
|
+
s.summary = %q{Add tracking helper for matomo}
|
12
|
+
s.description = %q{Add tracking code for matomo}
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
|
19
|
+
s.license = "MIT"
|
20
|
+
|
21
|
+
s.extra_rdoc_files = ['README.md']
|
22
|
+
|
23
|
+
# The version of middleman-core your extension depends on
|
24
|
+
s.add_runtime_dependency 'middleman-core', '~> 4.2'
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: matomo-middleman
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matthias Guenther
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-02-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: middleman-core
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.2'
|
27
|
+
description: Add tracking code for matomo
|
28
|
+
email:
|
29
|
+
- matze@wikimatze.de
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files:
|
33
|
+
- README.md
|
34
|
+
files:
|
35
|
+
- ".gitignore"
|
36
|
+
- Gemfile
|
37
|
+
- README.md
|
38
|
+
- Rakefile
|
39
|
+
- lib/matomo-middleman.rb
|
40
|
+
- lib/matomo-middleman/extension.rb
|
41
|
+
- matomo-middleman.gemspec
|
42
|
+
homepage: https://github.com/wikimatze/matomo-middleman
|
43
|
+
licenses:
|
44
|
+
- MIT
|
45
|
+
metadata: {}
|
46
|
+
post_install_message:
|
47
|
+
rdoc_options: []
|
48
|
+
require_paths:
|
49
|
+
- lib
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
requirements: []
|
61
|
+
rubyforge_project:
|
62
|
+
rubygems_version: 2.6.14
|
63
|
+
signing_key:
|
64
|
+
specification_version: 4
|
65
|
+
summary: Add tracking helper for matomo
|
66
|
+
test_files: []
|