Class: Gitlab::Tracking::Destinations::Snowplow

Inherits:
Base
  • Object
show all
Extended by:
Utils::Override
Defined in:
lib/gitlab/tracking/destinations/snowplow.rb

Direct Known Subclasses

SnowplowMicro

Constant Summary collapse

SNOWPLOW_NAMESPACE =
'gl'

Instance Method Summary collapse

Methods included from Utils::Override

extended, extensions, included, method_added, override, prepended, queue_verification, verify!

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)

33
34
35
# File 'lib/gitlab/tracking/destinations/snowplow.rb', line 33

def enabled?
  Gitlab::CurrentSettings.snowplow_enabled?
end

#event(category, action, label: nil, property: nil, value: nil, context: nil) ⇒ Object


14
15
16
17
18
19
# File 'lib/gitlab/tracking/destinations/snowplow.rb', line 14

def event(category, action, label: nil, property: nil, value: nil, context: nil)
  return unless enabled?

  tracker.track_struct_event(category, action, label, property, value, context, (Time.now.to_f * 1000).to_i)
  increment_total_events_counter
end

#hostnameObject


37
38
39
# File 'lib/gitlab/tracking/destinations/snowplow.rb', line 37

def hostname
  Gitlab::CurrentSettings.snowplow_collector_hostname
end

#options(group) ⇒ Object


21
22
23
24
25
26
27
28
29
30
31
# File 'lib/gitlab/tracking/destinations/snowplow.rb', line 21

def options(group)
  additional_features = Feature.enabled?(:additional_snowplow_tracking, group, type: :ops)
  {
    namespace: SNOWPLOW_NAMESPACE,
    hostname: hostname,
    cookie_domain: cookie_domain,
    app_id: app_id,
    form_tracking: additional_features,
    link_click_tracking: additional_features
  }.transform_keys! { |key| key.to_s.camelize(:lower).to_sym }
end