OK, here's one for you
I'm doing a similar thing for catching the product bought for conversion tracking. The code is like this:
function initTracking () {ldelim}
try {ldelim} Tracking.getProduct('UA-XXXX','{$orders.0.products.0.productid}').logAddTo Cart(); {rdelim} catch (e) {ldelim}{rdelim}
{rdelim}
As you can see I've already done some work here, and it does work fine as is. My question is how do you work it so multiple items can be tracked this way? The suggestion from the conversion tracking company is to duplicate the "try { Tracking...catch (e) {}" line and filling the SKU/PRODUCTID spot with each different item. What's the cleanest way to have each PRODUCTID populate these based on how many products the customer buys? Is this right to make sure I cover up to 10 items?
function initTracking () {ldelim}
try {ldelim} Tracking.getProduct('UA-XXXX','{$orders.0.products.0.productid}').logAddTo Cart(); {rdelim} catch (e) {ldelim}{rdelim}
try {ldelim} Tracking.getProduct('UA-XXXX','{$orders.0.products.1.productid}').logAddTo Cart(); {rdelim} catch (e) {ldelim}{rdelim}
try {ldelim} Tracking.getProduct('UA-XXXX','{$orders.0.products.2.productid}').logAddTo Cart(); {rdelim} catch (e) {ldelim}{rdelim}
try {ldelim} Tracking.getProduct('UA-XXXX','{$orders.0.products.3.productid}').logAddTo Cart(); {rdelim} catch (e) {ldelim}{rdelim}
try {ldelim} Tracking.getProduct('UA-XXXX','{$orders.0.products.4.productid}').logAddTo Cart(); {rdelim} catch (e) {ldelim}{rdelim}
try {ldelim} Tracking.getProduct('UA-XXXX','{$orders.0.products.5.productid}').logAddTo Cart(); {rdelim} catch (e) {ldelim}{rdelim}
try {ldelim} Tracking.getProduct('UA-XXXX','{$orders.0.products.6.productid}').logAddTo Cart(); {rdelim} catch (e) {ldelim}{rdelim}
try {ldelim} Tracking.getProduct('UA-XXXX','{$orders.0.products.7.productid}').logAddTo Cart(); {rdelim} catch (e) {ldelim}{rdelim}
try {ldelim} Tracking.getProduct('UA-XXXX','{$orders.0.products.8.productid}').logAddTo Cart(); {rdelim} catch (e) {ldelim}{rdelim}
try {ldelim} Tracking.getProduct('UA-XXXX','{$orders.0.products.9.productid}').logAddTo Cart(); {rdelim} catch (e) {ldelim}{rdelim}
{rdelim}