lifetime spend for each category

Bronze Contributor
Bronze Contributor

Hi,

I would like to understand the lifetime spend for each category, i m interested in Rings vs Necklaces.

However the product category is set only on PLP and PDP pages.

So I am trying to understand how to get lifteime spend for each category given that the on confirmation page  i have the product name and id but not the category.

After that being able to get the spend for Rings and Necklaces

Thanks

3 REPLIES 3

lifetime spend for each category

Bronze Contributor
Bronze Contributor

I will give it a go along with another solution I thought.

I will keep you posted.

lifetime spend for each category

Tealium Employee

@billysballo Your problem is that product_category is not present in the data layer on the order confirmation page, only product_id.  Presumably, both product_id and product_category are present on the PLP and PDP pages, as well as the add to cart event?

In that case, one approach is to "remember" the most recent product_id and product_category and then use this "remembered" value when incrementing the Tally on the confirmation page event, if the product_id there matches the most recently "remembered" product_id.

You could either do this "remembering" client-side (using for example a Persist Data Value extension) or in AudienceStream (using for example a pair of visit String attributes).

lifetime spend for each category

Bronze Contributor
Bronze Contributor
@mark_reddin
If we persist "most recent" product_id and product_category, what if a user adds more than one product to the cart? Basically, only one product id and category information is possible to persist using below recommendation.
---
In that case, one approach is to "remember" the most recent product_id and product_category and then use this "remembered" value when incrementing the Tally on the confirmation page event, if the product_id there matches the most recently "remembered" product_id.
---
I tried persisting the product id and each categories in a cookie which stores the product id and category mapping in a JSON object. On the order confirmation page, I have product id details and I can look up the product category information based on the persisted values. However, I'm wondering what type of data type in AS should I use in order to read this value.
Basically, I will populate subtotal of each category (lets say 2 products were purchased of the same category, I will sum them up) and we will not have the details about how many categories user may purchase.

{
'category1': 5000.
'category2': 2000
...
}

Public