rack-tracker 0.2.0 → 0.2.1

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
  SHA1:
3
- metadata.gz: 0e83bc3662d5297183050ac1210f0707773bcc3c
4
- data.tar.gz: b1dc4f2fee0a5965559641a347562ccdb07c9da3
3
+ metadata.gz: 82d324245976135563761ec9eee0703f7557d0a2
4
+ data.tar.gz: dc0b22a2e177d364b14f9b2a178d97270aee2552
5
5
  SHA512:
6
- metadata.gz: 3d0fe52d68d0e7109d2b2bd420179f2ce9973661c2159d15cf302e63b3e008f807a4a6fbb1da23cf1c4e4009e3a1b6be8a37fb9293cb35999444fec4b7182aa1
7
- data.tar.gz: 0f6e8f2d08eab9e53716bb19813e40120cc3b6d34f7b621c9f2bb27d004ad6b3b97c9920b0424ea4a9abbc4f7fa0d78933dc3b91a13c4a25ff7948d2de4f01ba
6
+ metadata.gz: 80ff2c12422960b315df641d81ed22ec2e48276942535f87f450c1cbf68b26be6dfd5a37d43d06e3464e9b4f295e570ad1ab09d48d9ff093439910d2f23cd1ec
7
+ data.tar.gz: 1453d60608ee4fa30e010489eef22c1704bb1bbe6a40c0289c6bafb897e7b16245c06cef80ad2fda0dada817ea9f92314d34be1f398a61963a6d03feeef62a91
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
+ # 0.2.1
2
+
3
+ * [BUGFIX] sending the ecommerce cart was misspelled
4
+
1
5
  # 0.2.0
2
6
 
3
7
  * added support for GoSquared
8
+ * added support for Visual Website Optimizer
4
9
 
5
10
  # 0.1.3
6
11
 
