Class: Fastlane::Polidea::Analytics

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/polidea/helper/analytics.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(session_id) ⇒ Analytics

Returns a new instance of Analytics.



10
11
12
13
14
# File 'lib/fastlane/plugin/polidea/helper/analytics.rb', line 10

def initialize(session_id)
  @session_id = session_id
  @client = FastlaneCore::AnalyticsIngesterClient.new(GA_TRACKING)
  @client_id = "fastlane-plugin-polidea@#{Fastlane::Polidea::VERSION}"
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



8
9
10
# File 'lib/fastlane/plugin/polidea/helper/analytics.rb', line 8

def client
  @client
end

#session_idObject

Returns the value of attribute session_id.



7
8
9
# File 'lib/fastlane/plugin/polidea/helper/analytics.rb', line 7

def session_id
  @session_id
end

Instance Method Details

#action_completed(action_name) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/fastlane/plugin/polidea/helper/analytics.rb', line 33

def action_completed(action_name)
  client.post_request({
    client_id: @session_id,
    category: @client_id,
    action: action_name,
    label: "completed"
  })
end

#action_launched(action_name, config) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/fastlane/plugin/polidea/helper/analytics.rb', line 16

def action_launched(action_name, config)
  client.post_request({
    client_id: @session_id,
    category: @client_id,
    action: action_name,
    label: "launched"
  })
  config.values.filter { |k, v| !v.nil? }.keys.each do |param|
    client.post_request({
      client_id: @session_id,
      category: @client_id,
      action: "#{action_name}::#{param}",
      label: "param"
    })
  end
end