analytics_instrumentation 0.2.2 → 0.2.3
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 +4 -4
- data/README.rdoc +3 -0
- data/lib/analytics_instrumentation.rb +5 -3
- data/lib/analytics_instrumentation/config.rb +5 -3
- data/lib/analytics_instrumentation/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a49cdda4f334338025192fb0f21028076c244f56
|
4
|
+
data.tar.gz: b3fa86e90b125b0a6247a2e727ac98698cc668ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d8b4cfa3059750962ec84826706893acf11a487e144a32795c55ef482573f24c1d8c4d7bcbadc66358db9681f90e199ba88c01f35e0a623a8458af79a28f11a
|
7
|
+
data.tar.gz: 49a44cc033c37a32fc508e69c2a5e165657c0a905a6a32fae031568a02d8cecf1b2b83a6a5d048c222e40f2285479b4831a4c442803cb07de0a61484832645ff
|
data/README.rdoc
CHANGED
@@ -33,6 +33,9 @@ The behaviors exposed are:
|
|
33
33
|
# Your Segment.io write key is required. We will instantiate the client.
|
34
34
|
config.segment_write_key = ENV["SEGMENT_API_KEY"] || ""
|
35
35
|
|
36
|
+
# # Track "Page View" events for ajax requests? (Default = false)
|
37
|
+
# config.track_ajax_as_page_view = true
|
38
|
+
|
36
39
|
# Define a hash of traits to be passed to `#identify()` calls for each user.
|
37
40
|
config.custom_user_traits = Proc.new { |user|
|
38
41
|
{
|
@@ -71,7 +71,6 @@ module AnalyticsInstrumentation
|
|
71
71
|
if current_user
|
72
72
|
analyticsSetPerson(current_user)
|
73
73
|
end
|
74
|
-
add_attribution page_view_event[:parameters]
|
75
74
|
analyticsTrackEvent page_view_event[:name], page_view_event[:parameters]
|
76
75
|
analyticsStoreOriginatingPage page_view_event
|
77
76
|
end
|
@@ -79,8 +78,10 @@ module AnalyticsInstrumentation
|
|
79
78
|
properties = {
|
80
79
|
page: request.path
|
81
80
|
}
|
82
|
-
|
83
|
-
|
81
|
+
|
82
|
+
track_page_view = request.xhr? ? @@config.track_ajax_as_page_view : true
|
83
|
+
|
84
|
+
analyticsTrackEvent("Page View", properties) if track_page_view
|
84
85
|
rescue => e
|
85
86
|
logger.debug "Errpr found in analyticsLogPageView: #{e.inspect}"
|
86
87
|
@@config.error_handler.call(e, "Analytics Crash: #{request.filtered_path}")
|
@@ -152,6 +153,7 @@ module AnalyticsInstrumentation
|
|
152
153
|
properties["source"] = params[:source] if params[:source]
|
153
154
|
|
154
155
|
properties.merge! analyticsSuperProperties
|
156
|
+
add_attribution properties
|
155
157
|
|
156
158
|
# User defined extra props, called in context
|
157
159
|
extra_props = instance_exec(&@@config.extra_event_properties)
|
@@ -8,6 +8,7 @@ module AnalyticsInstrumentation
|
|
8
8
|
attr_accessor :custom_user_traits
|
9
9
|
attr_accessor :error_handler
|
10
10
|
attr_accessor :segment_write_key
|
11
|
+
attr_accessor :track_ajax_as_page_view
|
11
12
|
|
12
13
|
validates_presence_of :segment_write_key
|
13
14
|
|
@@ -26,9 +27,10 @@ module AnalyticsInstrumentation
|
|
26
27
|
end
|
27
28
|
|
28
29
|
def initialize
|
29
|
-
self.extra_event_properties
|
30
|
-
self.custom_user_traits
|
31
|
-
self.error_handler
|
30
|
+
self.extra_event_properties = Proc.new {}
|
31
|
+
self.custom_user_traits = Proc.new {}
|
32
|
+
self.error_handler = Proc.new { |e, msg=""| raise }
|
33
|
+
self.track_ajax_as_page_view = false
|
32
34
|
end
|
33
35
|
|
34
36
|
def intercom?
|
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.2.
|
4
|
+
version: 0.2.3
|
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-05-
|
12
|
+
date: 2015-05-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|