Question

Here is my code :

<!-- Event snippet for Final Page conversion page -->
<script>
  wtag('event', 'conversion', {
      'send_to': 'AW-23232323223232/23232323233434343443',
      'value': 0.0,
      'currency': 'INR',
      'transaction_id': ''
  });
</script>

How can i add in success page?

Was it helpful?

Solution

In your theme go to the checkout folder and edit success.phtml

If you do not have a success.phtml in your theme then to overwrite this you can copy the one from the base magneto theme folder which can be found

app/design/frontend/base/default/template/checkout

copy the file to your theme in the same directory

app/design/frontend/your/theme/template/checkout

Do any edits you need to the new success.phtml file placed in your theme and remember to flush the magento cache once you have done this

Your code should look like this

<?php 
$orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
$order = Mage::getModel('sales/order')->load($orderId);
?>

<!-- Event snippet for Final Page conversion page -->
<script>
  wtag('event', 'conversion', {
      'send_to': 'AW-23232323223232/23232323233434343443',
      'value': <?php echo $order->getGrandTotal() ?>,
      'currency': 'INR',
      'transaction_id': '<?php echo $orderId ?>'
  });
</script>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top