Events with item details in the data layer throw a tag firing exception: Firing Status Exception thrown
Closed this issue · 3 comments
Tag Firing Status : Exception thrown
Happens when "Event Data" contains "Item Details" as shown in the image below.
For example in a ecommerce store "Add to cart" or "Purchase" usually contains additional data about the products the user purchases. In this care it looks like the Twitter - Stape integration fails to fire the tag and the console log trows the error: "
TypeError: Can't set property contents of undefined."
Any ideas how to bypass the problem? Maybe you can adjust the conditions to only send the data that is matched with the format twitter requires, for example: Currency, price and ignore the rest of the details added in the Event Data->Item details.
Found the issue, the error came from the 3 missing mappedData elements below. Once added inside the function addEcommerceData the EventData containing ItemDetails was pushed to Twitter without errors.
function addEcommerceData(eventData, mappedData) {
if (eventData.items && eventData.items[0]) {
mappedData.custom_data = {};
mappedData.contents = [];
mappedData.custom_data.contents = {};
}
Thanks for the detailed issue.
We will check and update our tag.
Thanks. We updated the Tag.