rack-tracker 1.11.2 → 1.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +10 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile.rails-6.0 +6 -0
- data/README.md +12 -0
- data/lib/rack/tracker.rb +1 -0
- data/lib/rack/tracker/google_analytics/template/google_analytics.erb +2 -2
- data/lib/rack/tracker/heap/heap.rb +2 -0
- data/lib/rack/tracker/heap/template/heap.erb +4 -0
- data/lib/rack/tracker/version.rb +1 -1
- data/spec/handler/heap_spec.rb +10 -0
- data/spec/integration/heap_integration_spec.rb +17 -0
- data/spec/integration/rails_integration_spec.rb +16 -7
- data/spec/support/metal_controller.rb +4 -0
- metadata +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96cc84b108179e10df6c41c10fb536597f8ba93ac7106d38bbfe9b8d36e6da6e
|
4
|
+
data.tar.gz: dccdd57d1f3c8985ef500c45a6441b0821e7a1dc33dd232503bd1ca73d5ed1ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78b014112e736701afb694c07384cd368a37054c8d734a8b38d9bb9224a33d0b857e8596e486a9e06d8c0038a54e9917835e7e2ba64efc96ecb5f06a21bc7b30
|
7
|
+
data.tar.gz: 9d81d707139e7393409c15a2e1f9fe7289394988bf1804613550bab4a114d3c393e175c512062bca1b3816b97ad3aa4c913614fd51a27cbc736a57bd8517aa96
|
data/.travis.yml
CHANGED
@@ -6,8 +6,18 @@ rvm:
|
|
6
6
|
- 2.5.3
|
7
7
|
- 2.6.1
|
8
8
|
- jruby-9.1.10.0
|
9
|
+
- jruby-9.2.7.0
|
9
10
|
gemfile:
|
10
11
|
- Gemfile
|
11
12
|
- Gemfile.rails-3.2
|
12
13
|
- Gemfile.rails-4.2
|
13
14
|
- Gemfile.rails-5.2
|
15
|
+
- Gemfile.rails-6.0
|
16
|
+
matrix:
|
17
|
+
exclude:
|
18
|
+
- rvm: 2.3.8
|
19
|
+
gemfile: Gemfile.rails-6.0
|
20
|
+
- rvm: 2.4.5
|
21
|
+
gemfile: Gemfile.rails-6.0
|
22
|
+
- rvm: jruby-9.1.10.0
|
23
|
+
gemfile: Gemfile.rails-6.0
|
data/CHANGELOG.md
CHANGED
data/Gemfile.rails-6.0
ADDED
data/README.md
CHANGED
@@ -615,6 +615,18 @@ config.middleware.use(Rack::Tracker) do
|
|
615
615
|
end
|
616
616
|
```
|
617
617
|
|
618
|
+
### Heap
|
619
|
+
|
620
|
+
[Heap](https://heap.io/). Heap has Projects (e.g. "Main") which have multiple
|
621
|
+
Environments (e.g. "Production" or "Development"). `env_id` is therefore the numerical ID
|
622
|
+
that represents the Environment. See Settings -> Projects -> Environments in your dashboard.
|
623
|
+
|
624
|
+
```
|
625
|
+
config.middleware.use(Rack::Tracker) do
|
626
|
+
handler :heap, env_id: 'HEAP_ID'
|
627
|
+
end
|
628
|
+
```
|
629
|
+
|
618
630
|
### Custom Handlers
|
619
631
|
|
620
632
|
Tough we give you handlers for a few tracking services right out of the box, you might
|
data/lib/rack/tracker.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
<script type="text/javascript">
|
2
1
|
<% if tracker %>
|
2
|
+
<script type="text/javascript">
|
3
3
|
if(typeof ga === 'undefined') {
|
4
4
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
5
5
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
@@ -40,5 +40,5 @@
|
|
40
40
|
<% end %>
|
41
41
|
<% if tracker && options[:explicit_pageview] %>
|
42
42
|
ga('send', 'pageview', <%= pageview_url_script %>);
|
43
|
-
<% end %>
|
44
43
|
</script>
|
44
|
+
<% end %>
|
@@ -0,0 +1,4 @@
|
|
1
|
+
<script>
|
2
|
+
window.heap=window.heap||[],heap.load=function(e,t){window.heap.appid=e,window.heap.config=t=t||{};var r=t.forceSSL||"https:"===document.location.protocol,a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src=(r?"https:":"http:")+"//cdn.heapanalytics.com/js/heap-"+e+".js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(a,n);for(var o=function(e){return function(){heap.push([e].concat(Array.prototype.slice.call(arguments,0)))}},p=["addEventProperties","addUserProperties","clearEventProperties","identify","resetIdentity","removeEventProperty","setEventProperties","track","unsetEventProperty"],c=0;c<p.length;c++)heap[p[c]]=o(p[c])};
|
3
|
+
heap.load("<%= options[:env_id] %>");
|
4
|
+
</script>
|
data/lib/rack/tracker/version.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'support/capybara_app_helper'
|
2
|
+
|
3
|
+
RSpec.describe "Heap Integration" do
|
4
|
+
before do
|
5
|
+
setup_app(action: :heap) do |tracker|
|
6
|
+
tracker.handler :heap, { env_id: '12341234' }
|
7
|
+
end
|
8
|
+
|
9
|
+
visit '/'
|
10
|
+
end
|
11
|
+
|
12
|
+
subject { page }
|
13
|
+
|
14
|
+
it 'embeds the script with site_id' do
|
15
|
+
expect(page).to have_content('heap.load("12341234");')
|
16
|
+
end
|
17
|
+
end
|
@@ -1,10 +1,19 @@
|
|
1
1
|
require 'support/capybara_app_helper'
|
2
2
|
|
3
3
|
RSpec.describe "Rails Integration" do
|
4
|
+
let(:callable_skip_inject) do
|
5
|
+
lambda do |env|
|
6
|
+
# check for anything in the env hash to decide
|
7
|
+
# if you return the `tracker id` or `nil` to skip injection
|
8
|
+
nil
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
4
12
|
before do
|
5
13
|
setup_app(action: :index) do |tracker|
|
6
14
|
tracker.handler :track_all_the_things, { custom_key: 'SomeKey123' }
|
7
15
|
tracker.handler :another_handler, { custom_key: 'AnotherKey42' }
|
16
|
+
tracker.handler :google_analytics, { tracker: callable_skip_inject }
|
8
17
|
end
|
9
18
|
|
10
19
|
visit '/'
|
@@ -17,15 +26,15 @@ RSpec.describe "Rails Integration" do
|
|
17
26
|
<html>
|
18
27
|
<head>
|
19
28
|
<title>Metal Layout</title>
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
29
|
+
<script type="text/javascript">
|
30
|
+
myAwesomeFunction("tracks", "like", "no-one-else", "SomeKey123");
|
31
|
+
</script>
|
32
|
+
</head>
|
24
33
|
<body class="do-we-support-attributes-on-the-body-tag">
|
25
34
|
<h1>welcome to metal#index</h1>
|
26
|
-
|
27
|
-
|
28
|
-
|
35
|
+
<script type="text/javascript">
|
36
|
+
anotherFunction("tracks-event-from-down-under", "AnotherKey42");
|
37
|
+
</script>
|
29
38
|
</body>
|
30
39
|
</html>
|
31
40
|
HTML
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-tracker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lars Brillert
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-11-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
@@ -154,6 +154,7 @@ files:
|
|
154
154
|
- Gemfile.rails-3.2
|
155
155
|
- Gemfile.rails-4.2
|
156
156
|
- Gemfile.rails-5.2
|
157
|
+
- Gemfile.rails-6.0
|
157
158
|
- LICENSE.txt
|
158
159
|
- README.md
|
159
160
|
- Rakefile
|
@@ -184,6 +185,8 @@ files:
|
|
184
185
|
- lib/rack/tracker/google_tag_manager/template/google_tag_manager_head.erb
|
185
186
|
- lib/rack/tracker/handler.rb
|
186
187
|
- lib/rack/tracker/handler_delegator.rb
|
188
|
+
- lib/rack/tracker/heap/heap.rb
|
189
|
+
- lib/rack/tracker/heap/template/heap.erb
|
187
190
|
- lib/rack/tracker/hotjar/hotjar.rb
|
188
191
|
- lib/rack/tracker/hotjar/template/hotjar.erb
|
189
192
|
- lib/rack/tracker/hubspot/hubspot.rb
|
@@ -214,6 +217,7 @@ files:
|
|
214
217
|
- spec/handler/google_global_spec.rb
|
215
218
|
- spec/handler/google_tag_manager_spec.rb
|
216
219
|
- spec/handler/handler_spec.rb
|
220
|
+
- spec/handler/heap_spec.rb
|
217
221
|
- spec/handler/hotjar_spec.rb
|
218
222
|
- spec/handler/hubspot_spec.rb
|
219
223
|
- spec/handler/vwo_spec.rb
|
@@ -228,6 +232,7 @@ files:
|
|
228
232
|
- spec/integration/google_analytics_integration_spec.rb
|
229
233
|
- spec/integration/google_global_integration_spec.rb
|
230
234
|
- spec/integration/google_tag_manager_integration_spec.rb
|
235
|
+
- spec/integration/heap_integration_spec.rb
|
231
236
|
- spec/integration/hotjar_integration_spec.rb
|
232
237
|
- spec/integration/hubspot_integration_spec.rb
|
233
238
|
- spec/integration/rails_integration_spec.rb
|
@@ -261,7 +266,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
261
266
|
- !ruby/object:Gem::Version
|
262
267
|
version: '0'
|
263
268
|
requirements: []
|
264
|
-
rubygems_version: 3.0.
|
269
|
+
rubygems_version: 3.0.6
|
265
270
|
signing_key:
|
266
271
|
specification_version: 4
|
267
272
|
summary: Tracking made easy
|
@@ -284,6 +289,7 @@ test_files:
|
|
284
289
|
- spec/handler/google_global_spec.rb
|
285
290
|
- spec/handler/google_tag_manager_spec.rb
|
286
291
|
- spec/handler/handler_spec.rb
|
292
|
+
- spec/handler/heap_spec.rb
|
287
293
|
- spec/handler/hotjar_spec.rb
|
288
294
|
- spec/handler/hubspot_spec.rb
|
289
295
|
- spec/handler/vwo_spec.rb
|
@@ -298,6 +304,7 @@ test_files:
|
|
298
304
|
- spec/integration/google_analytics_integration_spec.rb
|
299
305
|
- spec/integration/google_global_integration_spec.rb
|
300
306
|
- spec/integration/google_tag_manager_integration_spec.rb
|
307
|
+
- spec/integration/heap_integration_spec.rb
|
301
308
|
- spec/integration/hotjar_integration_spec.rb
|
302
309
|
- spec/integration/hubspot_integration_spec.rb
|
303
310
|
- spec/integration/rails_integration_spec.rb
|