minimum_viable_product 0.7.1 → 0.7.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e13999eea65c29fd3a737c235e61f3ed232e197d
|
4
|
+
data.tar.gz: e80e4a7e9ab4061a223ccc9aa71a3c8817b10149
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c912141c4dde88792579777bb8b3c9b57bbd76cb524539fa85dc7557ab95e9638338d7db4121792721ea97289d8f17337809db7eb63208d49a648dc9c4c6984
|
7
|
+
data.tar.gz: 78ebc3e715afa172463992ef45a68d15d3c61749146dad6581a059c1082f1bd7f95f379e8242d70024c2868fe79b38d0dbcd83ae9b9f51fb36bf8c3ce51d438c
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.2
|
@@ -7,20 +7,30 @@ module MinimumViableProduct
|
|
7
7
|
included do
|
8
8
|
before_action :generate_uid_if_not_set
|
9
9
|
helper_method :analytics_id
|
10
|
+
helper_method :analytics_identify_events
|
11
|
+
helper_method :analytics_track_events
|
12
|
+
end
|
13
|
+
|
14
|
+
def identify!(id, properties={})
|
15
|
+
return if session[INVISIBLE_SESSION_COOKIE].to_b == true
|
16
|
+
|
17
|
+
analytics_identify_events << {
|
18
|
+
id: id,
|
19
|
+
properties: properties
|
20
|
+
}
|
10
21
|
end
|
11
22
|
|
12
23
|
def track!(event, properties={})
|
13
24
|
return if session[INVISIBLE_SESSION_COOKIE].to_b == true
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
event: event,
|
25
|
+
|
26
|
+
analytics_track_events << {
|
27
|
+
name: event,
|
18
28
|
properties: properties.reverse_merge({
|
19
29
|
iteration: MVP::Iteration.version,
|
20
30
|
user: current_user.try(:name),
|
21
31
|
url: request.fullpath
|
22
32
|
})
|
23
|
-
}
|
33
|
+
}
|
24
34
|
end
|
25
35
|
|
26
36
|
def slack!(message, properties=nil)
|
@@ -36,40 +46,25 @@ module MinimumViableProduct
|
|
36
46
|
end
|
37
47
|
end
|
38
48
|
|
39
|
-
def
|
40
|
-
|
41
|
-
|
42
|
-
analytics.page(
|
43
|
-
user_id: current_user.try(:id),
|
44
|
-
name: name,
|
45
|
-
category: opts[:category],
|
46
|
-
properties: {
|
47
|
-
url: opts[:url],
|
48
|
-
iteration: MVP::Iteration.version
|
49
|
-
}
|
50
|
-
)
|
49
|
+
def analytics_identify_events
|
50
|
+
@__analytics_identify_events ||= []
|
51
|
+
@__analytics_identify_events
|
51
52
|
end
|
52
53
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
unless defined?(Analytics)
|
57
|
-
puts ""
|
58
|
-
puts "Please set SEGMENT_WRITE_KEY in .env"
|
59
|
-
puts ""
|
60
|
-
nil
|
61
|
-
else
|
62
|
-
Analytics
|
63
|
-
end
|
54
|
+
def analytics_track_events
|
55
|
+
@__analytics_track_events ||= []
|
56
|
+
@__analytics_track_events
|
64
57
|
end
|
65
58
|
|
59
|
+
private
|
60
|
+
|
66
61
|
def slack_notifier
|
67
62
|
Slack::Notifier.new ENV['SLACK_WEBHOOK_URL'], channel: ENV['SLACK_POST_CHANNEL'],
|
68
63
|
username: ENV['SLACK_POST_USERNAME']
|
69
64
|
end
|
70
65
|
|
71
66
|
def analytics_id
|
72
|
-
|
67
|
+
cookies[:uid]
|
73
68
|
end
|
74
69
|
|
75
70
|
def generate_uid_if_not_set
|
@@ -37,6 +37,14 @@ var _rollbarConfig = {
|
|
37
37
|
<script type="text/javascript">
|
38
38
|
!function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","page","once","off","on"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t<analytics.methods.length;t++){var e=analytics.methods[t];analytics[e]=analytics.factory(e)}analytics.load=function(t){var e=document.createElement("script");e.type="text/javascript";e.async=!0;e.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.com/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(e,n)};analytics.SNIPPET_VERSION="3.1.0";
|
39
39
|
analytics.load('<%= ENV['SEGMENT_WRITE_KEY'] %>');
|
40
|
+
|
41
|
+
<% analytics_identify_events.each do |event| %>
|
42
|
+
analytics.identify('<%= event[:id] %>', <%= event[:properties].to_json.html_safe %>);
|
43
|
+
<% end %>
|
44
|
+
<% analytics_track_events.each do |event| %>
|
45
|
+
analytics.track('<%= event[:name] %>', <%= event[:properties].to_json.html_safe %>);
|
46
|
+
<% end %>
|
47
|
+
|
40
48
|
analytics.page('<%= controller.controller_path %>.<%= controller.action_name %>', {
|
41
49
|
iteration: "<%= MVP::Iteration.version %>"
|
42
50
|
});
|
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: minimum_viable_product 0.7.
|
5
|
+
# stub: minimum_viable_product 0.7.2 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "minimum_viable_product"
|
9
|
-
s.version = "0.7.
|
9
|
+
s.version = "0.7.2"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|