Expand my Community achievements bar.

SOLVED

debugging productListItems

Avatar

Level 6

Do you know a way how to use a browser console in order to debug productListItems array?

Maybe there is another way?

I would like to create abandon basket mailing and even though I put there a loop I constantly see in the email only last product ...

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 4

Well I would say it depends on your business use case if your business would like to know what specific product users are adding to their cart then only send product info of product which user are adding to the cart(single event), you need to trigger an event on click of Add to Cart button on the page, the next action will depends on the UI/UX of the your website if after adding a product to cart cart page is also loading by default then you can trigger a cart view event and send all the items details available in the cart.

You can refer to the schema document for more details on eventType field.

AnkitCh2_0-1716639838260.png

 

I hope this will help.

  

View solution in original post

9 Replies

Avatar

Level 7

Hi @Michael_Soprano 

In the WebSDK extension, there is a "on before event send" section where you can print out the data that is to be sent to the edge network before the request is made.

maybe a good starting point.

 

https://experienceleague.adobe.com/en/docs/experience-platform/web-sdk/commands/configure/onbeforeev...

 

Cheers,

Björn

Avatar

Level 6

but productListItems is the array so only last product is visible not the whole array

Avatar

Level 7

Hi @Michael_Soprano 

if you set all products in the array they should be visible there, or do I not fully get the question?

 

Do you mean products from previous calls?

Avatar

Level 4

Hi @Michael_Soprano 

 

You can use alloy("setDebug", {"enabled": true}); command on console to enable debug mode and filter console with XDM and validate your schema on the console however you can also use network tab or debugging tools like Omnibug for a better readability and view.

AnkitCh2_0-1716611136697.png

 

Also, if you are only getting a single item in the productListItems variable it seems like like there is an issues in the code you've configured to capture product details, I would recommend using JavaScript map() function to loop through the array in the data layer and create a data element to capture before setting it into XDM variable.

 

few links for reference.

w3schools - map() 

How to Use the JS .map() Function freecodecamp 

 

Let me know if you need an example code if can create a sample as well which you can refer to will happy to share if required.

Avatar

Level 6

Thank you for your reply. 

Could you advise me how you would implement add to cart event?

 

Assuming that I have 2 products already in the cart. If the user add the third one then I should iterate through data layer cart item and send with the thrid one also two previous ones to productListItems? How you would do that? Unfortunately in my org we dont have yet any AEP master so I do appreciate your help!

Michael_Soprano_0-1716634239273.png

 

Avatar

Correct answer by
Level 4

Well I would say it depends on your business use case if your business would like to know what specific product users are adding to their cart then only send product info of product which user are adding to the cart(single event), you need to trigger an event on click of Add to Cart button on the page, the next action will depends on the UI/UX of the your website if after adding a product to cart cart page is also loading by default then you can trigger a cart view event and send all the items details available in the cart.

You can refer to the schema document for more details on eventType field.

AnkitCh2_0-1716639838260.png

 

I hope this will help.

  

Avatar

Level 7

Hi @Michael_Soprano ,

no, if you have previously sent two products in an add to cart event, you only have to send the third one in that additional call.

Avatar

Level 6

Thanks. But to understand that 100% correctly one more thing. If I would like to make abandon basket using AJO then AEP stores at the back-end all products added to the cart?

Avatar

Level 7

Yes, that should be the case with AEP being the data lake that AJO is working with.

 

here are a bunch of diagrams about data flows in the AEP. In general, I think it's safe to say that events and profiles are accessible in AJO.

 

https://experienceleague.adobe.com/en/docs/blueprints-learn/architecture/architecture-overview/platf...