when I test page by optimizer, it suggest me use async for all CDN sources what I use.
To run any script I use
(function(){})();
I use a
If I understood your problem correctly, you want to run inline script when the async script tag is loaded.
You can use onload event of the script tag.
onload
function runInline() { console.log('inline script run') }