Class: Staccato::Measurement::ProductImpression

Inherits:
Object
  • Object
show all
Includes:
Staccato::Measurable
Defined in:
lib/staccato/measurement/product_impression.rb

Overview

Measurement class for product impressions in a list

Constant Summary collapse

FIELDS =

Product impression measurement options fields

{
  index: nil,
  list_index: nil,
  id: 'id', # text
  name: 'nm', # text
  brand: 'br', # text
  category: 'ca', # text
  variant: 'va', # text
  price: 'pr', # currency (looks like a double?)
  position: 'ps' # integer
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Staccato::Measurable

#add_custom_dimension, #add_custom_metric, #custom_dimensions, #custom_metrics, #fields, included, #initialize, #params

Class Method Details

.lookup_keySymbol

lookup key for use in Hit#add_measurement

Returns:

  • (Symbol)


7
8
9
# File 'lib/staccato/measurement/product_impression.rb', line 7

def self.lookup_key
  :product_impression
end

Instance Method Details

#custom_fields_allowed?Boolean

product impression allow custom dimensions and metrics

Returns:

  • (Boolean)


18
19
20
# File 'lib/staccato/measurement/product_impression.rb', line 18

def custom_fields_allowed?
  true
end

#prefixString

product impress prefix

Returns:

  • (String)


13
14
15
# File 'lib/staccato/measurement/product_impression.rb', line 13

def prefix
  'il' + list_index.to_s + 'pi' + index.to_s
end