How to place CDATA brackets in PageWrapper Editor?

Options

I've been trying to add a "remarketing pixel" script from our banner ad vendor into the bottom of the body element of our pagewrapper.  Unfortunately the Javascript code contains double brackets as part of a CDATA section and Convio seems to be parsing it.  (Because it's like a "Session (S) Tag"?)

imageIs there any way to escape brackets like that?

cdata-brackets.jpg

Tagged:

Comments

  • Cory,

    You have a couple options here:

    1) Remove the CDATA comment. Doing so might case validation errors, but shouldn't actually break anything.

    2) Rather than using document.write, append the JavaScript like so:



    <script type="text/javascript">
    var ebRand=Math.random()+'';
    ebRand=ebRand*1000000;
    var docBody=document.getElementsByTagName('body');
    var myScript=document.createElement('script');
    myScript.type='text/javascript';
    myScript.src='http://bs.serving-sys.com/BurstingPipe/ActivityServer.bs?cn=as&amp;ActivityID=43896&amp;rnd='+ebRand;
    docBody.appendChild(myScript);
    </script>

    3) Move the JavaScript into an external file.

  • Noah Cooper:

    Cory,

    You have a couple options here:

    1) Remove the CDATA comment. Doing so might case validation errors, but shouldn't actually break anything.

    2) Rather than using document.write, append the JavaScript like so:



    <script type="text/javascript">
    var ebRand=Math.random()+'';
    ebRand=ebRand*1000000;
    var docBody=document.getElementsByTagName('body');
    var myScript=document.createElement('script');
    myScript.type='text/javascript';
    myScript.src='http://bs.serving-sys.com/BurstingPipe/ActivityServer.bs?cn=as&amp;ActivityID=43896&amp;rnd='+ebRand;
    docBody.appendChild(myScript);
    </script>

    3) Move the JavaScript into an external file.

    One additional thing -- you should change the protocol to https, or else this will cause browser security warnings on secure Convio pages.

  • Noah Cooper:

    One additional thing -- you should change the protocol to https, or else this will cause browser security warnings on secure Convio pages.

    Thanks again, Noah.  I'm sending your recommendations off to the ad team to let them choose their own adventure.

    I'll try to post back with any interesting details.

    Thanks,

    Cory

Categories