By Laia Cardona, on 23 February 2023
If you have a website or an ecommerce site for your business, it most likely contains a lot of images, videos, and data. This large amount of information can slow down the loading of your website, harming not only the user experience, but also your SEO positioning in search engines. But did you know there was a secret weapon you could use? In this article we’ll explain what lazy loading it and how to implement it.
What Is Lazy Loading?
We’ve all had this experience: you open a web page and it takes so long to load that you get tired of waiting and give up. This is a very common situation, and it could happen with your own website or ecommerce. To avoid this, it is very important that you utilize lazy loading or deferred loading, a computer programming design pattern that will only loads resources as the user reaches them, instead of all at once as soon as the URL is loaded.
Lazy loading increases website responsiveness and makes the user journey more satisfactory and fluid.
To better understand the concept of lazy loading, think of Instagram. As you scroll down the content quickly loads and appears, because not everything is loaded as soon as you open the application. This is how they are able to keep the app loading quickly.
Lazy Loading and Tracking Pixels
It is very important that when implementing lazy loading on your website you do not forget about tracking pixels that track the behavior of your audience and provide you with data about their preferences. These pixels are sometimes found only in the non-visible area of the website, so if you apply deferred loading, they will only load when they are visible, causing you to lose a lot of information about conversions and clicks.
To prevent this from happening when you enable deferred loading, you must set the tracking pixel to load independently from the rest of the elements when someone loads the web page.
There are two options to do this:
- Add the loading="eager" attribute to the tracking pixel. This is the alternative you should implement if you have a native implementation of lazy loading.
- If, on the other hand, you implement lazy loading with JavaScript, you must assign the pixel a specific class that you have discarded from the JavaScript code.
Lazy Loading: Advantages and Disadvantages
There are many advantages to using lazy loading on your website, including:
- Shorter loading time
- Better positioning in search engines. In fact, Google recommends lazy loading
- Reduced bounce rate
- Increased time spent on the page
- Improved user experience
- Higher conversion rates
On the other hand, there are a few disadvantages:
- If you perform the integration with JavaScript, users entering your website will have to previously accept the scripts
- Also if you use JavaScript, you will require extra code when you incorporate delayed loading
- You may need to equip yourself with an external library
How to Implement Lazy Loading?
WordPress
If you have used WordPress to create your website, it is very easy to implement lazy loading, as you only need to download a plugin. Currently there are many available such as: Speed Up - Lazy loading, a3 Lazy Load or Smush, among others. Some of them allow you to lazy load a wide variety of embedded content types as well, beyond just images and videos.
HubSpot
To do lazy loading on HubSpot you’ll have to take into account a few different aspects, because depending on your situation you may or may not have to perform some certain actions.
If you are using the default image module, you will simply need to select the "lazy" option in the "image upload" box that appears in the image editor.
If, on the other hand, you are using a custom module that contains an image field, the default loading options will appear, so you will simply need to select the "lazy" alternative.
Finally, if the image you are using is within a rich text, it will already be set to deferred loading by default.
By Source Code
You can also implement deferred loading manually, which is not as complicated as it seems because the "loading" attribute has been a standard part of HTML since 2020. Therefore, you only have to include the value "lazy" next to the "loading" parameter in the HTML language.
- For embedded resources:
- For images: loading="lazy" src="https://mitisio.com/img/logo" width="240" alt="" />
- For images that are part of "picture":
In addition to "lazy", there are other HTML values for "loading", such as auto (loading is set generally in the browser) or eager (all resources are loaded when the user accesses the web page regardless of its location).
Hopefully now you can make your website and ecommerce pages more functional for your audience. Remember that keeping your platforms in optimal condition is fundamental for your online presence to be positive and to increase your level of authority in your sector.