cancel
Showing results for 
Search instead for 
Did you mean: 

How to add order tracking code executed on place order but before redirection to payment gateway

How to add order tracking code executed on place order but before redirection to payment gateway

I need to integrate my Magento shop with some third party order tracking service. The service provider asked me to include some code on the last page of the checkout process when the order is created but before a customer is redirected to the payment gateway. I use one page checkout and payment service extension and there is no intermediate page between place order button click and the redirect to add the code on.

Simplified version of the code is something like this:

<script type="text/javascript">var webOrder = {
"id": shop_id,
"sum": order_value
};</script>
<script type="text/javascript" src="//serivce_address/before.js"></script>

I do not want this code to execute until customer accepts agreements and clicks place order and the order is accepted. How can I do that?