rack-tracker 1.9.0 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36432546f568d8bd4224d5009397e5dbaa6481977b605c7faaa4248caa527a0c
4
- data.tar.gz: 54aa497e17eda29100f863958db67dc9a8a68331f580719d2c425e4cf8325341
3
+ metadata.gz: 3a933eccd9730dfd27db81c2f732ea830762451307897776f8063d7ea7fad50e
4
+ data.tar.gz: '0930fcfb478012d19570598db7b8931a25c81bbb4f2d1019c694c8a7c9a0da08'
5
5
  SHA512:
6
- metadata.gz: b1eb4c67eeddaae64d5f539d2d276fdb19e5bfded706e5e0156f68ab3edb4a1bcb159fdb959bba69f0480c7068397d7a2bb38f1e9476c6a98670199eacbccc0e
7
- data.tar.gz: a927f10a586c038598836ed80528ee3ecc7d122dfb22d63b43a5c88dff06cb98b6472dd0eb7fea7affe2a8a89a1b1eed9802b5294e83efe150b92c0eca430e31
6
+ metadata.gz: beb180ef84c7a6c76ad1ed38a7815cdd51c20022d07de6b48779d052b9ce8f6b8431f49d73e74289113cf459d5b1c8c54c159dcee5d9c79b9b8bb0e7378c53a6
7
+ data.tar.gz: c78cc4ae1977fbb49cc09a6f673941ed7905fc522fb8f3e7538fcd5e2d8bc2fdd0993d61dcaec338a1a553e1cc723c882ab18d948fdce667142e0bb09816eb81
@@ -1,3 +1,7 @@
1
+ # 1.10.0
2
+
3
+ * [ENHANCEMENT] Hubspot integration #136 (thx @ChrisCoffey)
4
+
1
5
  # 1.9.0
2
6
 
3
7
  * [ENHANCEMENT] Integration for Bing tracking #131 (thx @pcraston)
data/README.md CHANGED
@@ -18,18 +18,9 @@ rack middleware that can be hooked up to multiple services and exposing them in
18
18
  fashion. It comes in two parts, the first one is the actual middleware that you can add
19
19
  to the middleware stack the second part are the service-handlers that you're going to use
20
20
  in your application. It's easy to add your own [custom handlers](#custom-handlers),
