Seeking to integrate legacy javascript code for affiliate tracking into an angularjs app
<script type="text/javascript">
//<![CDATA[
/*** Do not change ***/
var AWIN = {};
AWIN.Tracking = {};
AWIN.Tracking.Sale = {};
/*** Set your transaction parameters ***/
AWIN.Tracking.Sale.amount = '{{order_total}}';
AWIN.Tracking.Sale.orderRef = '{(order_id}}';
AWIN.Tracking.Sale.parts = '{{cats}}';
AWIN.Tracking.Sale.voucher = '';
AWIN.Tracking.Sale.currency = 'GBP';
AWIN.Tracking.Sale.test = '0';
AWIN.Tracking.Sale.channel = 'aw';
//]]>
</script>
Looking for the best approach to include the above code (populating placeholders with angular vars) and then execute this:
<script src="https://www.dwin1.com/xxxx.js" type="text/javascript" defer="defer"></script>
Any suggestions on how to achieve this? Attempts have been made to place the code within an Angular function without success, as well as passing the vars down to $window and attempting to insert them into CDATA on my end to no avail. Any thoughts?
Note: This code is contained in an HTML page encapsulated within an angularjs controller