Copy this code between <head> and </head> and paste it to your website’s page:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <!-- Facebook Conversion Code for orders --> <script>(function() { var _fbq = window._fbq || (window._fbq = []); if (!_fbq.loaded) { var fbds = document.createElement('script'); fbds.async = true; fbds.src = '//connect.facebook.net/en_US/fbds.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(fbds, s); _fbq.loaded = true; } })(); window._fbq = window._fbq || []; window._fbq.push(['track', '6027036XXXXX', {'value':'0.01','currency':'INR'}]); </script> <noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?ev=6027036313923&cd[value]=0.01&cd[currency]=INR&noscript=1" /></noscript> |
Solution:
1. Go to “app\design\frontend\fortis (your theme)\default\template\page\html”
2. Open “head.phtml”
3. Write Code (Below Page):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | <?php if((strpos($_SERVER['REQUEST_URI'],'success')==true)): $orderObj = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId()); ?> <!-- Facebook Conversion Code for orders --> <script>(function() { var _fbq = window._fbq || (window._fbq = []); if (!_fbq.loaded) { var fbds = document.createElement('script'); fbds.async = true; fbds.src = '//connect.facebook.net/en_US/fbds.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(fbds, s); _fbq.loaded = true; } })(); window._fbq = window._fbq || []; window._fbq.push(['track', '6027036XXXX', {'value':'<?php echo number_format($orderObj->getBaseGrandTotal(),2) ?>','currency':'<?php echo $orderObj->getOrderCurrencyCode()?>'}]); </script> <noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?ev=6027036313923&cd[value]=<?php echo number_format($orderObj->getBaseGrandTotal(),2) ?>&cd[currency]=<?php echo $orderObj->getOrderCurrencyCode()?>&noscript=1" /></noscript> <?php endif; ?> |