lazy loading adsense ad slots

674 views
Skip to first unread message

Fabio Fatuzzo

unread,
Mar 16, 2017, 9:24:32 AM3/16/17
to mod-pagespeed-discuss
Hello,

I love your pagespeed module.
Would it be possible to consider to add a lazy loading feature that applies to multiple AdSense ad slots which work for different ad sizes?
thanks,

fabio

Maksim Orlovich

unread,
Mar 17, 2017, 12:37:03 PM3/17/17
to mod-pagesp...@googlegroups.com
Hi... How are you currently loading your ads? If it's via show_ads.js,
the make_show_ads_async filter sounds like what you want,
and it should pick up the slot size for the snippet.

https://modpagespeed.com/doc/filter-make-show-ads-async
> --
> You received this message because you are subscribed to the Google Groups
> "mod-pagespeed-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mod-pagespeed-di...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/mod-pagespeed-discuss/6f8d155f-c801-41c4-b23e-7f4be9df603c%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Fabio Fatuzzo

unread,
Mar 18, 2017, 10:28:24 AM3/18/17
to mod-pagespeed-discuss
Hi this is as a sample of adsense code I use and that already contains an async instruction within the script tag:
<style>
.example_responsive_1{width:300px;height:250px}
@media (min-width:500px) {.example_responsive_1 {width:336px;height:280px}}
@media (min-width:800px) {.example_responsive_1 {width:728px;height:90px}}
</style>
<!-- 4icu.org-Level3_Bottom --> 
<ins class="adsbygoogle example_responsive_1" 
style="display:inline-block;min-width:250px;max-width:1140px;width:100%;height:100%" 
data-ad-client="ca-pub-MYADSENSEID" 
data-ad-slot="3298737036
data-ad-format="rectangle"></ins> 
<script>(adsbygoogle=window.adsbygoogle||[]).push({});</script>


However async still downloads the ads included in a page no matter whether they are located in the page if I am not wrong. So if I have three adsense ad slots in the same page async will defer the ad load but not avoid the heavy load itself like lazy loading would do.
If mod pagespeed would include a lazy load option that prevent the bottom ads to be downloaded before they are scrolled down and visible it would save so much total page size for those visitors that do not bother scrolling till the end of the page.
Our homepage at http://www.4icu.org takes 4 seconds to load and has a total size of 1.16MB when including two ad slots and a custom search engine (Ref. https://gtmetrix.com/reports/www.4icu.org/t92yPI4I )
Where a second test home page at http://www.4icu.org/index2.htm only takes 0.7 seconds and just 55kb when removing both adsense ad slots and the Google custom search engine (Ref. https://gtmetrix.com/reports/www.4icu.org/JTg1h6fK )
So more than 1 MB of total page size and 3 seconds of page load time are just due to the two Adsense slots and the Google Custom Search.
Any mod-pagespeed that would lazy load the adsense ad slots placed at the below the initial fold view would help limiting the page size and increase the page load speed considerably.
The only officially approved solution I found for lazy loading ads is the one suggested in the Double Click for Publishers help page at https://support.google.com/dfp_premium/answer/4578089#lazyloading by using specific tags.
If a specific option for lazy loading adsense ad slots was included in the mod-pagespeed it would be very beneficial for all publishers monetizing through Adsense.

Cheers


On Saturday, March 18, 2017 at 3:37:03 AM UTC+11, Maksim Orlovich wrote:
Hi... How are you currently loading your ads? If it's via show_ads.js,
the make_show_ads_async filter sounds like what you want,
and it should pick up the slot size for the snippet.

https://modpagespeed.com/doc/filter-make-show-ads-async

On Thu, Mar 16, 2017 at 9:24 AM, Fabio Fatuzzo <wor...@gmail.com> wrote:
> Hello,
>
> I love your pagespeed module.
> Would it be possible to consider to add a lazy loading feature that applies
> to multiple AdSense ad slots which work for different ad sizes?
> thanks,
>
> fabio
>
> --
> You received this message because you are subscribed to the Google Groups
> "mod-pagespeed-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
Reply all
Reply to author
Forward
0 new messages