Skip to main content
All CollectionsWorking with other platforms: Magento, Squarespace etc
Installing the Sauce conversion code into your Magento store
Installing the Sauce conversion code into your Magento store
James Riley avatar
Written by James Riley
Updated over 2 years ago

Sauce has the ability to track how many sales have been generated from the images in your Sauce feed. To reap these benefits, you'll want to copy the Sauce conversion code into the 'Success' page of your checkout. Assuming you are comfortable modifying code, or are working with a developer, you'll want to do the following:

1) Open the "Checkout Success" page for your Magento Theme

This will be at a location such as: vendor/magento/module-checkout/view/frontend/templates/success.phtml . Alternatively, you may find your theme within the app folder of your Magento installation.

2) Copy the following and paste it into the bottom of the success template

In doing so, you'll need to update the window.snapppt_account , which is set to XXXXX  below, with the actual Sauce account number of your store. You can access this from the 'Account Details' section of your Sauce back office. 

<?php
  $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
  $order = $objectManager->create('Magento\Sales\Model\Order')->load($block->getOrderId());
?>

<!-- Snapppt order conversion code - be sure to replace the data placeholders with the corresponding tags for your platform -->
<script>
  window.snapppt_order_number = '<?php echo($order->getRealOrderId()) ?>';
  window.snapppt_order_total = '<?php echo($order->getGrandTotal()) ?>';
  window.snapppt_order_currency = '<?php echo($order->getOrderCurrencyCode()) ?>';
  // comma separated list of discount codes used on the order
  window.snapppt_order_discount_codes = '<?php echo($order->getCouponCode()) ?>';
  window.snapppt_account = "XXXXX";
</script>
<script src="//snapppt.com/conversion-tracker.js" defer></script>

Note that the above is to only help guide you. In brief, you'll want to get hold of the current order, and then output the relevant data for the conversion. How exactly you achieve this may vary depending on the setup of your Magento store.

3) Save the changes to the theme

You may need to clear the Magento cache for the changes to take effect. To easily test that the conversion code has been correctly installed, try out the 'Checkout Tester 2' extension.

Did this answer your question?