Drupal 8 Load dyanmic javascript files external to the website on the fly. In ths case :
$domain => being the esternal domain. $api_key => being the dynamic value that completes the javascript file.
eg: 'https://myexternaldomain.com/478a12b-c8eb-4134-8c70-9bd66c4cf9e7.js';