diff options
author | Jeremy Jackson <jjackson@gitlab.com> | 2019-08-14 22:21:58 +0300 |
---|---|---|
committer | Mayra Cabrera <mcabrera@gitlab.com> | 2019-08-14 22:21:58 +0300 |
commit | 5d9d5e603119c3ae334b0855a63d10d12b2390bd (patch) | |
tree | 0fd0becd40de3ecb95ff123e8973dc43b537f25b /app/helpers | |
parent | 7f9c653ef4c90a039ede690da1bc9d0524ffcc95 (diff) |
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')
-rw-r--r-- | app/helpers/application_settings_helper.rb | 6 | ||||
-rw-r--r-- | app/helpers/tracking_helper.rb | 17 |
2 files changed, 21 insertions, 2 deletions
diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb index acbcf0ded17..0ab19f1d2d2 100644 --- a/app/helpers/application_settings_helper.rb +++ b/app/helpers/application_settings_helper.rb @@ -270,7 +270,11 @@ module ApplicationSettingsHelper :diff_max_patch_bytes, :commit_email_hostname, :protected_ci_variables, - :local_markdown_version + :local_markdown_version, + :snowplow_collector_hostname, + :snowplow_cookie_domain, + :snowplow_enabled, + :snowplow_site_id ] end 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 |