We are launching a feature that allows customers to add multiple items to cart with a single click. How would you design a data layer to support this? Would you set up multiple product objects or use and array?
Does anyone have an example of how the add to cart would work? Do you fire the scadd event once or multiple times?
Any guidance here would be helpful!
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
If it were me, I would create a data layer that would set each product and it's corresponding data into a JSON list within my data layer, something like:
{
"action" : "addToCart",
"products" : [{
"name" : "product 1",
"sku" : "e4534533",
"valuex" : "something",
"valuey" : "something else"
},{
"name" : "product 2",
"sku" : "t6555677",
"valuex" : "something2",
"valuey" : "something else2"
},{
"name" : "product 3",
"sku" : "j565665",
"valuex" : "something3",
"valuey" : "something else3"
}]
}
Then on the "Add To Cart" rule, I would process all of the three products listed, and build my s.products string, setting up the appropriate merchandising eVars, etc.
Now, when you track an scAdd event, you don't technically need to attach it to each item in your s.products list in product notation... adding the scAdd event once in your s.events is just fine... the scAdd will apply to all items in the cart....
Basically, in a report you would see:
Cart Additions | ||
Products | 1 | |
product 1 | 1 | |
product 2 | 1 | |
product 2 | 1 |
Basically, one cart add for the group in the "total", and one cart add for each item when looking individually... if you really need to see "3" as the total, you will have to create a custom numeric event, that you can pass on each product, and would add up to "3" at the end:
s.products = ";product 1;;;event1=1;eVar1=e4534533|eVar2=something|eVar3=something else,;product 2;;;event1=1;eVar1=t6555677|eVar2=something2|eVar3=something else2,;product 3;;;event1=1;eVar1=j565665|eVar2=something3|eVar3=something else3";
s.events="scAdd,event1";
(or maybe you are using your SKU in product, and the product name in eVar1, for example)
Basically, in a report you would see:
Cart Additions | Event 1 | ||
Products | 1 | 3 | |
product 1 | 1 | 1 | |
product 2 | 1 | 1 | |
product 2 | 1 | 1 |
The way I see it, the "Cart Additions" would be the actual action of adding to the cart, but "Event 1" would be a total indicator of all products added to the cart.... you may not need this, but it's good to understand the distinction between the counter event, and the numeric event in this context
Hi jennifer , The above you have given event1 = 1 , How will these looks in reports. How i will filter these in reports.
Can you please give me a example? Thanks
Views
Replies
Total Likes
event1 is just an example, it can be event2, or event56, or any event.. the key is that whatever event you use is configured to be "Numeric"
Admin > Report Suites
choose suite(s)
Edit Settings > Conversion > Success Events
You would find eventX the same way you find any custom event, you can search by "event#" but that could bring back multiple items, by the actual name of the event (i.e. "Add Products to Cart (numeric)" or whatever you want to call it).
The event will look the same in the reports, it's just a different syntax to increment the event by a custom value, as opposed to the standard counter incrementation... (yes, you are passing "1" like a counter, but this method will ensure that each product will count independently, as opposed to a "rolled up", de-duplicated count)
Views
Replies
Total Likes
If you are going to use AEP and/or WebSDK, you can consider taking the Adobe schema for "productListItems" which is an array of objects automatically mapped to the corresponding product dimensions in Adobe Analytics, https://experienceleague.adobe.com/docs/analytics/implementation/vars/page-vars/products.html?lang=e...
Views
Likes
Replies
Views
Likes
Replies