21
- but to get you started we're shipping support for the following services out of the box:
22
-
23
- * [Google Global Site Tag](#google-global)
24
- * [Google Analytics](#google-analytics)
25
- * [Google Adwords Conversion](#google-adwords-conversion)
26
- * [Google Tag Manager](#google-tag-manager)
27
- * [Facebook](#facebook)
28
- * [Visual Website Optimizer (VWO)](#visual-website-optimizer-vwo)
29
- * [GoSquared](#gosquared)
30
- * [Criteo](#criteo)
31
- * [Zanox](#zanox)
32
- * [Hotjar](#hotjar)
21
+ but to get you started we're shipping support for the services [mentioned below](#services)
22
+ out of the box:
23
+
33
24
 
34
25
  ## Respecting the Do Not Track (DNT) HTTP header
35
26
 
@@ -112,6 +103,8 @@ request.env['tracker'] = {
112
103
  }
113
104
  ```
114
105
 
106
+ ## Services
107
+
115
108
  ### Google Global Site Tag (gtag.js)
116
109
 
117
110
  * `:anonymize_ip` - sets the tracker to remove the last octet from all IP addresses, see https://developers.google.com/analytics/devguides/collection/gtagjs/ip-anonymization for details.
@@ -601,6 +594,16 @@ tracker do |t|
601
594
  end
602
595
  ```
603
596
 
597
+ ### Hubspot
598
+
599
+ [Hubspot](https://www.hubspot.com/)
600
+
601
+ ```
602
+ config.middleware.use(Rack::Tracker) do
603
+ handler :hubspot, { site_id: '1234' }
604
+ end
605
+ ```
606
+
604
607
 
605
608
  ### Custom Handlers
606
609
 
@@ -24,6 +24,7 @@ require "rack/tracker/criteo/criteo"
24
24
  require "rack/tracker/zanox/zanox"
25
25
  require "rack/tracker/hotjar/hotjar"
26
26
  require "rack/tracker/bing/bing"
27
+ require "rack/tracker/hubspot/hubspot"
27
28
 
28
29
  module Rack
29
30
  class Tracker
@@ -0,0 +1,2 @@
1
+ class Rack::Tracker::Hubspot < Rack::Tracker::Handler
2
+ end
@@ -0,0 +1 @@
1
+ <script type="text/javascript" id="hs-script-loader" async defer src="//js.hs-scripts.com/<%= options[:site_id] %>.js"></script>
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  class Tracker
3
- VERSION = '1.9.0'
3
+ VERSION = '1.10.0'
4
4
  end
5
5
  end
@@ -0,0 +1,11 @@
1
+ RSpec.describe Rack::Tracker::Hubspot do
2
+
3
+ def env
4
+ { misc: '42' }
5
+ end
6
+
7
+ it 'will be placed in the head' do
8
+ expect(described_class.position).to eq(:head)
9
+ expect(described_class.new(env).position).to eq(:head)
10
+ end
11
+ end
@@ -0,0 +1,19 @@
1
+ require 'support/capybara_app_helper'
2
+
3
+ RSpec.describe "Hubspot Integration" do
4
+ before do
5
+ setup_app(action: :hubspot) do |tracker|
6
+ tracker.handler :hubspot, { site_id: '123456' }
7
+ end
8
+
9
+ visit '/'
10
+ end
11
+
12
+
13
+ subject { page }
14
+
15
+ it "embeds the site-specifc script tag" do
16
+ expect(page).to have_xpath("//script", id: "hs-script-loader" )
17
+ expect(page.find("script")[:src]).to eq("//js.hs-scripts.com/123456.js")
18
+ end
19
+ end
@@ -117,6 +117,10 @@ class MetalController < ActionController::Metal
117
117
  render "metal/index"
118
118
  end
119
119
 
120
+ def hubspot
121
+ render "metal/index"
122
+ end
123
+
120
124
  def bing
121
125
  render "metal/index"
122
126
  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.9.0
4
+ version: 1.10.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-03-28 00:00:00.000000000 Z
12
+ date: 2019-06-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
@@ -184,6 +184,8 @@ files:
184
184
  - lib/rack/tracker/handler_delegator.rb
185
185
  - lib/rack/tracker/hotjar/hotjar.rb
186
186
  - lib/rack/tracker/hotjar/template/hotjar.erb
187
+ - lib/rack/tracker/hubspot/hubspot.rb
188
+ - lib/rack/tracker/hubspot/template/hubspot.erb
187
189
  - lib/rack/tracker/javascript_helper.rb
188
190
  - lib/rack/tracker/railtie.rb
189
191
  - lib/rack/tracker/version.rb
@@ -210,6 +212,7 @@ files:
210
212
  - spec/handler/google_tag_manager_spec.rb
211
213
  - spec/handler/handler_spec.rb
212
214
  - spec/handler/hotjar_spec.rb
215
+ - spec/handler/hubspot_spec.rb
213
216
  - spec/handler/vwo_spec.rb
214
217
  - spec/handler/zanox_spec.rb
215
218
  - spec/integration/bing_integration_spec.rb
@@ -222,6 +225,7 @@ files:
222
225
  - spec/integration/google_global_integration_spec.rb
223
226
  - spec/integration/google_tag_manager_integration_spec.rb
224
227
  - spec/integration/hotjar_integration_spec.rb
228
+ - spec/integration/hubspot_integration_spec.rb
225
229
  - spec/integration/rails_integration_spec.rb
226
230
  - spec/integration/vwo_integration_spec.rb
227
231
  - spec/integration/zanox_integration_spec.rb
@@ -276,6 +280,7 @@ test_files:
276
280
  - spec/handler/google_tag_manager_spec.rb
277
281
  - spec/handler/handler_spec.rb
278
282
  - spec/handler/hotjar_spec.rb
283
+ - spec/handler/hubspot_spec.rb
279
284
  - spec/handler/vwo_spec.rb
280
285
  - spec/handler/zanox_spec.rb
281
286
  - spec/integration/bing_integration_spec.rb
@@ -288,6 +293,7 @@ test_files:
288
293
  - spec/integration/google_global_integration_spec.rb
289
294
  - spec/integration/google_tag_manager_integration_spec.rb
290
295
  - spec/integration/hotjar_integration_spec.rb
296
+ - spec/integration/hubspot_integration_spec.rb
291
297
  - spec/integration/rails_integration_spec.rb
292
298
  - spec/integration/vwo_integration_spec.rb
293
299
  - spec/integration/zanox_integration_spec.rb