2019-06-05 12:28:41 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module TrackingHelper
|
2021-03-26 14:09:16 -04:00
|
|
|
def tracking_attrs(label, action, property)
|
2019-08-14 15:21:58 -04:00
|
|
|
return {} unless tracking_enabled?
|
|
|
|
|
|
|
|
{
|
|
|
|
data: {
|
|
|
|
track_label: label,
|
2021-03-26 14:09:16 -04:00
|
|
|
track_action: action,
|
2019-08-14 15:21:58 -04:00
|
|
|
track_property: property
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def tracking_enabled?
|
|
|
|
Rails.env.production? &&
|
2021-06-18 20:10:16 -04:00
|
|
|
::Gitlab::Tracking.enabled?
|
2019-06-05 12:28:41 -04:00
|
|
|
end
|
|
|
|
end
|