0

I am trying to integrate an affiliate pixel in my website, but since Im an JS beginner, i cant figure out how to. I copied some code and tried to adopt it to my needs, which worked well for Criteo, but not for Affilinet.

Please find below the code, I use to call the script. The error I get in the console seems to be related to asynchronous calling: "Failed to execute"write" on "Document": It isn't possible to write into a document from an asynchronously-loaded external script, unless it's explicitily opened.

Can anyone tell me, what I need to change to make this work? Do I need a different script, that works with async calls?

Thank you so much for your help!

    var affilinet = document.createElement('script');
affilinet.type = 'text/javascript';
affilinet.async = true;
affilinet.src = 'http' + ("https:" == document.location.protocol ? "s" : "") + '://partners.webmasterplan.com/art/JS/param.aspx';  // Pfad zu param.aspx

(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0] || document.getElementsByTagName('script')[0].parentNode).insertBefore(affilinet, null);
Fabien Benoit-Koch
  • 2,784
  • 2
  • 21
  • 33
Andi
  • 1
  • This might help: http://stackoverflow.com/a/24297863/744997 – mukesh Jun 16 '15 at 13:42
  • Thanks for the link @mukesh. As far as I understand, this would work for a script, I can modify. Thing is, that the document.write is in an external script and I only embed it. – Andi Jun 16 '15 at 13:53

0 Answers0