I am trying to implement conversion tracking at the item level with the digital agency RKG.
One peculiarity they have is they require to fire one pixel for every item instead of one pixel with multiple parameters like item1 qty1 item2 qty2.
So for example if an order comprises two items, two pixels should be fired like this:
Code:
<img src="https://www.rkdms.com/order.gif?mid=acme&oid=12345& lid=1&iid=WIDGETSML&icent=1099&iqty=10&iname=Small%20Wid get&ts=20030101152000" height="1" width="1">
<img src="https://www.rkdms.com/order.gif?mid=acme&oid=12345& lid=2&iid=WIDGETLRG&icent=2099&iqty=4&iname=Large%20Widg et&ts=20030101152000" height="1" width="1">
I know that I can access and interpolate the variables using a foreach loop in order_message.tpl but I don't know how to output them in separate tags and I was hoping someone could help here.
Here are the parameters I need:
oid: orderid
lid: incremental index 1, 2, ...
iid: productcode (SKU id)
ts: timestamp in format YYYYMMDDHHMMSS
icent: price in cents
iqty: item quantity
iname: url encode
here's also the magento code that produces the desired output:
Code:
<!-- Start RKG Pixel Tracking Code -->
<?php
//loading the order object.
$orderObj = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
//get all the items included on the order.
$orderItems = $orderObj->getAllItems();
$lid = 0;
$ts = date('YmdHis');
//do a loop to get each item.
foreach($orderItems as $item) {
$lid = $lid + 1;
echo '<img src="https://www.rkdms.com/order.gif?mid=performancetruck&oid=', $this->getOrderId(),
'&lid=', $lid,
'&iid=', $item->getSku(),
'&icent=', $item->getPrice(),
'&iqty=', $item->getQtyOrdered(),
'&iname=', $item->getName(),
'&ts=', $ts,
'" height="1" width="1">';
}
?>
<!-- End RKG Pixel Tracking Code -->
Any help is appreciated.