Analytics & Reports
Analytics

Structure

Provides the fields that will be available on gb-product for each record. The values for the fields correspond to the record fields available in allMeta. Can add and create any additional fields as needed.

Property Type Default Description
id string 'id' The field to use as your record ID.
title string 'title' The field to use as your record title.
price string 'price' The field to use as your record price.
_transform(meta) function meta: allMeta - The allMeta for your records. Allows for altering fields before applying them to structure. To add a field, add it to meta, apply modifications, and return meta.
_variant object

Accepts an object in the form:

{
  field: <variant-array>,
  structure: {
   ...
  }
}

Where <variant-array> is a string that corresponds to a record array property, and structure reflects the intended structure based on that array property. For example:

  {
    field: 'visual',
    structure: {
      color: 'color',
      price: 'prices.0.salePrice'
    }
  }

Would map out variants for the data structure:

 allMeta: {
   visual: [
     {
       color: 'red',
       prices: [
         {
           salePrice: '20.00',
           currentPrice: '30.00'
         }
       ]
     }, {
       color: 'yellow',
       prices: [
         {
           salePrice: '18.00',
           currentPrice: '30.00'
         }
       ]
     }
   ]
 }