Permalink
Browse files

Fix #14 by increasing limit to 50 for custom variables

  • Loading branch information...
1 parent 2592d60 commit 30a8553b9e7558c3129f07859c82c0303ba88e49 @deadprogram deadprogram committed Oct 20, 2012
Showing with 6 additions and 6 deletions.
  1. +2 −2 Readme.md
  2. +2 −2 lib/gabba/gabba.rb
  3. +2 −2 spec/gabba_spec.rb
View
@@ -33,7 +33,7 @@ gabba.page_view("something", "track/me")
### Setting custom vars
```ruby
-# Index: 1 through 5
+# Index: 1 through 50
index = 1
# Scope: VISITOR, SESSION or PAGE
@@ -52,7 +52,7 @@ gabba.page_view(...)
### Removing custom vars
```ruby
-# Index: 1 through 5
+# Index: 1 through 50
index = 1
# Delete var with this index
View
@@ -53,7 +53,7 @@ def initialize(ga_acct, domain, agent = Gabba::USER_AGENT)
# Public: Set a custom variable to be passed along and logged by Google Analytics
# (http://code.google.com/apis/analytics/docs/tracking/gaTrackingCustomVariables.html)
#
- # index - Integer between 1 and 5 for this custom variable
+ # index - Integer between 1 and 50 for this custom variable (limit is 5 normally, but is 50 for GA Premium)
# name - String with the name of the custom variable
# value - String with the value for teh custom variable
# scope - Integer with custom variable scope must be 1 (VISITOR), 2 (SESSION) or 3 (PAGE)
@@ -66,7 +66,7 @@ def initialize(ga_acct, domain, agent = Gabba::USER_AGENT)
#
# Returns array with the custom variable data
def set_custom_var(index, name, value, scope)
- raise "Index must be between 1 and 5" unless (1..5).include?(index)
+ raise "Index must be between 1 and 50" unless (1..50).include?(index)
raise "Scope must be 1 (VISITOR), 2 (SESSION) or 3 (PAGE)" unless (1..3).include?(scope)
@custom_vars[index] = [ name, value, scope ]
View
@@ -160,9 +160,9 @@
@gabba.custom_var_data.must_equal "8(2!A*4!D)9(2!Y*4!N)11(2!2*4!1)"
end
- it "must raise an error if index is outside the 1-5 (incl) range" do
+ it "must raise an error if index is outside the 1-50 (incl) range" do
lambda { @gabba.set_custom_var(0, 'A', 'B', 1) }.must_raise(RuntimeError)
- lambda { @gabba.set_custom_var(6, 'A', 'B', 1) }.must_raise(RuntimeError)
+ lambda { @gabba.set_custom_var(51, 'A', 'B', 1) }.must_raise(RuntimeError)
end
it "must raise an error if scope is outside the 1-3 (incl) range" do

0 comments on commit 30a8553

Please sign in to comment.