Support Center

How to Install Spring Metrics on Magento

Last Updated: Jan 10, 2014 10:37AM EST
1. First, log in to Spring Metrics. Click the I'll embed the code myself button:



2. Using your keyboard or mouse, copy the code in the box:



3. Now, log in to your Magento account and click the System tab on the top toolbar:



4. At the bottom, click on Configuration:



5. On the left toolbar, click on Design:




6. In the Design section, click on HTML Head:


7. Scroll down and place your cursor in the Miscellaneous Scripts box. Paste the tracking code into this box. Then click the Save Config button in the top right corner.



8. Next, we'll add the revenue tracking code. This will allow you to see your revenue for each conversion in Spring Metrics. In addition, it will also track the order ID, customer email, and coupon code (if applicable) used for each purchase.

Access the following files for your store:
 
  • /template/checkout/multishipping/success.phtml
  • /template/checkout/success.phtml

At the end of EACH file (after the last </div>), paste the following code:
 
 <!-- Spring Metrics code for purchase conversion -->
<?php
$orderId = Mage::getSingleton('checkout/type_onepage')->getCheckout()->getLastOrderId();
$order = Mage::getModel('sales/order')->load($orderId);
$coupon_code = $order->getCouponCode();
if (!$coupon_code) $coupon_code = '';
$amount = number_format($order->getGrandTotal(),2);
$email = $order->getCustomerEmail();
?>
<script type="text/javascript">
_springMetq.push(["setdata", { "revenue": "<?php echo $amount; ?>" }]);
_springMetq.push(["setdata", { "orderId": "<?php echo $orderId; ?>" }]);
_springMetq.push(["setdata", { "email": <?php echo json_encode($email); ?> }]);
_springMetq.push(["setdata", { "promoCode": <?php echo json_encode($coupon_code); ?> }]);
_springMetq.push(["convert", "sale" ]);
</script>
<!-- end Spring Metrics code -->
Then Save and Upload your changes to your site.

If something didn't work, please email us with the details and we'll help you investigate.

Contact Us

We're real people!

Mitch
Beth
Shawn
support@springmetrics.com
http://assets1.desk.com/
false
SpringSupport
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete