1. Sitewide Meta JavaScript
Allows you to make the most of the data customers share with you by placing first-party cookies to measure conversions
2. Create dataLayer variable
Go to Variable Tab
Create a dataLayer Variable to capture the ecommerce dataLayer value 'ecommere'
3. Create Purchase Tag
Create the purchase function in Custom HTML
Insert the below code
<script> var purchaseArray = {{DLV - Ecommerce}}; var purchaseProducts =[]; for (var i = 0; i < purchaseArray.items.length; i++) { var item = purchaseArray.items[i]; var newItem = { "item_id": item.item_id, "quantity": item.quantity }; purchaseProducts.push(newItem); } fbq('track', 'Purchase',{ value: purchaseArray.value, currency: 'AUD', contents: purchaseProducts, content_type: 'product' } ); </script>
Ensure that you fire your site wide tag before
Attach to the Purchase Complete Tag
4. Create View Product Tag
Create the purchase function in Custom HTML
Insert the below code
<script> var productView = {{DLV - Ecommerce}}; fbq("track",'ViewContent', { content_name: productView.items[0].item_name, content_type: "product", value: productView.items[0].price, currency: "AUD" }) </script>
Attach to the Purchase Complete tag