I'm trying to set up a facebook purchase event in GTM and i'm almost there but i son't understand why I can only see the first product from the transactiuon array in facebook business manager? I can see that a transaction been made and I can see the value but only one product SKU!
This is the datalayer after a specifik purchase, with two different kind of tickets:
{
transactionId: "31000226",
transactionTotal: 243,
transactionProducts: [
{
name: "Adult",
sku: "Adult",
price: 135,
quantity: 1,
category: "tickets"
},
{
name: "Pensioner",
sku: "Pensioner",
price: 108,
quantity: 1,
category: "tickets"
}
],
And this is my GTM-tag for the facebook purchase event:
<script>
fbq('track', 'Purchase',{
products: '[{{DLV - Ecommerce - Product}}]',
value: '{{DLV - Ecommerce - TransactionTotal}}',
currency: 'SEK'
});
</script>
The datalayer variable {{DLV - Ecommerce - Product}} is set up like this in GTM:
transactionProducts.0.sku
This is what I can see in facebook business manager:
Parametrar: (3)
value: 243
currency: SEK
products: [Adult]
Does anyone see the problem? Why can't I in this exampel see the second ticket that says "Pensioner"?
You could write a custom variable “sku variable” for the sku to be the below:
function () {
{{DLV - Ecommerce - Product}}.forEach {
return sku
};
}
Change the {{DLV - Ecommerce - Product}} to just transactionProducts