File tree 3 files changed +16
-4
lines changed
3 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 2
2
site_settings :
3
3
segment_io_enabled : " Is Segment IO enabled?"
4
4
segment_io_write_key : ' What is the segment io write key?'
5
+ segment_io_internal_domain : ' What is the domain used to match internal users?'
Original file line number Diff line number Diff line change 5
5
segment_io_write_key :
6
6
default : ' '
7
7
client : false
8
+ segment_io_internal_domain :
9
+ default : ' '
10
+ client : false
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ def emit_segment_user_identify
51
51
username : username ,
52
52
email : email ,
53
53
created_at : created_at ,
54
- internal : email . ends_with? ( '@pagerduty.com' )
54
+ internal : internal_user?
55
55
} ,
56
56
context : {
57
57
ip : ip_address
@@ -65,6 +65,11 @@ def emit_segment_user_created
65
65
event : 'Signed Up'
66
66
)
67
67
end
68
+
69
+ def internal_user?
70
+ return false if SiteSetting . segment_io_internal_domain . blank?
71
+ email . ends_with? ( SiteSetting . segment_io_internal_domain )
72
+ end
68
73
end
69
74
70
75
require_dependency 'application_controller'
@@ -114,7 +119,8 @@ def emit_segment_post_created
114
119
post_number : post_number ,
115
120
created_at : created_at ,
116
121
since_topic_created : ( created_at - topic . created_at ) . to_i ,
117
- reply_to_post_number : reply_to_post_number
122
+ reply_to_post_number : reply_to_post_number ,
123
+ internal : user . internal_user?
118
124
}
119
125
)
120
126
end
@@ -131,7 +137,8 @@ def emit_segment_topic_created
131
137
properties : {
132
138
slug : slug ,
133
139
title : title ,
134
- url : url
140
+ url : url ,
141
+ internal : user . internal_user?
135
142
}
136
143
)
137
144
end
@@ -163,7 +170,8 @@ def emit_segment_post_liked
163
170
event : 'Post Liked' ,
164
171
properties : {
165
172
post_id : target_post_id ,
166
- topic_id : target_topic_id
173
+ topic_id : target_topic_id ,
174
+ internal : user . internal_user?
167
175
}
168
176
)
169
177
end
You can’t perform that action at this time.
0 commit comments