What Is Lazy Loading?
The lazy loading HTML attribute is a technique web pages use to optimize the load time. So when the lazy load is activated, the web page only loads the content the user is consuming at that time. This delays the loading of the media that the user is yet to see, enhancing the overall performance and decreasing loading times.
How Does Lazy Loading Work?
- Firstly, Lazy loading puts a reference src attribute to the lazily loaded web page resources (image, video, etc.).
- Then, it adds another attribute to the original content.
- As the user reaches the reference object, the lazy load replaces the reference src attribute with the actual src and loads the content.
This implies that if a visitor opens a web page and leaves it immediately, then nothing beyond the top portion of a web page is loaded.
Why Should We Add Lazy Load?
Every visitor expects a web page to load in the blink of an eye. So you must find ways to improve your web page’s load times, and lazy loading is one of the best ways for this job.
Generally, when a user opens a web page, the entire page’s contents start downloading and rendering, annoying the users to bounce from the page. However, by enabling Lazy Load, you can prevent this by giving the users exactly what they need – Loaded content!
Also, loading assets on runtime reduce the number of requests a page sends to the server for the initial load, resulting in faster and minimal communication between WordPress server and the visitor in one go.
To see the practical results, we will test the impact of lazy load on a site’s performance. And for that, we will use GTMetrix to test the performance metrics before and after activating the lazy load plugin. You can also use any other speed test tool for evaluating the website’s performance.
Website Performance before and after Activating Lazy Load Plugin
The image below shows the website’s GTMetrix grade before and after lazy load.
We noticed the following results:
- The grade moved from C to B, demonstrating an upgrade in ranking and Core Web Vitals.
- The performance also increased from 70% to 90%
- The structure decreased from 91% to 90%
Note: The performance and structure aren’t just affected by the website’s speed. Many other factors, like image optimization plugins and lightweight themes, also play their part.
Check how to improve your Google PageSpeed Insight scores to learn more about enhancing website performance!
A website’s loading time is an important parameter to judge the impact of the lazy load plugin.
Here are the stats before and after using the lazy load plugin:
- The time taken to load First Contentful Paint reduced from 3s to 2.0s
- The time to interact reduced from 6s to 2.4s
- The time taken to load the Largest Contentful Paint reduced from 7s to 2.3s
- The onload time was reduced from 1s to 2.8s
- The fully loaded time was reduced from 9s to 3.1s
This shows that using the lazy load plugin increases your site’s speed and creates a seamless and uninterrupted user experience.
How to Add Lazy Load to a WordPress Website
Implementing lazy load in WordPress content is not that technical, thanks to the WordPress Community for their contributions.
I am assuming you already have a functional WordPress site. If you don’t, set up now using Cloudways managed hosting platform.
Managed WordPress Hosting Starting From $10/Month
Launch a full-fledged WordPress site in under 10 minutes. Easy scaling. Unmatched Performance & Uptime.
Follow the steps below to add lazy load to a WordPress website:
- Go to your WordPress Dashboard > Plugins > Add New
- Search for the A3 Lazy Load Plugin
- Install and Activate the plugin
- After you’ve activated the plugin, click settings
- Now you’ll be redirected to the settings screen. Open each set to customize it as per your needs.
Usually, WordPress automatically inserts the loading attribute to all the images, texts, URIs, videos, iframes, and other elements on the website as a part of its default settings. However, you can play with the toggle buttons for further customization.
For example, you can apply the lazy load effect to speed up the website’s core.
WordPress Lazy Load Images
You can lazy load images using the a3 Lazy Load plugin.
Images are resource-intensive and consume a lot of bandwidth and storage space. Not only this, but the lazy loading feature for images also lets you control where it should work, including:
- Post, pages, and custom post types (all content areas)
- Widgets (sidebar, header, and footer)
- Apply to post thumbnails
- Apply to Gravatars
WordPress Lazy Load Videos and iFrames
a3 Lazy Load is not limited to images but also allows you to lazy load video content. It supports all WordPress video embeds that use iFrames to load videos on the initial load. It contains toggles for ON/OFF. When turned on, you can control the below-mentioned areas:
- Videos embedded by URL in posts and pages (all content areas)
- Videos in widget types, text widgets, and HTML widgets
- Fully Compatible with the popular YouTube Embed Plugin
WordPress Lazy Load Comments
Many WordPress users use WordPress comment plugins. And most of them support lazy loading via WordPress lazy load plugins.
You can use:
- Lazy Load for Comments for default WordPress comments
- Disqus Conditional Load for Disqus comments
- Lazy Facebook Comments for Facebook comments
- Click Save changes once you’ve played with the lazy load’s settings.
- Finally, reload your website to see the results.
More Lazy Loading Plugins for WordPress
Besides a3 Lazy Load, there are a number of useful plugins for lazy load in the WordPress plugin repository that you may consider:
- BJ Lazy Load
- WordPress Infinite Scroll – Ajax Load More
- Lazy Load by WP Rocket
- Load More Products for WooCommerce
- Lazy Load for Comments
- Disqus Conditional Load
- Lazy Load for Videos
3 Use Cases of Lazy Load
Optimizing images on a WordPress website is crucial as it can impact the website’s loading time. This is why the lazy load is mainly used for images and other media elements. You can use it to integrate with videos, comments, scripts, etc.
All popular sites use lazy loading images in one way or another. Here are a few of them:
If you have visited Medium, you must have observed that it displays a blurred placeholder for lazy load images until the actual high-resolution image has been fully loaded, so visitors know that an image is loading.
This improves the user experience by showing some initially loaded content to keep their attention.
By default, the first thing YouTube shows is the video you intend to watch and does not initially load comments and thumbnails of other suggested videos. When you start scrolling, the lazily loaded items like thumbnails and comments start loading.
This way, the visitor doesn’t wait for an entire page to load and can start watching the video immediately.
3. Google Images
When you search for an image on Google, it replaces placeholder images with thumbnails and loads more images later.
Google uses a unique approach by combining infinite scrolling and lazy loading to improve its search results.
Does Lazy Load Affect SEO?
Lazy Load is not SEO-Friendly. Since the content (Images, Videos, Comments, etc.) aren’t loaded initially for visitors, the same flow is for search engine crawlers. There is a possibility that the Lazy Loaded content (image, videos) may not index in the Google images/video section, which is not good from the SEO perspective.
The workarounds do exist, like adding links to your Lazy Loaded content. This way, Google will take it as a standard web page and index the content accordingly.
However, the visitors will still see a web page as Lazy Loaded.
Google is working and preparing the help documents around how one can take advantage of Lazy Loading and get the Lazy Loaded content discoverable by GoogleBot.
The human attention span is incredibly short. Therefore, if you wish to have more users on your web page, you must ensure to give them a seamless user experience and don’t keep them waiting.
And you can do this by activating Lazy Load on your WordPress website. It will optimize your website’s performance, increase the loading speed of the content and improve user experience.