gabbara 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/gabbara/gabba.rb +5 -2
- data/lib/gabbara/version.rb +1 -1
- data/spec/gabba_spec.rb +34 -1
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/lib/gabbara/gabba.rb
CHANGED
@@ -83,8 +83,11 @@ module Gabbara
|
|
83
83
|
end
|
84
84
|
|
85
85
|
def event_data(category, action, label = nil, value = nil)
|
86
|
-
|
87
|
-
|
86
|
+
"5(#{category}*action".tap do |data|
|
87
|
+
data << "*#{label}" if label
|
88
|
+
data << ")"
|
89
|
+
data << "(#{value})" if value
|
90
|
+
end
|
88
91
|
end
|
89
92
|
|
90
93
|
# create magical cookie params used by GA for its own nefarious purposes
|
data/lib/gabbara/version.rb
CHANGED
data/spec/gabba_spec.rb
CHANGED
@@ -50,7 +50,40 @@ describe Gabbara::Gabba do
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
describe "when tracking custom events" do
|
53
|
+
describe "when tracking custom events with two params" do
|
54
|
+
before do
|
55
|
+
stub_analytics "utme"=>"5(cat1*action)", "utmt"=>"event"
|
56
|
+
@gabba = Gabbara::Gabba.new("UC-123", "domain", :utmn => "1009731272", :utmcc => '')
|
57
|
+
end
|
58
|
+
|
59
|
+
it "must do a request to google" do
|
60
|
+
@gabba.event("cat1", "act1", :utmhid => "6783939397")
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe "when tracking custom events with label without value" do
|
65
|
+
before do
|
66
|
+
stub_analytics "utme"=>"5(cat1*action*lab1)", "utmt"=>"event"
|
67
|
+
@gabba = Gabbara::Gabba.new("UC-123", "domain", :utmn => "1009731272", :utmcc => '')
|
68
|
+
end
|
69
|
+
|
70
|
+
it "must do a request to google" do
|
71
|
+
@gabba.event("cat1", "act1", "lab1", :utmhid => "6783939397")
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe "when tracking custom events with value without label" do
|
76
|
+
before do
|
77
|
+
stub_analytics "utme"=>"5(cat1*action)(val1)", "utmt"=>"event"
|
78
|
+
@gabba = Gabbara::Gabba.new("UC-123", "domain", :utmn => "1009731272", :utmcc => '')
|
79
|
+
end
|
80
|
+
|
81
|
+
it "must do a request to google" do
|
82
|
+
@gabba.event("cat1", "act1", nil, "val1", :utmhid => "6783939397")
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
describe "when tracking custom events with all params" do
|
54
87
|
before do
|
55
88
|
stub_analytics "utme"=>"5(cat1*action*lab1)(val1)", "utmt"=>"event"
|
56
89
|
@gabba = Gabbara::Gabba.new("UC-123", "domain", :utmn => "1009731272", :utmcc => '')
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gabbara
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael Reinsch
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-12-
|
19
|
+
date: 2010-12-27 00:00:00 +09:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|