So I have this function:
function ads(argument0)
{
var div=document.createElement("div");
div.id="ads";
div.style.display="none";
div.style.zIndex="1";
div.style.position="fixed";
document.getElementById("gm4html5_div_id").insertBefore(div,document.getElementById("canvas"));
var script=document.createElement("script");
script.type="text/javascript";
script.src=argument0;
div.appendChild(script);
}
argument0 being the link to the ad script.
Problem is, when running it I get this error:
Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.
I've seen a few topics here, but unfortunately none of them helped me. My question is, what would I need to do or add so the external script gets executed?
Please note, I only know enough js to get by.
If you're using Adwords for the ads, it looks that Google provide a fix to this issue. First you have to implement the conversion_async.js from googleadservices.com : just add this to your head:
then fire the asynchronous AdWords Remarketing Tag can be fired on page load by calling the google_trackConversion function like this:
You can read the full doc here: https://developers.google.com/adwords-remarketing-tag/asynchronous/