rack-tracker 0.4.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +2 -2
- data/lib/rack/tracker/google_analytics/template/google_analytics.erb +1 -1
- data/lib/rack/tracker/version.rb +1 -1
- data/lib/rack/tracker/zanox/template/zanox.erb +20 -6
- data/lib/rack/tracker/zanox/zanox.rb +16 -3
- data/spec/handler/google_analytics_spec.rb +2 -2
- data/spec/handler/zanox_spec.rb +6 -6
- data/spec/integration/zanox_integration_spec.rb +6 -5
- data/spec/support/metal_controller.rb +2 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7565da578c5c506a95014ea972db7008e870e034
|
4
|
+
data.tar.gz: 4a735adf525fe516133d7c807472cc338d8b106b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: edae2548f40570b3068c4bcc9323fc869465add3be35d3fe856556a4702af888d1ebec860e9644e1df519b2bcc973d322accddb53bc23b5fc0712ef7d49d0930
|
7
|
+
data.tar.gz: cbfc180230a44535c9d40c48fe82c7f9e4300f68ece15849dacc5789f46f348ccf497da7eaba24173d5d3567247579153ef85b89cb95c206934a1ab53fa97423
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# 1.0.0
|
2
|
+
|
3
|
+
* [BUGFIX] breaking API change: set zanox path extension #45 (thx @berlintam)
|
4
|
+
* [BUGFIX] Fix Google Analytics pageview command arguments #44 (thx @remiprev)
|
5
|
+
|
1
6
|
# 0.4.2
|
2
7
|
|
3
8
|
* [BUGFIX] proper page track when used with turbolink #40 (thx @remiprev @musaffa)
|
data/README.md
CHANGED
@@ -407,7 +407,7 @@ This is an example of a lead event:
|
|
407
407
|
```
|
408
408
|
def show
|
409
409
|
tracker do |t|
|
410
|
-
t.zanox :
|
410
|
+
t.zanox :lead, { order_i_d: 'DEFC-4321' }
|
411
411
|
end
|
412
412
|
end
|
413
413
|
```
|
@@ -417,7 +417,7 @@ This is an example of a sale event:
|
|
417
417
|
```
|
418
418
|
def show
|
419
419
|
tracker do |t|
|
420
|
-
t.zanox :
|
420
|
+
t.zanox :sale, { customer_i_d: '123456', order_i_d: 'DEFC-4321', currency_symbol: 'EUR', total_price: '150.00' }
|
421
421
|
end
|
422
422
|
end
|
423
423
|
```
|
data/lib/rack/tracker/version.rb
CHANGED
@@ -14,13 +14,27 @@
|
|
14
14
|
|
15
15
|
<% end %>
|
16
16
|
|
17
|
-
<% tracking_events.each do |event| %>
|
18
17
|
|
19
|
-
|
20
|
-
|
18
|
+
<% sale_events.each do |event| %>
|
19
|
+
|
20
|
+
<script type="text/javascript" src="https://ad.zanox.com/pps/?<%= options[:account_id] %>&mode=[[1]]&<%= event.write %>">
|
21
|
+
</script>
|
22
|
+
|
23
|
+
<noscript>
|
24
|
+
<img src="https://ad.zanox.com/pps/?<%= options[:account_id] %>&mode=[[2]]&<%= event.write %>" width="1" height="1" />
|
25
|
+
</noscript>
|
26
|
+
|
27
|
+
<% end %>
|
21
28
|
|
22
|
-
|
23
|
-
|
24
|
-
|
29
|
+
|
30
|
+
<% lead_events.each do |event| %>
|
31
|
+
|
32
|
+
<script type="text/javascript" src="https://ad.zanox.com/ppl/?<%= options[:account_id] %>&mode=[[1]]&<%= event.write %>">
|
33
|
+
</script>
|
34
|
+
|
35
|
+
<noscript>
|
36
|
+
<img src="https://ad.zanox.com/ppl/?<%= options[:account_id] %>&mode=[[2]]&<%= event.write %>" width="1" height="1" />
|
37
|
+
</noscript>
|
25
38
|
|
26
39
|
<% end %>
|
40
|
+
|
@@ -5,8 +5,17 @@ class Rack::Tracker::Zanox < Rack::Tracker::Handler
|
|
5
5
|
class Mastertag < OpenStruct
|
6
6
|
end
|
7
7
|
|
8
|
-
class
|
8
|
+
class Lead < OpenStruct
|
9
9
|
# Example: OrderID=[[DEFC-4321]]&CurrencySymbol=[[EUR]]&TotalPrice=[[23.40]]
|
10
|
+
|
11
|
+
def write
|
12
|
+
to_h.map do |k,v|
|
13
|
+
"#{k.to_s.camelize}=[[#{v}]]"
|
14
|
+
end.join('&')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class Sale < OpenStruct
|
10
19
|
def write
|
11
20
|
to_h.map do |k,v|
|
12
21
|
"#{k.to_s.camelize}=[[#{v}]]"
|
@@ -22,8 +31,12 @@ class Rack::Tracker::Zanox < Rack::Tracker::Handler
|
|
22
31
|
events.select{ |event| event.class.to_s.demodulize == 'Mastertag' }.first
|
23
32
|
end
|
24
33
|
|
25
|
-
def
|
26
|
-
events.select{ |event| event.class.to_s.demodulize == '
|
34
|
+
def lead_events
|
35
|
+
events.select{ |event| event.class.to_s.demodulize == 'Lead' }
|
36
|
+
end
|
37
|
+
|
38
|
+
def sale_events
|
39
|
+
events.select{ |event| event.class.to_s.demodulize == 'Sale' }
|
27
40
|
end
|
28
41
|
|
29
42
|
def render
|
@@ -194,7 +194,7 @@ RSpec.describe Rack::Tracker::GoogleAnalytics do
|
|
194
194
|
|
195
195
|
it "will show asyncronous tracker with cookieDomain" do
|
196
196
|
expect(subject).to match(%r{ga\('create', 'somebody', {\"cookieDomain\":\"railslabs.com\"}\)})
|
197
|
-
expect(subject).to match(%r{ga\('send', 'pageview',
|
197
|
+
expect(subject).to match(%r{ga\('send', 'pageview', window\.location\.pathname \+ window\.location\.search\)})
|
198
198
|
end
|
199
199
|
end
|
200
200
|
|
@@ -203,7 +203,7 @@ RSpec.describe Rack::Tracker::GoogleAnalytics do
|
|
203
203
|
|
204
204
|
it "will show asyncronous tracker with userId" do
|
205
205
|
expect(subject).to match(%r{ga\('create', 'somebody', {\"userId\":\"123\"}\)})
|
206
|
-
expect(subject).to match(%r{ga\('send', 'pageview',
|
206
|
+
expect(subject).to match(%r{ga\('send', 'pageview', window\.location\.pathname \+ window\.location\.search\)})
|
207
207
|
end
|
208
208
|
end
|
209
209
|
|
data/spec/handler/zanox_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
RSpec.describe Rack::Tracker::Zanox do
|
2
2
|
|
3
|
-
describe Rack::Tracker::Zanox::
|
3
|
+
describe Rack::Tracker::Zanox::Sale do
|
4
4
|
|
5
5
|
subject { described_class.new(order_i_d: 'DEFC-4321', currency_symbol: 'EUR', total_price: '150.00') }
|
6
6
|
|
@@ -18,7 +18,7 @@ RSpec.describe Rack::Tracker::Zanox do
|
|
18
18
|
expect(described_class.new(env).position).to eq(:body)
|
19
19
|
end
|
20
20
|
|
21
|
-
describe '#render
|
21
|
+
describe '#render #sale_events' do
|
22
22
|
context 'with events' do
|
23
23
|
let(:env) {
|
24
24
|
{
|
@@ -30,7 +30,7 @@ RSpec.describe Rack::Tracker::Zanox do
|
|
30
30
|
'OrderId' => 'DEFC-4321',
|
31
31
|
'CurrencySymbol' => 'EUR',
|
32
32
|
'TotalPrice' => '150.00',
|
33
|
-
'class_name' => '
|
33
|
+
'class_name' => 'Sale',
|
34
34
|
}
|
35
35
|
]
|
36
36
|
}
|
@@ -41,12 +41,12 @@ RSpec.describe Rack::Tracker::Zanox do
|
|
41
41
|
let(:options) { { account_id: '123456H123456' } }
|
42
42
|
|
43
43
|
it 'will display the correct tracking events' do
|
44
|
-
expect(subject).to include "https://ad.zanox.com/
|
44
|
+
expect(subject).to include "https://ad.zanox.com/pps/?123456H123456&mode=[[1]]&CustomerID=[[123456]]&OrderId=[[DEFC-4321]]&CurrencySymbol=[[EUR]]&TotalPrice=[[150.00]]"
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
describe '#render
|
49
|
+
describe '#render #lead_events' do
|
50
50
|
context 'with events' do
|
51
51
|
let(:env) {
|
52
52
|
{
|
@@ -55,7 +55,7 @@ RSpec.describe Rack::Tracker::Zanox do
|
|
55
55
|
[
|
56
56
|
{
|
57
57
|
'OrderId' => 'DEFC-4321',
|
58
|
-
'class_name' => '
|
58
|
+
'class_name' => 'Lead'
|
59
59
|
}
|
60
60
|
]
|
61
61
|
}
|
@@ -16,10 +16,11 @@ RSpec.describe "Zanox Integration" do
|
|
16
16
|
expect(page.find("body")).to have_content "window._zx.push({\"id\": \"blurg567\"});"
|
17
17
|
end
|
18
18
|
|
19
|
-
it 'should include the
|
20
|
-
expect(page).to have_xpath "//script[contains(@src,'12345H123456789&mode=[[1]]&CustomerID=[[123456]]&OrderID=[[DEFC-4321]]&CurrencySymbol=[[EUR]]&TotalPrice=[[150.00]]')]"
|
19
|
+
it 'should include the sale event' do
|
20
|
+
expect(page).to have_xpath "//script[contains(@src,'pps/?12345H123456789&mode=[[1]]&CustomerID=[[123456]]&OrderID=[[DEFC-4321]]&CurrencySymbol=[[EUR]]&TotalPrice=[[150.00]]')]"
|
21
21
|
end
|
22
|
-
end
|
23
|
-
|
24
|
-
|
25
22
|
|
23
|
+
it 'should include the lead event' do
|
24
|
+
expect(page).to have_xpath "//script[contains(@src,'ppl/?12345H123456789&mode=[[1]]&CustomerID=[[654321]]')]"
|
25
|
+
end
|
26
|
+
end
|
@@ -78,7 +78,8 @@ class MetalController < ActionController::Metal
|
|
78
78
|
def zanox
|
79
79
|
tracker do |t|
|
80
80
|
t.zanox :mastertag, { id: 'blurg567'}
|
81
|
-
t.zanox :
|
81
|
+
t.zanox :sale, { customer_i_d: '123456', order_i_d: 'DEFC-4321', currency_symbol: 'EUR', total_price: '150.00' }
|
82
|
+
t.zanox :lead, { customer_i_d: '654321' }
|
82
83
|
end
|
83
84
|
render 'metal/index'
|
84
85
|
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.
|
4
|
+
version: 1.0.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: 2015-
|
12
|
+
date: 2015-07-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
@@ -228,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
228
228
|
version: '0'
|
229
229
|
requirements: []
|
230
230
|
rubyforge_project:
|
231
|
-
rubygems_version: 2.
|
231
|
+
rubygems_version: 2.2.2
|
232
232
|
signing_key:
|
233
233
|
specification_version: 4
|
234
234
|
summary: Tracking made easy
|