Skip to content

Commit 6f035ee

Browse files
committed
Added array argument
1 parent 1db92d8 commit 6f035ee

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

Readme.mdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ See [Google Analytics Tracking Methods](https://developers.google.com/analytics/
5656
tracker_methods = {
5757
:setDomainName => "example.com", # String argument
5858
:setAllowLinker => true, # Boolean argument
59+
:require => ['inpage_linkid', '//www.google-analytics.com/plugins/ga/inpage_linkid.js'] # Array argument (will be splattered)
5960
:clearOrganic => "" # No argument
6061
}
6162
```

lib/split/analytics.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ def insert_tracker_methods(tracker_methods)
5959
when FalseClass
6060
# Boolean argument tracker method
6161
arr << "_gaq.push(['" + "_" + "#{k}', #{v}]);"
62+
when Array
63+
# Array argument tracker method
64+
values = v.map { |value| "'#{value}'" }.join(', ')
65+
arr << "_gaq.push(['" + "_" + "#{k}', #{values}]);"
6266
end
6367
end
6468
end

0 commit comments

Comments
 (0)