wiley / madgex-lazy-ads

Deliver synchronous ads asynchronously, without modifying the ad code. Also, conditionally load ads for responsive websites using a media query or the ad container's dimensions.
MIT License
656 stars 42 forks source link

Strip only the outermost comment and add data-lazyad-code attribute. Fix #19 #20

Closed emilv closed 7 years ago

emilv commented 8 years ago

Fix #19

ppc1337 commented 8 years ago

Looks like its not working. Thats the code I use:

<div class="ad" data-lazyad data-matchmedia="only screen and (min-width: 1023px)" style="text-align:right;">
    <script type="text/lazyad" data-lazyad-code="&lt;script type=&quot;text/javascript&quot; language=&quot;JavaScript&quot;&gt;
glam_affiliate_id = &#39;1659609295&#39;;&lt;/script&gt;
&lt;script src=&quot;https://www8.glam.com/js/widgets/glammedia_logo.js&quot;&gt;&lt;/script&gt;"></script>
  </div>

Nothing is shown ...

emilv commented 8 years ago

Works for me. We have been running this in production for two months. For example:

                            <div class="ad" data-lazyad data-matchmedia="only screen and (min-width: 980px)">
                     <script type="text/lazyad" data-lazyad-code="                  &lt;div style=&quot;clear: both; margin-bottom: 30px;&quot;&gt;
                        &lt;div id=&quot;firsttopbanner&quot; class=&quot;desktop&quot; style=&quot;max-width:980px; width:100%;margin:0 auto;&quot;&gt;
                            &lt;!--JavaScript Tag // Tag for network 1568: Leeads // Website: Leeads AB | Intressesajt | Kimura.se // Page: Kimura.se | Genomgående // Placement: Kimura.se - Panorama #1 - 980x240 (5673186) // created at: May 15, 2015 9:06:10 AM--&gt;
        &lt;script language=&quot;javascript&quot;&gt;&lt;!--
        document.write('&lt;scr'+'ipt language=&quot;javascript1.1&quot; src=&quot;http://adserver.adtech.de/addyn/3.0/1568/5673186/0/2649/ADTECH;loc=100;target=_blank;grp=[group];misc='+new Date().getTime()+'&quot;&gt;&lt;/scri'+'pt&gt;');
        //--&gt;
        &lt;/script&gt;&lt;noscript&gt;&lt;a href=&quot;http://adserver.adtech.de/adlink/3.0/1568/5673186/0/2649/ADTECH;loc=300;grp=[group]&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://adserver.adtech.de/adserv/3.0/1568/5673186/0/2649/ADTECH;loc=300;grp=[group]&quot; border=&quot;0&quot; style=&quot;max-width:980px; width:100%;&quot; height=&quot;240&quot;&gt;&lt;/a&gt;&lt;/noscript&gt;
        &lt;!-- End of JavaScript Tag --&gt;                        &lt;/div&gt;
                    &lt;/div&gt;
                "></script>
                </div>
ppc1337 commented 8 years ago

Hmm, strange. How did you include which js-File of the lazy ads? Do you use lazyad-loader.min.js or some of the other files?

emilv commented 8 years ago

We use lazyad-loader.min.js but you need the version that can be built from this patch (the compiled file is not included in this PR, you have to build it yourself).

ppc1337 commented 8 years ago

Okay, I tested it a few hours now, but - depending that I'm not very familiar with github and coding - without any luck. I looked at your site and saw that everything works fine, on my site it didn't. Is it possible that you send me your lazy-ad-package via e-mail? I then will upload it to my site, change the ownership and stuff and hopefully then it will work.

emilv commented 8 years ago

No, sorry. I have submitted this patch because it helps everybody. I'm not interested in providing support. Go ask a local web development company.

ppc1337 commented 8 years ago

ok, but "this patch because it helps everybody" seems not really true, also the patch conlicts with "I'm not interested in providing support". Thanks anyway

jameswragg commented 7 years ago

A (very) late reply but ad code in an attribute is not something we want to support. Feel free to for the project with this functionality.

To note - we're winding down use of this library as ad providers seem to be finally getting RWD.