summaryrefslogtreecommitdiff
path: root/app/helpers/tracking_helper.rb
diff options
context:
space:
mode:
authorJeremy Jackson <jjackson@gitlab.com>2019-08-14 19:21:58 +0000
committerMayra Cabrera <mcabrera@gitlab.com>2019-08-14 19:21:58 +0000
commit5d9d5e603119c3ae334b0855a63d10d12b2390bd (patch)
tree0fd0becd40de3ecb95ff123e8973dc43b537f25b /app/helpers/tracking_helper.rb
parent7f9c653ef4c90a039ede690da1bc9d0524ffcc95 (diff)
downloadgitlab-ce-5d9d5e603119c3ae334b0855a63d10d12b2390bd.tar.gz
Migrates Snowplow backend from EE to CE
This introduces several changes, but these are all just ported from the EE project.
Diffstat (limited to 'app/helpers/tracking_helper.rb')
-rw-r--r--app/helpers/tracking_helper.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/app/helpers/tracking_helper.rb b/app/helpers/tracking_helper.rb
index 51ea79d1ddd..221d9692661 100644
--- a/app/helpers/tracking_helper.rb
+++ b/app/helpers/tracking_helper.rb
@@ -2,6 +2,21 @@
module TrackingHelper
def tracking_attrs(label, event, property)
- {} # CE has no tracking features
+ return {} unless tracking_enabled?
+
+ {
+ data: {
+ track_label: label,
+ track_event: event,
+ track_property: property
+ }
+ }
+ end
+
+ private
+
+ def tracking_enabled?
+ Rails.env.production? &&
+ ::Gitlab::CurrentSettings.snowplow_enabled?
end
end