<!– customHTML on sale page AND event=gtm.dom ready –>

<script>

// Settings

var myActionString = “purchase”; // promo_click > detail > add | remove > checkout | checkout_option >>> purchase | refund

var myStepInt = 6; // 1-6

var myStepOptionalNameString = “complete”; // cart | login | delivery | billing | payments | complete

 

// Cannot execute loops within an array declaration.

// Thus – first create the products array before pushing it into dataLayer.

window.dataLayer = window.dataLayer || [];

var eCommProductsCLASSIC = [],

currProduct, i, ii;

for (i = 0, ii = {{dataLayer.ecommerce.products}}.length; i < ii; i += 1) {

currProduct = {{dataLayer.ecommerce.products}}[i];

eCommProductsCLASSIC.push({

“sku”: currProduct.id, // SKU

“name”: currProduct.name,

“price”: currProduct.price, // Includes Tax: 100+tax = 120.00

“brand”: currProduct.brand,

“category”: currProduct.category,

“variant”: currProduct.variant,

“quantity”: currProduct.quantity,

“coupon”: currProduct.coupon

});

}

// Now declare Ecommerce payment dataLayer variables

dataLayer.push({

//Transaction level mapping

“transactionCurrency”: {{dataLayer.ecommerce.currencyCode}},

“transactionId”: {{dataLayer.ecommerce.purchase.actionField.id}},

“transactionAffiliation”: {{dataLayer.ecommerce.purchase.actionField.affiliation}},// optional

“transactionTotal”: {{dataLayer.ecommerce.purchase.actionField.revenue}},// 120*1quantity + 120*1quantity + 10shipping

“transactionTax”: {{dataLayer.ecommerce.purchase.actionField.tax}},// 250 * (1-(100%/120%))

“transactionShipping”: {{dataLayer.ecommerce.purchase.actionField.shipping}},// Includes Tax: 8.33 + tax = 10.00

“transactionShippingMethod”: {{dataLayer.ecommerce.purchase.actionField.shippingMethod}},// optional

“transactionDate”: {{dataLayer.ecommerce.purchase.actionField.date}},// optional

“transactionCoupon”: {{dataLayer.ecommerce.purchase.actionField.coupon}},// optional “transactionCouponDiscount”: {{dataLayer.ecommerce.purchase.actionField.couponDiscount}},// optional “transactionPaymentType”: {{dataLayer.ecommerce.purchase.actionField.paymentType}},// optional

“transactionType”: {{dataLayer.ecommerce.purchase.actionField.type}},// optional

“transactionSubTotalIncludeTax”: {{dataLayer.ecommerce.purchase.actionField.subTotalIncludeTax}},// Indicates whether TransactionTotal includes tax

 

//Item level mapping

“transactionProducts”: eCommProductsCLASSIC, // Trigger Loop array above

//Trigger Transaction

“event”: “customhtml_legacy_ecommerce_mapping_loaded”

});

</script>

0117 3361103