Sha256: 2972182b8351441f2c49cdcde391b4ee6965b1df776b62f4a71e79859d1d9a8a

Contents?: true

Size: 689 Bytes

Versions: 9

Compression:

Stored size: 689 Bytes

Contents

# frozen_string_literal: true

require 'mixpanel-ruby'
require 'securerandom'
require 'app_store_connect/version'

module AppStoreConnect
  class Client
    class Usage
      OPTIONS = %i[analytics_enabled].freeze

      MIXPANEL_PROJECT_TOKEN = '1213f2b88b9b10b13d321f4c67a55ca8'
      private_constant :MIXPANEL_PROJECT_TOKEN

      def initialize(options = {})
        @enabled = options[:analytics_enabled].to_s == 'true'
        @distinct_id = SecureRandom.uuid
        @tracker = Mixpanel::Tracker.new(MIXPANEL_PROJECT_TOKEN)
      end

      def track
        return false unless @enabled

        @tracker.track(@distinct_id, 'usage', version: VERSION)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
app_store_connect-0.27.0 lib/app_store_connect/client/usage.rb
app_store_connect-0.26.0 lib/app_store_connect/client/usage.rb
app_store_connect-0.25.0 lib/app_store_connect/client/usage.rb
app_store_connect-0.23.0 lib/app_store_connect/client/usage.rb
app_store_connect-0.22.0 lib/app_store_connect/client/usage.rb
app_store_connect-0.21.0 lib/app_store_connect/client/usage.rb
app_store_connect-0.20.0 lib/app_store_connect/client/usage.rb
app_store_connect-0.19.0 lib/app_store_connect/client/usage.rb
app_store_connect-0.18.0 lib/app_store_connect/client/usage.rb