data/README.md CHANGED
@@ -17,8 +17,14 @@ an easy interface to drop in new services. This is why we created `rack-tracker`
17
17
  rack middleware that can be hooked up to multiple services and exposing them in a unified
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
- in your application. We're shipping support for Google and Facebook, to add your own please
21
- read about [custom handlers](#custom-handlers).
20
+ in your application. It's easy to add your own [custom handlers](#custom-handlers),
21
+ but to get you startet we're shipping support for the following services out of the box:
22
+
23
+ * [Google Analytics](#google-analytics)
24
+ * [Facebook](#facebook)
25
+ * [Visual Website Optimizer (VWO)](#visual-website-optimizer-vwo)
26
+ * [GoSquared](#gosquared)
27
+
22
28
 
23
29
  ## Installation
24
30
 
@@ -44,9 +50,7 @@ config.middleware.use(Rack::Tracker) do
44
50
  end
45
51
  ````
46
52
 
47
- This will add Google Analytics as a tracking handler. `Rack::Tracker` some with
48
- support for Google Analytics and Facebook. Others might be added in the future
49
- but you can easily write your own handlers.
53
+ This will add Google Analytics as a tracking handler.
50
54
 
51
55
  ### Google Analytics
52
56
 
@@ -218,10 +222,10 @@ It will render the following to the site source:
218
222
 
219
223
  ### Custom Handlers
220
224
 
221
- Tough we give you Google Analytics and Facebook right out of the box, you might
225
+ Tough we give you handlers for a few tracking services right out of the box, you might
222
226
  be interested adding support for your custom tracking/analytics service.
223
227
 
224
- Writing a handler is straight forward ;) There are just a couple of methods that
228
+ Writing a handler is straight forward ;) and there are just a couple of methods that
225
229
  your class needs to implement.
226
230
 
227
231
  Start with a plain ruby class that inherits from `Rack::Tracker::Handler`
@@ -242,7 +246,7 @@ end
242
246
  ```
243
247
 
244
248
  This will render the `template/my_handler.erb` and inject the result into the source. You
245
- can be creative about where the template is stored, we tend to have them around
249
+ can be creative about where the template is stored, but we tend to have them around
246
250
  our actual handler code.
247
251
 
248
252
  ```erb
@@ -275,9 +279,27 @@ end
275
279
 
276
280
  The snippit will then be rendered right before `</body>`.
277
281
 
282
+ To enable the *tracker dsl* functionality in your controllers
283
+ you need to implement the `track` class method on your handler:
284
+
285
+ ```ruby
286
+ def self.track(name, *event)
287
+ # do something with the event(s) to prepare them for your template
288
+ # and return a hash with a signature like { name => event }
289
+ end
290
+ ```
291
+
292
+ Checkout the existing handlers in `lib/rack/tracker` for some inspiration. :)
293
+
278
294
 
279
295
  ## Contributing
280
296
 
297
+ First of all, **thank** you for your help! :green_heart:
298
+
299
+ If you want a feature implemented, the best way to get it done
300
+ is to submit a pull request that implements it.
301
+ Tests, readme and changelog entries would be nice.
302
+
281
303
  1. Fork it ( http://github.com/railslove/rack-tracker/fork )
282
304
  2. Create your feature branch (`git checkout -b my-new-feature`)
283
305
  3. Commit your changes (`git commit -am 'Add some feature'`)
@@ -37,7 +37,7 @@
37
37
  <% end %>
38
38
 
39
39
  <% if options[:ecommerce] && ecommerce_events.any? %>
40
- ga('send:ecommerce');
40
+ ga('ecommerce:send');
41
41
  <% end %>
42
42
 
43
43
  <% if tracker %>
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  class Tracker
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
@@ -64,17 +64,21 @@ RSpec.describe Rack::Tracker::GoogleAnalytics do
64
64
  def env
65
65
  {'tracker' => {
66
66
  'google_analytics' => [
67
- Rack::Tracker::GoogleAnalytics::Ecommerce.new({type: 'addItem', id: '1234', affiliation: 'Acme Clothing', revenue: 11.99, shipping: '5', tax: '1.29', currency: 'EUR'})
67
+ Rack::Tracker::GoogleAnalytics::Ecommerce.new({type: 'addItem', id: '1234', name: 'Fluffy Pink Bunnies', sku: 'DD23444', category: 'Party Toys', price: '11.99', quantity: '1'}),
68
+ Rack::Tracker::GoogleAnalytics::Ecommerce.new({type: 'addTransaction', id: '1234', affiliation: 'Acme Clothing', revenue: 11.99, shipping: '5', tax: '1.29', currency: 'EUR'})
68
69
  ]
69
70
  }}
70
71
  end
71
72
 
72
73
  subject { described_class.new(env, tracker: 'somebody', ecommerce: true).render }
73
74
  it "will add items" do
74
- expect(subject).to match(%r{ga\(\"ecommerce:addItem\",#{{id: '1234', affiliation: 'Acme Clothing', revenue: 11.99, shipping: '5', tax: '1.29', currency: 'EUR'}.to_json}})
75
+ expect(subject).to match(%r{ga\(\"ecommerce:addItem\",#{{id: '1234', name: 'Fluffy Pink Bunnies', sku: 'DD23444', category: 'Party Toys', price: '11.99', quantity: '1'}.to_json}})
76
+ end
77
+ it "will add transaction" do
78
+ expect(subject).to match(%r{ga\(\"ecommerce:addTransaction\",#{{id: '1234', affiliation: 'Acme Clothing', revenue: 11.99, shipping: '5', tax: '1.29', currency: 'EUR'}.to_json}})
75
79
  end
76
80
  it "will submit cart" do
77
- expect(subject).to match(%r{ga\('send:ecommerce'\);})
81
+ expect(subject).to match(%r{ga\('ecommerce:send'\);})
78
82
  end
79
83
  end
80
84
  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: 0.2.0
4
+ version: 0.2.1
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: 2014-09-11 00:00:00.000000000 Z
12
+ date: 2014-09-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack