Skip to main content

 

Hi all. We are currently in the stage of integrating amplitudes after the contract has been signed, but it has not yet entered into force and we cannot test Cart Analysis in Data. My question is, can I use an array to list the categories as shown below in the code. I took the sample code from https://help.amplitude.com/hc/en-us/articles/9623000954907 and added some values in the category. Our products can often be in different categories, so I have this need. Perhaps you can suggest another solution, for example, maybe send the category property twice with different values and it will be associated with one product? The second question is how to properly plan such properties? Should I schedule both parent and child properties? And what type should the parent property have? Thank you all for your reply.

products:  
{
product_id: 1,
sku: '45360-32',
name: 'Special Facial Soap',
category: 'name1','name2'],
price: 12.60,
},
{
product_id: 5,
sku: '47738-11',
name: 'Fancy Hairbrush',
category: 'Beauty',
price: 18.90,
}
]

Hi @olegmx5.

We have a similar use case where we can have multiple park codes attributed to a given event. We pass the codes in an A-Z ordered, pipe-delimited string like this…

products: s
  {
    ...
    park_code: ‘AB|CD|EF|GH’
    …
  }
  ...
]
 

….then in Amplitude’s Data section we create a Derived Property (https://help.amplitude.com/hc/en-us/articles/360058731292-Derived-properties-Add-new-event-and-user-properties-retroactively) that splits the string, like this…

 

SPLIT(products.park_code, ‘|’)

 

That would work for your scenario of multiple categories with the benefit of having the categories grouped in a string as well as split out. Alternatively you could have a bunch of distinct category variables inside the products array (category_1, category_2, etc)….but that feels less clean.

Hope this helps!


Does this mean I can't use an array for a child property?

Hi @olegmx5.

We have a similar use case where we can have multiple park codes attributed to a given event. We pass the codes in an A-Z ordered, pipe-delimited string like this…

products: s
  {
    ...
    park_code: ‘AB|CD|EF|GH’
    …
  }
  ...
]
 

….then in Amplitude’s Data section we create a Derived Property (https://help.amplitude.com/hc/en-us/articles/360058731292-Derived-properties-Add-new-event-and-user-properties-retroactively) that splits the string, like this…

 

SPLIT(products.park_code, ‘|’)

 

That would work for your scenario of multiple categories with the benefit of having the categories grouped in a string as well as split out. Alternatively you could have a bunch of distinct category variables inside the products array (category_1, category_2, etc)….but that feels less clean.

Hope this helps!

 


In principle I don’t see why it wouldn’t work, you’d just need to use the splitting function in Data on both your products property and then the products.category property. In practice...not sure whether it works. You could try it out and see? Either that or maybe @Esther Trapadoux can let us know!


In principle I don’t see why it wouldn’t work, you’d just need to use the splitting function in Data on both your products property and then the products.category property. In practice...not sure whether it works. You could try it out and see? Either that or maybe @Esther Trapadoux can let us know!

this is only available to growing and corporate clients. We already have a contract, but it will be activated on June 1, until then we have a starter pack and unfortunately I can't check it myself. If I had such an opportunity, I would have sent a long time ago and see what happens
 

 

 


@olegmx5 just sent you a message to get more details.


Reply