Integrate affiliateTracking Pixel

157 views Asked by At

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);
0

There are 0 answers