I want to include two types of ads into my React.js Web app
<script async="async" data-cfasync="false" src="//somewebstite.com/invoke.js"></script>
<div id="container-4foobarbaz"></div>
and this ad as well:
<script type="text/javascript">
atOptions = {
'key' : 'somekey',
'format' : 'iframe',
'height' : 250,
'width' : 300,
'params' : {}
};
document.write('<scr' + 'ipt type="text/javascript" src="http' + (location.protocol === 'https:' ? 's' : '') + '://www.cdnwebsite.com/invoke.js"></scr' + 'ipt>');
How Can I include this in my React App? I have tried a few things but none have them have worked including:
const script = document.createElement("script");
script.async = true;
script["data-cfasync"] = true;
script.src = "//somewebstite.com/invoke.js"
this.div.appendChild(script);
and this in the render:
<div id="container-4foobarbaz" ref={el => (this.div = el)} >
</div>