Last active
July 10, 2022 05:18
-
-
Save prabapro/4b9bc67ceff74b93a2ebb2dfd5720319 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function() { | |
var orderData = {{dlv - order-data v1}}; | |
var items = {{dlv - items - v1}}; | |
var actionField = { | |
id: orderData.id, | |
affiliation: orderData.affiliation, | |
revenue: orderData.revenue, | |
shipping: orderData.shipping, | |
tax: orderData.tax | |
}; | |
var products = items.map(function(prod) { | |
var item = { | |
id: prod.sku, | |
name: prod.name, | |
quantity: prod.quantity, | |
price: prod.price, | |
category: prod.category, | |
//Optional: Converting the "image" key into a custom dimension. Change the index as required. | |
dimension10: prod.image, | |
}; | |
return item; | |
}); | |
return { | |
ecommerce: { | |
currencyCode: orderData.currency, | |
purchase: { | |
actionField: actionField, | |
products: products | |
} | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment