is it possible to load an advertisers script tag & code on function call or ajax? (async maybe)?

this is the code i get from the advertiser. i cant seem to add it dynamically. i understand you cant use document.write after load page so is there a way to run this?

<script type="text/javascript">
                            atOptions = {
                                'key' : '4d65e082e738af430fa34ddeac916be6',
                                'format' : 'iframe',
                                'height' : 250,
                                'width' : 300,
                                'params' : {}
                            };
                            document.write('<scr' + 'ipt type="text/javascript" src="//www.topcreativeformat.com/4d65e082e738af430fa34ddeac916be6/invoke.js"></scr' + 'ipt>');
                        </script>

they also gave me this code

<script async="async" data-cfasync="false" src="//pl22464107.profitablegatecpm.com/70dc149ec489e883ffe0c36bd73d05d0/invoke.js"></script>
                                <div id="container-70dc149ec489e883ffe0c36bd73d05d0"></div>