gabba 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/Readme.md +2 -2
- data/lib/gabba/gabba.rb +2 -2
- data/lib/gabba/version.rb +1 -1
- data/spec/gabba_spec.rb +2 -2
- metadata +3 -3
data/Gemfile.lock
CHANGED
data/Readme.md
CHANGED
@@ -33,7 +33,7 @@ gabba.page_view("something", "track/me")
|
|
33
33
|
### Setting custom vars
|
34
34
|
|
35
35
|
```ruby
|
36
|
-
# Index: 1 through
|
36
|
+
# Index: 1 through 50
|
37
37
|
index = 1
|
38
38
|
|
39
39
|
# Scope: VISITOR, SESSION or PAGE
|
@@ -52,7 +52,7 @@ gabba.page_view(...)
|
|
52
52
|
### Removing custom vars
|
53
53
|
|
54
54
|
```ruby
|
55
|
-
# Index: 1 through
|
55
|
+
# Index: 1 through 50
|
56
56
|
index = 1
|
57
57
|
|
58
58
|
# Delete var with this index
|
data/lib/gabba/gabba.rb
CHANGED
@@ -53,7 +53,7 @@ module Gabba
|
|
53
53
|
# Public: Set a custom variable to be passed along and logged by Google Analytics
|
54
54
|
# (http://code.google.com/apis/analytics/docs/tracking/gaTrackingCustomVariables.html)
|
55
55
|
#
|
56
|
-
# index - Integer between 1 and
|
56
|
+
# index - Integer between 1 and 50 for this custom variable (limit is 5 normally, but is 50 for GA Premium)
|
57
57
|
# name - String with the name of the custom variable
|
58
58
|
# value - String with the value for teh custom variable
|
59
59
|
# scope - Integer with custom variable scope must be 1 (VISITOR), 2 (SESSION) or 3 (PAGE)
|
@@ -66,7 +66,7 @@ module Gabba
|
|
66
66
|
#
|
67
67
|
# Returns array with the custom variable data
|
68
68
|
def set_custom_var(index, name, value, scope)
|
69
|
-
raise "Index must be between 1 and
|
69
|
+
raise "Index must be between 1 and 50" unless (1..50).include?(index)
|
70
70
|
raise "Scope must be 1 (VISITOR), 2 (SESSION) or 3 (PAGE)" unless (1..3).include?(scope)
|
71
71
|
|
72
72
|
@custom_vars[index] = [ name, value, scope ]
|
data/lib/gabba/version.rb
CHANGED
data/spec/gabba_spec.rb
CHANGED
@@ -160,9 +160,9 @@ describe Gabba::Gabba do
|
|
160
160
|
@gabba.custom_var_data.must_equal "8(2!A*4!D)9(2!Y*4!N)11(2!2*4!1)"
|
161
161
|
end
|
162
162
|
|
163
|
-
it "must raise an error if index is outside the 1-
|
163
|
+
it "must raise an error if index is outside the 1-50 (incl) range" do
|
164
164
|
lambda { @gabba.set_custom_var(0, 'A', 'B', 1) }.must_raise(RuntimeError)
|
165
|
-
lambda { @gabba.set_custom_var(
|
165
|
+
lambda { @gabba.set_custom_var(51, 'A', 'B', 1) }.must_raise(RuntimeError)
|
166
166
|
end
|
167
167
|
|
168
168
|
it "must raise an error if scope is outside the 1-3 (incl) range" do
|
metadata
CHANGED