How do I setup SingleFeed tracking for my Magento store?

This is the basic setup for the tracking code that goes on the checkout/success.phtml page of Magento websites. The first part that is php is required. This is "calling" the variables/parameters to have them available to insert into our javascript. This is only provided as an example and should be tested before releasing to your live site. Customization of this script may be necessary depending on your store configuration and Magento version. For further assistance, please contact Magento or a Magento helper company.


load($this->getLastOrderId());
$_skus = array();
$_qtys = array();
$_totalQty = 0;
foreach ($_order->getAllItems() as $_item) {
if ($_item->getParentItem()) continue;
$_skus[] = $_item->getSku();
$_qtys[] = $_item->getQty();
$_totalQty += $_item->getQty();
}
?>

<!--
var order_id = " getIncrementId() ?>";
var order_value = " getSubtotal() ?>";
var total_units = " ";
var product_ids = " ";
var product_units = " ";
//-->

 

A full example would look like this -

 

 

<?php

//-------------------------------------------

// GET MAGENTO ORDER VALUES FOR TRACKING CODE

//-------------------------------------------

$order_details = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());

 

$sale_subtotal = number_format($order_details->subtotal,2); // GETS THE SUB TOTAL NOT INCLUDING TAX AND SHIPPING
$sale_grandtotal = number_format($order_details->getGrandTotal(),2); // GETS THE GRAND TOTAL INCLUDING TAX AND SHIPPING
$sale_taxtotal = number_format($order_details->getTaxAmount(),2); // GETS THE TAX TOTAL
$sale_shippingtotal = number_format($order_details->getShippingAmount(),2); // GETS THE SHIPPING TOTAL
?>

 

<!--SINGLEFEED TRACKING CODE-->

<script type="text/javascript">

<!--

var order_id = "<?php echo $this->getOrderId() ?>";
var order_value = "<?php echo $sale_subtotal; ?>";
var total_units = "";
var product_ids = "";
var product_units = "";

//-->

</script>

<script src="https://reporting.singlefeed.com/z/convert.pl?merchant_id=YOURSFID" type="text/javascript" ></script>

<!--SINGLEFEED TRACKING CODE END-->


Have more questions? Submit a request

0 Comments

Article is closed for comments.