debian-mirror-gitlab/app/helpers/tracking_helper.rb

27 lines
498 B
Ruby
Raw Normal View History

2019-09-04 21:01:54 +05:30
# frozen_string_literal: true
module TrackingHelper
2021-04-29 21:17:54 +05:30
def tracking_attrs(label, action, property)
2019-10-12 21:52:04 +05:30
return {} unless tracking_enabled?
{
data: {
track_label: label,
2021-04-29 21:17:54 +05:30
track_action: action,
2019-10-12 21:52:04 +05:30
track_property: property
}
}
end
2022-03-02 08:16:31 +05:30
def tracking_attrs_data(label, action, property)
tracking_attrs(label, action, property).fetch(:data, {})
end
2019-10-12 21:52:04 +05:30
private
def tracking_enabled?
Rails.env.production? &&
2021-09-30 23:02:18 +05:30
::Gitlab::Tracking.enabled?
2019-09-04 21:01:54 +05:30
end
end