title: How to perform custom javascript on place order but before redirection to payment gateway in Magento 1.9?
body: <p>I need to integrate my Magento with some order tracking service.
  The service provider asked me to include some code on the last page of the checkout process but before a customer is redirected to the payment gateway. I use one page checkout.
  Simplified version of the code is something like this</p>
  <pre><code>&lt;script type=&quot;text/javascript&quot;&gt;
  var webOrder = {
  &quot;id&quot;: shop_id,
  &quot;sum&quot;: order_value
  };
  &lt;/script&gt;
  &lt;script type=&quot;text/javascript&quot; src=&quot;//serivce_address/before.js&quot;&gt;&lt;/script&gt;
  </code></pre>
  <p>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?</p>