Track Google Adwords conversion with javascript

IF you want to track asynchronously the adwords conversions in your page, the most elegant way to do this is by using the Asynchronous AdWords Remarketing Tag

You don’t need to configure anything regarding the Remarketing Tag.

Just include the script

<script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion_async.js" charset="utf-8"></script>

in the head and then whenever you want to track something call the below function

window.google_trackConversion({
   google_conversion_id: {YOUR_GOOGLE_CONVERSION_ID},
   google_conversion_language: 'en',
   google_conversion_format: '3',
   google_conversion_color: 'ffffff',
   google_conversion_label: {YOUR_GOOGLE_CONVERSION_LABEL},
   google_conversion_value: {THE_VALUE},
   google_conversion_currency: {THE_CURRENCY},
   google_remarketing_only: false
});

Example:

Let’s say you have a success event on form submit.

$('.checkout-form').on('success', function(){
   window.google_trackConversion({
      google_conversion_id: {YOUR_GOOGLE_CONVERSION_ID},
      google_conversion_language: 'en',
      google_conversion_format: '3',
      google_conversion_color: 'ffffff',
      google_conversion_label: {YOUR_GOOGLE_CONVERSION_LABEL},
      google_conversion_value: {THE_VALUE},
      google_conversion_currency: {THE_CURRENCY},
      google_remarketing_only: false
   });
});

then when this event fires the above code will run and send the conversion !