Class: Path::Reporting::Analytics::Console

Inherits:
Object
  • Object
show all
Defined in:
lib/path/reporting/analytics/console.rb

Overview

Simple non-structure console logging for analytics data. Most helpful for development or backup rather than analysis.

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Console

Create new console logging analytics reporter

Parameters:

See Also:



12
13
14
# File 'lib/path/reporting/analytics/console.rb', line 12

def initialize(config)
  @config = config.analytics
end

Instance Method Details

#record(name:, user:, user_type:, trigger:, metadata: {}) ⇒ Object

Log the analytics event to the configured logger

Parameters:

  • name (String)

    Formatted name to send to Amplitude

  • user (Hash)

    User object. Must contain :id and no PII

  • user_type (UserType)

    Type of user

  • trigger (Trigger)

    Trigger for this event

  • metadata (Hash) (defaults to: {})

    Metadata to send with the event

See Also:



23
24
25
# File 'lib/path/reporting/analytics/console.rb', line 23

def record(name:, user:, user_type:, trigger:, metadata: {})
  @config.logger.info("[#{trigger}]:#{name} - #{user.inspect} (#{user_type}) #{.nil? ? "" : .inspect}")
end