document.addEventListener('DOMContentLoaded', function(event) { try {
var img = document.createElement('img'), cjcid = '855555', cjactionid =
(document.location.hostname.indexOf('mobile.') > -1) ? '360841' :
'348384', products = "", oid = (typeof digitalData !== 'undefined' &&
typeof digitalData.order !== 'undefined') ? digitalData.order.id : 'no
order id', i = 1, items = (typeof digitalData !== 'undefined' && typeof
digitalData.order !== 'undefined') ?
JSON.parse(JSON.stringify(bt.order.items)) : [], eid =
digitalData_cookie('cjevent'), cjevent = (eid) ? "&CJEVENT=" + eid : "",
src="https://www.emjcd.com/u?" + "TYPE=" + cjactionid + "&CID=" + cjcid
+ "&CURRENCY=USD" + "&OID=" + oid + "&METHOD=IMG" + cjevent;
items.forEach(function(product) { var param = []; param.push("ITEM" + i
+ "=" + product.valuespecificsku); param.push("AMT" + i + "=" +
product.price*.965); param.push("QTY" + i + "=" + product.quantity);
products += "&" + param.join("&"); i += 1; }); img.width = "20";
img.height = "1"; img.src=src + products;
document.body.appendChild(img); } catch (ex) {console.log('error: cj: '
+ ex.message);} }); I have implemented below based on this Re:
Implementing custom code using Adobe Launch Now, My question is how do I
implement a for loop like below "ITEM", "AMT", and "PRODUCT" using the
custom code. Will it be something like this?