I have a question related to datalayer.
I currently have a datalayer builded for the Google solution (GTM+Analytics). I track ecommerce orders (but not only).
So my datalayer for a purchase is something like :
dataLayer.push({
'event' : 'Reservation',
'P_Category ' : %PageCategory,
'P_Destination' : %Destination,
'P_Cible ' : %Cible,
'P_Saison' : %Saison,
'P_Affinites' : %Affinites,
'dimension6': %ProduitCategorie,
'dimension7': %ProduitSousCategorie,
'dimension9': %CaracteristiqueOffre,
'dimension10': %Departement,
'dimension11': %Partenaire
});
'ecommerce': {
'purchase': {
'actionField': {
'id': %IdReservation, // **I want to use this as a variable**
'revenue': %TotalReservation
},
'products': [{
'name': %TitreOffre,
'id': %IdOffre,
'price': %PrixOffre,
'quantity': 1,
'brand': %Prestataire,
'category': %ProduitCategorie,
'variant': %ProduitSousCategorie,
'dimension1': %PageCategory,
'dimension2': %Destination,
'dimension3': %Cible,
'dimension4': %Saison,
'dimension5': %Affinites
}]
}
}
});
My question: is it possible to create a new datalayer variable in TMS for the ID of the reservation. As you can see it’s ecommerce.purchase.actionField.id
The question behind all of this: do we really need to completly rewrite the datalayer push to something like :
// register all purchased items
_paq.push(["addEcommerceItem",
"66251929", // SKU
"Red Unicorn Coffee Mug", // name
"Tableware", // category
8.00, // price
1 // quantity
]);
_paq.push(["addEcommerceItem",
"08273511", // SKU
"SUPER Blue Ink Pen 0.2", // name
"Office products", // category
2.00, // price
2 // quantity
]);
// track order
_paq.push(["trackEcommerceOrder",
"online-5289", // ID
16.00, // grand total (value + tax + discount + shipping)
10.00, // sub total (value + tax + discount)
1.00, // tax
6.00, // shipping
2.00 // discount
]);
Thank you for your feedback
CĂ©dric.