Sha256: f05709ed59da22c944b6dca736f7c7a2050b4428de353b66b01287da66e93aa8

Contents?: true

Size: 899 Bytes

Versions: 13

Compression:

Stored size: 899 Bytes

Contents

module Staccato
  module Measurement
    # Measurement class for products in a transaction or other action
    class Product
      # lookup key for use in Hit#add_measurement
      # @return [Symbol]
      def self.lookup_key
        :product
      end

      # product prefix
      # @return [String]
      def prefix
        'pr'+index.to_s
      end

      # product allow custom dimensions and metrics
      def custom_fields_allowed?
        true
      end

      # Product measurement options fields
      FIELDS = {
        index: nil,
        id: 'id', # text
        name: 'nm', # text
        brand: 'br', # text
        category: 'ca', # text
        variant: 'va', # text
        price: 'pr', # currency (looks like a double?)
        quantity: 'qt', # integer
        coupon_code: 'cc', # text
        position: 'ps' # integer
      }.freeze

      include Measurable
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
staccato-0.5.3 lib/staccato/measurement/product.rb
staccato-0.5.2 lib/staccato/measurement/product.rb
staccato-0.5.1 lib/staccato/measurement/product.rb
staccato-0.5.0 lib/staccato/measurement/product.rb
staccato-0.4.7 lib/staccato/measurement/product.rb
staccato-0.4.6 lib/staccato/measurement/product.rb
staccato-0.4.5 lib/staccato/measurement/product.rb
staccato-0.4.4 lib/staccato/measurement/product.rb
staccato-0.4.3 lib/staccato/measurement/product.rb
staccato-0.4.2 lib/staccato/measurement/product.rb
staccato-0.4.1 lib/staccato/measurement/product.rb
staccato-0.4.0 lib/staccato/measurement/product.rb
staccato-0.3.1 lib/staccato/measurement/product.rb