scrollytelling-piwik 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 46462401471a8661850d89256d417583e4dc8643
4
+ data.tar.gz: c5836accd9b5016c36565d3fe2bd1a07a5bccc5a
5
+ SHA512:
6
+ metadata.gz: 4bfaea8305d586a672c83c6432a7f5b9b8c617fa48d562b1833f8a182e958bc5c8c803d2754e05980380fa560b51236ae42c12e43dfd79e0c2b885e005c8f1e4
7
+ data.tar.gz: 2217beb8aa5421f23c740f15923447f5183cbd33d79ec7d740682cbbe8eddfc88016cdbda67ae917357ff82ee935aea72e492b11485801dbc6917d8e4281fe2b
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in scrollytelling-piwik.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Joost Baaij
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,43 @@
1
+ # Scrollytelling::Piwik
2
+
3
+ This [Pageflow](https://github.com/codevise/pageflow) Plugin will render the [Piwik](https://piwik.org) JavaScript snippet in your stories. This allows you to have your own analytics engine and not rely on third parties. At [Scrollytelling](https://www.scrollytelling.io) we use this because we wish not having to show a cookie warning. Naturally, we also do not wish to track our visitors for anything more than just counting them.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'scrollytelling-piwik'
11
+ ```
12
+
13
+ Bundle the plugin with your application by typing this on the command line:
14
+
15
+ $ bundle
16
+
17
+ ## Usage
18
+
19
+ Register this plugin in your Pageflow initializer.
20
+
21
+ ```
22
+ # config/initializers/pageflow.rb
23
+ config.plugin(Scrollytelling::Piwik::Plugin.new url: "//example.com/analytics/", site_id: 1)
24
+ ```
25
+
26
+ Furthermore after installing any Pageflow plugin it's a good idea to change your asset version. This will invalidate all server-side cache, most notably the cache that `i18n-js` uses to render the editor UI.
27
+
28
+ ```
29
+ # config/initializers/assets.rb
30
+ Rails.application.config.assets.version = 'x.x.x'
31
+ ```
32
+
33
+ Then restart your application server.
34
+
35
+ ## Development
36
+
37
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
38
+
39
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
40
+
41
+ ## Contributing
42
+
43
+ Bug reports and pull requests are welcome on GitHub at https://github.com/scrollytelling/scrollytelling-piwik. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,16 @@
1
+ <!-- Piwik Analytics -->
2
+ <script>
3
+ var _paq = _paq || [];
4
+ _paq.push(["setCustomVariable", 1, "account", "<%= entry.account.name %>", "visit"]);
5
+ _paq.push(["setCustomVariable", 2, "entry", "<%= entry.title %>", "visit"]);
6
+ _paq.push(['trackPageView']);
7
+ (function() {
8
+ var u="<%= url %>";
9
+ _paq.push(['setTrackerUrl', u+'piwik.php']);
10
+ _paq.push(['setSiteId', <%= site_id %>]);
11
+ var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
12
+ g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
13
+ })();
14
+ </script>
15
+ <noscript><p><img src="<%= url %>piwik.php?idsite=<%= site_id %>" style="border:0;" alt="" /></p></noscript>
16
+ <!-- End of Piwik Analytics -->
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "scrollytelling/piwik"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,4 @@
1
+ de:
2
+ pageflow:
3
+ scrollytelling_piwik:
4
+ widget_type_name: Piwik Analytics JavaScript widget
@@ -0,0 +1,4 @@
1
+ en:
2
+ pageflow:
3
+ scrollytelling_piwik:
4
+ widget_type_name: Piwik Analytics JavaScript widget
@@ -0,0 +1,11 @@
1
+ require "scrollytelling/piwik/engine"
2
+ require "scrollytelling/piwik/plugin"
3
+ require "scrollytelling/piwik/widget_type"
4
+
5
+ module Scrollytelling
6
+ module Piwik
7
+ def self.widget_type(url:, site_id:)
8
+ WidgetType.new(url: url, site_id: site_id)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ require 'rails/engine'
2
+
3
+ module Scrollytelling
4
+ module Piwik
5
+ class Engine < ::Rails::Engine
6
+ isolate_namespace Scrollytelling::Piwik
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,16 @@
1
+ require 'pageflow/plugin'
2
+
3
+ module Scrollytelling
4
+ module Piwik
5
+ class Plugin < ::Pageflow::Plugin
6
+ def initialize(url:, site_id:)
7
+ @url = url
8
+ @site_id = site_id
9
+ end
10
+
11
+ def configure(config)
12
+ config.widget_types.register(Scrollytelling::Piwik.widget_type(url: @url, site_id: @site_id), default: true)
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ module Scrollytelling
2
+ module Piwik
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,24 @@
1
+ require 'pageflow/widget_type'
2
+
3
+ module Scrollytelling
4
+ module Piwik
5
+ class WidgetType < ::Pageflow::WidgetType
6
+ def initialize(url:, site_id:)
7
+ @url = url
8
+ @site_id = site_id
9
+ end
10
+
11
+ def name
12
+ 'scrollytelling_piwik'
13
+ end
14
+
15
+ def roles
16
+ ['piwik']
17
+ end
18
+
19
+ def render(template, entry)
20
+ template.render('scrollytelling/piwik/widget.html.erb', entry: entry, url: @url, site_id: @site_id)
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'scrollytelling/piwik/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "scrollytelling-piwik"
8
+ spec.version = Scrollytelling::Piwik::VERSION
9
+ spec.authors = ["Joost Baaij"]
10
+ spec.email = ["joost@spacebabies.nl"]
11
+
12
+ spec.summary = "Render the Piwik analytics JavaScript snippet for Pageflow stories."
13
+ spec.homepage = "https://github.com/scrollytelling/scrollytelling-piwik"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.required_ruby_version = '>= 2.0.0'
22
+
23
+ spec.add_runtime_dependency "pageflow", ">= 0.7"
24
+ spec.add_runtime_dependency "rails", ">= 3.0"
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.9"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ end
metadata ADDED
@@ -0,0 +1,119 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scrollytelling-piwik
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Joost Baaij
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-06-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pageflow
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0.7'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.9'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.9'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ description:
70
+ email:
71
+ - joost@spacebabies.nl
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - CODE_OF_CONDUCT.md
79
+ - Gemfile
80
+ - LICENSE.txt
81
+ - README.md
82
+ - Rakefile
83
+ - app/views/scrollytelling/piwik/_widget.html.erb
84
+ - bin/console
85
+ - bin/setup
86
+ - config/locales/de.yml
87
+ - config/locales/en.yml
88
+ - lib/scrollytelling/piwik.rb
89
+ - lib/scrollytelling/piwik/engine.rb
90
+ - lib/scrollytelling/piwik/plugin.rb
91
+ - lib/scrollytelling/piwik/version.rb
92
+ - lib/scrollytelling/piwik/widget_type.rb
93
+ - scrollytelling-piwik.gemspec
94
+ homepage: https://github.com/scrollytelling/scrollytelling-piwik
95
+ licenses:
96
+ - MIT
97
+ metadata: {}
98
+ post_install_message:
99
+ rdoc_options: []
100
+ require_paths:
101
+ - lib
102
+ required_ruby_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: 2.0.0
107
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ requirements: []
113
+ rubyforge_project:
114
+ rubygems_version: 2.2.2
115
+ signing_key:
116
+ specification_version: 4
117
+ summary: Render the Piwik analytics JavaScript snippet for Pageflow stories.
118
+ test_files: []
119
+ has_rdoc: