Sha256: 93703024bb401ddd5b11e40f5e0e8a5112b0d842b9375bc058689e200cdca8b6
Contents?: true
Size: 779 Bytes
Versions: 4
Compression:
Stored size: 779 Bytes
Contents
require 'securerandom' require 'pdk/analytics/util' require 'pdk/analytics/client/google_analytics' require 'pdk/analytics/client/noop' module PDK module Analytics CLIENTS = { noop: Client::Noop, google_analytics: Client::GoogleAnalytics, }.freeze def self.build_client(opts = {}) opts[:logger] ||= ::Logger.new(STDERR) opts[:client] ||= :noop if opts[:disabled] opts[:logger].debug 'Analytics opt-out is set, analytics will be disabled' CLIENTS[:noop].new(opts) else CLIENTS[opts[:client]].new(opts) end rescue StandardError => e opts[:logger].debug "Failed to initialize analytics client, analytics will be disabled: #{e}" CLIENTS[:noop].new(opts) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
pdk-1.13.0 | lib/pdk/analytics.rb |
pdk-1.12.0 | lib/pdk/analytics.rb |
pdk-1.11.1 | lib/pdk/analytics.rb |
pdk-1.11.0 | lib/pdk/analytics.rb |