WordPress.org

Ready to get started?Download WordPress

Forums

TablePress
[resolved] Ad Not showing In Table (12 posts)

  1. yoyoma1974
    Member
    Posted 1 year ago #

    I saw another post about an Adsense ad not showing and saw the resolution to that but this ad code is slightly different and that solution won't seem to work. Any other possible causes and/or solutions for getting this ad code to appear in the TablePress table?

    <script type='text/javascript'>
    <!--//<![CDATA[
    document.MAX_ct0 ='';
    var m3_u = (location.protocol=='https:'?'https://cas.criteo.com/delivery/ajs.php?':'http://cas.criteo.com/delivery/ajs.php?');
    var m3_r = Math.floor(Math.random()*99999999999);
    document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
    document.write ("zoneid=70528");document.write("&nodis=1");
    document.write ('&cb=' + m3_r);
    if (document.MAX_used != ',') document.write ("&exclude=" + document.MAX_used);
    document.write (document.charset ? '&charset='+document.charset : (document.characterSet ? '&charset='+document.characterSet : ''));
    document.write ("&loc=" + escape(window.location));
    if (document.referrer) document.write ("&referer=" + escape(document.referrer));
    if (document.context) document.write ("&context=" + escape(document.context));
    if ((typeof(document.MAX_ct0) != 'undefined') && (document.MAX_ct0.substring(0,4) == 'http')) {
    document.write ("&ct0=" + escape(document.MAX_ct0));
    }
    if (document.mmm_fo) document.write ("&mmm_fo=1");
    document.write ("'></scr"+"ipt>");
    //]]>--></script>

    Thanks for any help.

    Tim

    http://wordpress.org/extend/plugins/tablepress/

  2. yoyoma1974
    Member
    Posted 1 year ago #

    Forgot to mention that this is the type of ad that requires the user to have first visited a certain site(like TheNorthface.com), and have added an item to the shopping cart). Only then will it appear to the user who hits a page wit this code on it.

  3. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Tim,

    thanks for your post.

    The reason for this problem are probably the line breaks in the code. These get transformed to HTML <br /> tags automatically, when the table is shown, and this breaks the code.
    To prevent that, you should either remove all manual line breaks from the cell, so that everything would stand in one line, if the width of the textarea is increased by dragging the lower right corner.
    Another option would be use the latest development version of TablePress from http://tablepress.org/downloads/tablepress-dev.zip (or wait for 0.9-RC in a few weeks) and then change your table's Shortcode from something like

    [table id=123 /]

    to

    [table id=123 convert_line_breaks=false /]

    The new parameter prevents the automatic conversion of the line breaks, so that your code should work as expected. You will then however need to add <br /> manually to all places where you want line breaks in that table.

    Regards,
    Tobias

  4. yoyoma1974
    Member
    Posted 1 year ago #

    Hi Tobias,

    Thanks for the response. I removed all the line breaks manually but it's still not appearing. I looked in Google Inspector and it seems that it's just not recognizing the code as code, I think it's seeing it as commented out code(it's colored in green). I attached 2 screenshots that show you what I mean.

    Part of the page(outside the table, where the ad is working) http://screencast.com/t/q0rAvsYUg6o8

    From a cell in the table where it's not working
    http://screencast.com/t/KciP7ym1

    I also tried removing it from the top incase the code can only appear once on the page but it still didn't work.

    Tim

  5. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Tim,

    I then suggest that you remove the

    <!--//<![CDATA[

    and

    //]]>-->

    These are not necessary in modern browsers.

    If that also does not help, please post a link to the page with the table, so that I can take a direct look.

    Regards,
    Tobias

  6. yoyoma1974
    Member
    Posted 1 year ago #

    Hi Tobias,

    Thanks for the continued help. Unfortunately after removing those characters I still can't get it working. Here's the page it should be appearing.

    http://www.askandyaboutclothes.com/selected-merchants/clothing-merchants

    But you'll actually have to go to zappos and add a product to the cart, then come back to this page, to see it appear. It should appear at the top, that's the code I placed outside the table.

    But I also placed it in the final table row all the way at the bottom.

    Thanks again.

    Tim

  7. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Tim,

    when I open that site, I can see a script error in the Chrome Developer Tools that points to the line with your JavaScript. Could that be it?

    Other than that, I'm out of ideas here. The code appears in the final HTML source of the page, and it has in no way been altered by TablePress. Small scripts like

    <script>alert('test');</script>

    work fine for me in table cells.

    Sorry that I can't really help with this :-(

    Regards,
    Tobias

  8. yoyoma1974
    Member
    Posted 1 year ago #

    I'll look into that script error. Thanks for all the help.

    Tim

  9. yoyoma1974
    Member
    Posted 1 year ago #

    oh wait, it appears that all the Ampersands in the original code are being replaced by their HTML equivalent "&" in TablePress, which is probably causing that error right?

    <script type='text/javascript'><!-- //<![CDATA[ document.MAX_ct0 =''; var m3_u = (location.protocol=='https:'?'https://cas.criteo.com/delivery/ajs.php?':'http://cas.criteo.com/delivery/ajs.php?'); var m3_r = Math.floor(Math.random()*99999999999); document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u); document.write ("zoneid=70528");document.write("&nodis=1"); document.write ('&cb=' + m3_r); if (document.MAX_used != ',') document.write ("&exclude=" + document.MAX_used); document.write (document.charset ? '&charset='+document.charset : (document.characterSet ? '&charset='+document.characterSet : '')); document.write ("&loc=" + escape(window.location)); if (document.referrer) document.write ("&referer=" + escape(document.referrer)); if (document.context) document.write ("&context=" + escape(document.context)); if ((typeof(document.MAX_ct0) != 'undefined') && (document.MAX_ct0.substring(0,4) == 'http')) { document.write ("&ct0=" + escape(document.MAX_ct0)); } if (document.mmm_fo) document.write ("&mmm_fo=1"); document.write ("'></scr"+"ipt>");//]]> --> </script>

    <script type='text/javascript'>
    <!-- //<![CDATA[ document.MAX_ct0 =''; var m3_u = (location.protocol=='https:'?'https://cas.criteo.com/delivery/ajs.php?':'http://cas.criteo.com/delivery/ajs.php?'); var m3_r = Math.floor(Math.random()*99999999999); document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u); document.write ("zoneid=70528");document.write("&nodis=1"); document.write ('&cb=' + m3_r); if (document.MAX_used != ',') document.write ("&exclude=" + document.MAX_used); document.write (document.charset ? '&charset='+document.charset : (document.characterSet ? '&charset='+document.characterSet : '')); document.write ("&loc=" + escape(window.location)); if (document.referrer) document.write ("&referer=" + escape(document.referrer)); if (document.context) document.write ("&context=" + escape(document.context)); if ((typeof(document.MAX_ct0) != 'undefined') && (document.MAX_ct0.substring(0,4) == 'http')) { document.write ("&ct0=" + escape(document.MAX_ct0)); } if (document.mmm_fo) document.write ("&mmm_fo=1"); document.write ("'></scr"+"ipt>");//]]> --> </script>

  10. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    ah, great catch! Yes, that could be it!

    This shouldn't be a problem with the & that are part of the URL that is constructed by the script, but there's one line, which contains a &&, and when that is replaced by &#038;&#038;, the JS probably breaks.

    However, I'm not really sure how to proceed with this. The same happens in my tests, too, when I copy your original JS (from the very first post in this thread) in a page... And it happens with something simpler, like

    <script type="text/javascript">var a=true,b=true; if (a&&b) console.log("test");</script>

    So, WordPress also applies this replacement in regular posts and pages...

    One workaround might be to create a small plugin with a Shortcode that then adds this JS code...

    Regards,
    Tobias

  11. yoyoma1974
    Member
    Posted 1 year ago #

    Thanks for the idea, might try that.

    Tim

  12. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Tim,

    great, please try that! If that also makes problems, we'll investigate it deeper with that solution.

    Best wishes,
    Tobias

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic