analytics_instrumentation 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f74834b46e9fb5f60bd56989cf5d0afc529a2a9c
4
- data.tar.gz: db452554d8957a30f7595051623fccf9042b2b3c
3
+ metadata.gz: a2153b9c13c4a12c4f9109c5693ff93d9eaa93a3
4
+ data.tar.gz: 1aba06ff204ae0a490ed954bf447bff1fe282dd3
5
5
  SHA512:
6
- metadata.gz: 1f0e39f74651a8131f8ead84856a952a3873feed8356251cee9449a11e1f6ac4752f3ceba7d32fdb1ba2020bb13592d7b8fc29d024ad67b8cd3016179442aafc
7
- data.tar.gz: 5903a8d3bb60482493251d0d057356d7ee8435b2b7b178b28216c266d0f58ba1d0dacc98db5b42f4fb590cfdf2906892c2f89ed50035a50a91c6e5b08480d80a
6
+ metadata.gz: d9243c70c77838a29109126e239682a1266c683a7507134fc7baabac98c924d0cac050d43aa32000b93977cc276813ea858965c4a092da29cc00ee4b769cab89
7
+ data.tar.gz: 3a2cb4247846e20d47d06a2211af12f9387489f219e42113d94681cfa12bf261805851d37cfd11fa0c0c1497525b4eea89c76ccec2c226c3355902c9076e62f9
@@ -51,11 +51,8 @@ module AnalyticsInstrumentation
51
51
  session[:last_seen_logged_out] = Time.now
52
52
  end
53
53
  rescue => e
54
- puts "FOUND ERROR #{e.inspect}"
55
- puts caller
56
- puts @@config.inspect
57
- puts @@config.error_handler.inspect
58
- @@config.error_handler(e, "Analytics Check Session Crash: #{request.filtered_path}")
54
+ logger.debug "Errpr found in analyticsCheckSessionStart: #{e.inspect}"
55
+ @@config.error_handler.call(e, "Analytics Check Session Crash: #{request.filtered_path}")
59
56
  end
60
57
  end
61
58
 
@@ -81,7 +78,8 @@ module AnalyticsInstrumentation
81
78
  properties.merge! analyticsSuperProperties
82
79
  analyticsTrackEvent "Page View", properties
83
80
  rescue => e
84
- @@config.error_handler(e, "Analytics Crash: #{request.filtered_path}")
81
+ logger.debug "Errpr found in analyticsLogPageView: #{e.inspect}"
82
+ @@config.error_handler.call(e, "Analytics Crash: #{request.filtered_path}")
85
83
  end
86
84
  end
87
85
 
@@ -113,9 +111,11 @@ module AnalyticsInstrumentation
113
111
  def analyticsSetPerson(user)
114
112
  return if skip_analytics?
115
113
 
114
+ user_traits = instance_exec(user, &@@config.custom_user_traits)
115
+
116
116
  properties = {
117
117
  user_id: user.id,
118
- traits: @@config.custom_user_traits(user)
118
+ traits: (user_traits||{})
119
119
  }
120
120
 
121
121
  logger.debug "Analytics.identify #{JSON.pretty_generate(properties)}"
@@ -148,7 +148,10 @@ module AnalyticsInstrumentation
148
148
  properties["source"] = params[:source] if params[:source]
149
149
 
150
150
  properties.merge! analyticsSuperProperties
151
- properties.merge! @@config.extra_event_properties
151
+
152
+ # User defined extra props, called in context
153
+ extra_props = instance_exec(&@@config.extra_event_properties)
154
+ properties.merge! (extra_props || {})
152
155
 
153
156
  analyticsApplyOriginatingPage properties
154
157
 
@@ -20,7 +20,7 @@ class AnalyticsMapping
20
20
 
21
21
  replaceAllTokens(analysis, params, view_assigns)
22
22
 
23
- analysis
23
+ HashWithIndifferentAccess.new(analysis)
24
24
  end
25
25
 
26
26
  def self.replaceAllTokens(obj, params, view_assigns)
@@ -31,14 +31,6 @@ module AnalyticsInstrumentation
31
31
  self.error_handler = Proc.new { |e, msg=""| raise }
32
32
  end
33
33
 
34
- def custom_user_traits(user)
35
- self.custom_user_traits(user) || {}
36
- end
37
-
38
- def extra_event_properties
39
- self.extra_event_properties() || {}
40
- end
41
-
42
34
  def intercom?
43
35
  Intercom rescue false
44
36
  end
@@ -1,3 +1,3 @@
1
1
  module AnalyticsInstrumentation
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: analytics_instrumentation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Feldstein
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-03-30 00:00:00.000000000 Z
12
+ date: 2015-03-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails