Knowledge Base      


How do I get my SiteScout pixel to work with ClickMagick?


To use SiteScout pixels with ClickMagick, you need to change one line of code in the JavaScript pixel code that they give you. ClickMagick doesn’t allow backslash “\” characters in pixel codes so all you need to do is replace the original line of code with a slightly rewritten one. Fortunately, this is a fairly straightforward fix.

The problematic line in the SiteScout pixel is this one:

doc.open().write('<body onload="window.location.href=\''+syncUrl+'\'">');

That line can be rewritten to remove the “\” characters like this:

doc.open().write("<body onload='window.location.href="+'"'+syncUrl+'"'+"'>");

One easy way to replace the line of code is to take the pixel code you get from SiteScout and paste it into a JavaScript beautifier program like this one:
   

After you’ve pasted your SiteScout pixel into the JavaScript Beautifier, click on the button that says “Beautify JavaScript or HTML” at the bottom of the edit window:


   
 

That will reformat your code so that it’s easy to replace the original line of code with the corrected, non-“\” version, above. After you’ve made the replacement, the tail end of your fixed pixel code should look like this:

      ...
      var doc = iframe.contentWindow.document;
      doc.open().write("<body onload='window.location.href="+'"'+syncUrl+'"'+"'>");
      doc.close();
   })(document);
</script>

 

Once you’ve replaced the line of code, your SiteScout pixel will work correctly with ClickMagick.

Article 314 Last updated: 01/14/2020 5:57:43 PM
https://www.clickmagick.com/kb/?article=314