RE: How to add script injector from 3rd party API?
Yes, its D365 Commerce. Now the alert and console.log is working without adding the script tags. For our main goal we have a third party external script that tracks (add to cart, remove from cart and purchase in cart) transactions. Currently we add a external script and internal script see attached file below.

As per said in the previous message 3rd party API they recommend that this be put in the <head> element on each page. Also we used to move up the external script to be sure its initiate the script first.
Our challenges now is the inline script showing its called first because of the error "Cannot read property 'config' of undefined" we sure that external script is working because we can access it in the browser. Another challenges is how we inject the script on the the add to cart, remove from cart and purchase in cart buttons or methods.