isc_analytics 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/isc_analytics/client_api.rb +9 -5
- metadata +2 -2
@@ -7,7 +7,7 @@ module IscAnalytics
|
|
7
7
|
if properties.blank?
|
8
8
|
enqueue 'identify', identifier
|
9
9
|
else
|
10
|
-
enqueue 'identify', identifier, properties
|
10
|
+
enqueue 'identify', identifier, escape_properties(properties)
|
11
11
|
end
|
12
12
|
set_identity(identifier)
|
13
13
|
end
|
@@ -21,19 +21,19 @@ module IscAnalytics
|
|
21
21
|
def track_event(name, properties = {})
|
22
22
|
unless name.blank?
|
23
23
|
if properties.blank?
|
24
|
-
enqueue 'trackEvent', name
|
24
|
+
enqueue 'trackEvent', CGI::escapeHTML(name)
|
25
25
|
else
|
26
|
-
enqueue 'trackEvent', name, properties
|
26
|
+
enqueue 'trackEvent', CGI::escapeHTML(name), escape_properties(properties)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
31
|
def set_properties(properties = {})
|
32
|
-
enqueue('setProperties', properties) unless properties.blank?
|
32
|
+
enqueue('setProperties', escape_properties(properties)) unless properties.blank?
|
33
33
|
end
|
34
34
|
|
35
35
|
def set_property(property, value = nil)
|
36
|
-
enqueue('setProperty', property, value) unless property.blank?
|
36
|
+
enqueue('setProperty', CGI::escapeHTML(property), value ? CGI::escapeHTML(value) : value) unless property.blank?
|
37
37
|
end
|
38
38
|
|
39
39
|
# reset_queue makes sure that subsequent calls will not send events that have already been sent.
|
@@ -91,5 +91,9 @@ module IscAnalytics
|
|
91
91
|
queue.delete_if { |api_call| !(/identify/ =~ api_call).nil? }
|
92
92
|
end
|
93
93
|
|
94
|
+
def escape_properties(properties)
|
95
|
+
Hash[properties.map{ |k, v| [(k.kind_of?(String) ? CGI::escapeHTML(k) : k), (v.kind_of?(String) ? CGI::escapeHTML(v) : v)] }]
|
96
|
+
end
|
97
|
+
|
94
98
|
end
|
95
99
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isc_analytics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-08-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: controller_support
|