trackAddToCart gets thrown to Bad Stream by Scala Enrich

I’m trying to implement trackAddToCart event by following this instruction:

I set up a datalayer push on button click:

dataLayer.push({‘event’: ‘add-to-cart’, ‘productId’: ‘@{}’, ‘productName’: ‘@{}’, ‘productCategory’: ‘@{model.category.text}’, ‘price’: ‘@{model.prices[0].price}’, ‘qty’: 1, ‘currency’: ‘EUR’});

this then triggers (‘event’ equals ‘add-to-cart’) a Tag in the GTM that calls this script:

window.snowplow(‘trackAddToCart’, {{productId}}, {{productName}}, {{productCategory}}, {{price}}, {{qty}}, {{currency}});

I’ve also already created all the user defined variables shown in that snippet above in the GTM.

the GTM debug preview shows that trackAddToCart successfully fired with the correct information.

The scala collector log shows it picks up the event and send it to the good stream. Then I can see the enrich log also picks up the event, but then it shows that the event get sent to the bad stream.

Did I miss anything in implementing this event?


@gagabonar, the error message for the “bad” event should give you a clue. Also, if you base64-decode the raw event you will see the actual payload to figure out what is wrong/missing.

@ihor Thanks for the reply. It turns out one of unstructured event parameter doesn’t match the data type in the json schema.