rack-tracker 1.10.0 → 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +9 -0
- data/lib/rack/tracker.rb +1 -0
- data/lib/rack/tracker/drift/drift.rb +2 -0
- data/lib/rack/tracker/drift/template/drift.erb +26 -0
- data/lib/rack/tracker/google_global/google_global.rb +2 -3
- data/lib/rack/tracker/version.rb +1 -1
- data/spec/handler/drift_spec.rb +10 -0
- data/spec/handler/google_global_spec.rb +4 -2
- data/spec/integration/drift_integration_spec.rb +18 -0
- data/spec/support/metal_controller.rb +4 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43c9e6c847d6027e64187d444e7072ad4a403cf57d51f5463e2212321aa6b966
|
4
|
+
data.tar.gz: ab96439cd23a92e064741494d7bac62ee71ade68cce37085d9a5618f980fc11a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5baa0bb87f39e551f983ce8c0637c8bb90dbfb70a0f3f9bfd8c011eb6564b5ebf69eefe6d648a1cad54978b267ef2140e0e268ca7e52977e4d782ceb51b737a0
|
7
|
+
data.tar.gz: adb6cad395e5d8a4aa3dc81e95314ee415a1d1a6cf82eb8f9477ab75e5f9b04454f5736eab287fa78a8a6c6356db302c89f98a1a42ec91101fcf78182fe7bfec
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -604,6 +604,15 @@ config.middleware.use(Rack::Tracker) do
|
|
604
604
|
end
|
605
605
|
```
|
606
606
|
|
607
|
+
### Drift
|
608
|
+
|
609
|
+
[Drift](https://www.drift.com/)
|
610
|
+
|
611
|
+
```
|
612
|
+
config.middleware.use(Rack::Tracker) do
|
613
|
+
handler :drift, account_id: 'DRIFT_ID'
|
614
|
+
end
|
615
|
+
```
|
607
616
|
|
608
617
|
### Custom Handlers
|
609
618
|
|
data/lib/rack/tracker.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
<script>
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
!function() {
|
5
|
+
var t = window.driftt = window.drift = window.driftt || [];
|
6
|
+
if (!t.init) {
|
7
|
+
if (t.invoked) return void (window.console && console.error && console.error("Drift snippet included twice."));
|
8
|
+
t.invoked = !0, t.methods = [ "identify", "config", "track", "reset", "debug", "show", "ping", "page", "hide", "off", "on" ],
|
9
|
+
t.factory = function(e) {
|
10
|
+
return function() {
|
11
|
+
var n = Array.prototype.slice.call(arguments);
|
12
|
+
return n.unshift(e), t.push(n), t;
|
13
|
+
};
|
14
|
+
}, t.methods.forEach(function(e) {
|
15
|
+
t[e] = t.factory(e);
|
16
|
+
}), t.load = function(t) {
|
17
|
+
var e = 3e5, n = Math.ceil(new Date() / e) * e, o = document.createElement("script");
|
18
|
+
o.type = "text/javascript", o.async = !0, o.crossorigin = "anonymous", o.src = "https://js.driftt.com/include/" + n + "/" + t + ".js";
|
19
|
+
var i = document.getElementsByTagName("script")[0];
|
20
|
+
i.parentNode.insertBefore(o, i);
|
21
|
+
};
|
22
|
+
}
|
23
|
+
}();
|
24
|
+
drift.SNIPPET_VERSION = '0.3.1';
|
25
|
+
drift.load(<%= options[:account_id] %>);
|
26
|
+
</script>
|
@@ -11,11 +11,10 @@ class Rack::Tracker::GoogleGlobal < Rack::Tracker::Handler
|
|
11
11
|
|
12
12
|
class Event < OpenStruct
|
13
13
|
PREFIXED_PARAMS = %i[category label]
|
14
|
-
|
15
|
-
PARAMS = PREFIXED_PARAMS + LITERAL_PARAMS
|
14
|
+
SKIP_PARAMS = %i[action]
|
16
15
|
|
17
16
|
def params
|
18
|
-
Hash[to_h.
|
17
|
+
Hash[to_h.except(*SKIP_PARAMS).map { |key, value| [param_key(key), value] }]
|
19
18
|
end
|
20
19
|
|
21
20
|
private
|
data/lib/rack/tracker/version.rb
CHANGED
@@ -210,13 +210,15 @@ RSpec.describe Rack::Tracker::GoogleGlobal do
|
|
210
210
|
'action' => 'login',
|
211
211
|
'category' => 'engagement',
|
212
212
|
'label' => 'Github',
|
213
|
-
'value' => 5
|
213
|
+
'value' => 5,
|
214
|
+
'transaction_id' => 1001,
|
215
|
+
}
|
214
216
|
]
|
215
217
|
}}
|
216
218
|
end
|
217
219
|
|
218
220
|
it "will show event" do
|
219
|
-
expect(subject).to match(%r{gtag\('event', 'login', {\"event_category\":\"engagement\",\"event_label\":\"Github\",\"value\":5}\);})
|
221
|
+
expect(subject).to match(%r{gtag\('event', 'login', {\"event_category\":\"engagement\",\"event_label\":\"Github\",\"value\":5,\"transaction_id\":1001}\);})
|
220
222
|
end
|
221
223
|
end
|
222
224
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'support/capybara_app_helper'
|
2
|
+
|
3
|
+
RSpec.describe 'Drift Integration' do
|
4
|
+
before do
|
5
|
+
setup_app(action: :drift) do |tracker|
|
6
|
+
tracker.handler :drift, account_id: 'DRIFT_ID'
|
7
|
+
end
|
8
|
+
|
9
|
+
visit '/'
|
10
|
+
end
|
11
|
+
|
12
|
+
subject { page }
|
13
|
+
|
14
|
+
it 'embeds the script with account_id' do
|
15
|
+
expect(page.find('script')).to have_content('js.driftt.com')
|
16
|
+
expect(page.find('script')).to have_content('DRIFT_ID')
|
17
|
+
end
|
18
|
+
end
|
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.11.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-07-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
@@ -163,6 +163,8 @@ files:
|
|
163
163
|
- lib/rack/tracker/controller.rb
|
164
164
|
- lib/rack/tracker/criteo/criteo.rb
|
165
165
|
- lib/rack/tracker/criteo/template/criteo.erb
|
166
|
+
- lib/rack/tracker/drift/drift.rb
|
167
|
+
- lib/rack/tracker/drift/template/drift.erb
|
166
168
|
- lib/rack/tracker/extensions.rb
|
167
169
|
- lib/rack/tracker/facebook/README.md
|
168
170
|
- lib/rack/tracker/facebook/facebook.rb
|
@@ -203,6 +205,7 @@ files:
|
|
203
205
|
- spec/fixtures/views/metal/turing.html.erb
|
204
206
|
- spec/handler/bing_spec.rb
|
205
207
|
- spec/handler/criteo_spec.rb
|
208
|
+
- spec/handler/drift_spec.rb
|
206
209
|
- spec/handler/facebook_pixel_spec.rb
|
207
210
|
- spec/handler/facebook_spec.rb
|
208
211
|
- spec/handler/go_squared_spec.rb
|
@@ -217,6 +220,7 @@ files:
|
|
217
220
|
- spec/handler/zanox_spec.rb
|
218
221
|
- spec/integration/bing_integration_spec.rb
|
219
222
|
- spec/integration/criteo_integration_spec.rb
|
223
|
+
- spec/integration/drift_integration_spec.rb
|
220
224
|
- spec/integration/facebook_integration_spec.rb
|
221
225
|
- spec/integration/facebook_pixel_integration_spec.rb
|
222
226
|
- spec/integration/go_squared_integration_spec.rb
|
@@ -271,6 +275,7 @@ test_files:
|
|
271
275
|
- spec/fixtures/views/metal/turing.html.erb
|
272
276
|
- spec/handler/bing_spec.rb
|
273
277
|
- spec/handler/criteo_spec.rb
|
278
|
+
- spec/handler/drift_spec.rb
|
274
279
|
- spec/handler/facebook_pixel_spec.rb
|
275
280
|
- spec/handler/facebook_spec.rb
|
276
281
|
- spec/handler/go_squared_spec.rb
|
@@ -285,6 +290,7 @@ test_files:
|
|
285
290
|
- spec/handler/zanox_spec.rb
|
286
291
|
- spec/integration/bing_integration_spec.rb
|
287
292
|
- spec/integration/criteo_integration_spec.rb
|
293
|
+
- spec/integration/drift_integration_spec.rb
|
288
294
|
- spec/integration/facebook_integration_spec.rb
|
289
295
|
- spec/integration/facebook_pixel_integration_spec.rb
|
290
296
|
- spec/integration/go_squared_integration_spec.rb
|