summaryrefslogtreecommitdiff
path: root/app/helpers/tracking_helper.rb
blob: 7957038c21e3b47138a4534d0f1daaef999b5e20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

module TrackingHelper
  def tracking_attrs(label, action, property)
    return {} unless tracking_enabled?

    {
      data: {
        track_label: label,
        track_action: action,
        track_property: property
      }
    }
  end

  private

  def tracking_enabled?
    Rails.env.production? &&
      ::Gitlab::CurrentSettings.snowplow_enabled?
  end
end