0

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?

7
  • if you have access to your theme files you can add it that way by going to your theme directory /checkout/success.phtml Commented Aug 19, 2019 at 6:48
  • @DavaGordon Shall i add directly to core files, what about magento version upgrade issue?
    – zus
    Commented Aug 19, 2019 at 6:49
  • 1
    Never edit the core, if you have a custom theme copy the success.phtml from the base theme to your theme. same structure and that should overwrite what is shown. once you have done that edit the new file within your theme and save and recache the site and all should be well Commented Aug 19, 2019 at 6:51
  • Thank you for clear details.
    – zus
    Commented Aug 19, 2019 at 6:54
  • hope your issue is resolved :) Commented Aug 19, 2019 at 6:58

1 Answer 1

1

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>
2
  • Does anything add to transaction_id?
    – zus
    Commented Aug 19, 2019 at 7:17
  • I have updated my comment Commented Aug 19, 2019 at 7:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.