Skip to Main Content

Preload hero image to improve LCP in the Field and lab-data

Preload lets you tell the browser about critical resources that you want to load as soon as possible before they are discovered in HTML. This is especially useful for resources that are not easily discoverable, such as fonts included in stylesheets, background images, or resources loaded from a script.

Whenever I run a Page Speed Insights (PSI) test on my post, The hero image or featured image is painted as the Largest Contentful paint (LCP) element.
What is Largest Contentful paint (LCP)? The Largest Contentful Paint (LCP) metric reports the render time of the largest image or text block visible within the viewport, relative to when the page first started loading. Follow article on Largest Contentful Paint for more details.
PSI detect my Hero image or Featured Image as Largest elements on the Viewport (LCP)

The question usually comes to our mind:

  1. Whether to preload the hero image or featured image?
  2. Is it worth preloading or not?

Today in this blog post, I’m going to answer your question with real data or Field data using web-vitals JS libraries and provide you 3rd parties plugin recommendations.

From the field data, webpagetest result, and web-vitals JS data, you can decide whether it is the best decision to preload the hero image or not.

From my research & testing, preloading critical resources like web fonts, and above-the-fold images improves LCP and it can reduce Cumulative Layout Shift (CLS) metrics too and you can see the result in the conclusion.


  1. loading=”lazy
  2. loading=”eager” and
  3. loading=”eager” with rel=”preload
  4. Creative Agency Landing page template with Elementor without any optimization (With Cloudflare as CDN and Cloudinary as image CDN).
  5. Fast 3G connection for testing for details views from Firebase Performance Monitoring services

Effective Connection type in firebase performance monitoring js

Outside my controls:

  1. There are lots of rendering Blocking resources.
  2. Inconsistency in Time for First Byte (TTFB).
  3. The page is tested in fast 3G, which means there is 100 to 500ms latency & the larger the file sizes the more time to parse and download the resources.

Tools I use when testing

Chrome Dev tools

With Fast 3G connection set up while testing without cache.


With a fast 3G connection without cache.

WebPageTest environment while testing

Different loading Attributes:


By default, WordPress will lazyload above-the-fold images by implementing the native lazyloading or Browser Level Lazyloading technique. Filmstrip With browser/native lazy loading technique Waterfall chart You can see the waterfall chart, my featured image is loading at 36 marks in WebPageTest results and when the image is fully loaded LCP is also triggered. See the screenshot below Waterfall showing feature image is loading at 36 row mark Webpagetest Largest Contentful paint Event with loading="eager" attribute


You can see the waterfall chart, my featured image is loading at 29 marks in WebPageTest results which is far better than the loading=”lazy” attribute counterpart and we can see images are loading much earlier even though there are lots of problems with being considered. Filmstrip Eager attribute with hero image

The featured image is loading at a 4.22sec mark in Chrome Dev tools Network panels.

Waterfall chart With Loading="eager" attribute, give were given higher priorities and jump from 36 in waterfall marks to 29

The featured image is loading at 29 marks in WebPageTest results which is much better than the previous one but can be improved further with the help of rel=”preload”

Webpagetest Largest Contentful paint Event Now we can see the inconsistency in LCP measurement because it can be due to Cloudinary & Cloudflare response time.

Loading=”eager” with rel=”preload”:

After implementing the loading=”eager” attribute with rel=”preload” hints, the hero image/featured image is loading much quicker and is visible to the users. Filmstrip- Eager with Preloading Waterfall chart After setting the loading=”eager” attribute and rel=”preload” on my featured image, it is loading at 8 marks in the WebPageTest waterfall chart which is far better than loading=”lazy” and “eager” Improve LCP significantly with rel preload and loading eager attribute

Comparison with all the loading attributes:

  1. First Screenshot: with loading=”lazy” attribute.
With browser/native lazy loading technique
  1. Second screenshot: with Loading=”eager” attribute
Eager attribute with hero image
  1. Third screenshot: With loading=”eager” + rel=”preload”
Eager with Preloading As you can see from the above comparison, there are benefits of preloading the hero image. Here is the comparison in webpagetest, if you want to see it for yourselves. But the question is still there.

Should I preload hero images? (Dilemma)

Thank you to Phil Walton and Barry Pollard for their incredible tutorials on the in debugging web vitals in the field and the smashing magazine respectively, their tutorials help me debug the problems and give me insights on what to do. To answer the question, Yes, it depends on your visitor’s screen size. 

Ways to get the Screen resolution

Google Analytics 4 (GA4)

To get your visitor’s screen resolution, head over to the ‘User’ tab then click the ‘Tech’ and click the Overview to view what browsers, OS, Device category your visitors are using, etc. Follow the steps
  1. Tech
Technology In Google Analytics 4
  1. Overview
Overview in GA4
  1. Select the date and set it to last 28 days or 30 days or more, this way you will see more data
Choose the date
  1. Screen Resolution
Scroll down to see ‘Screen resolution’ and click the ‘view screen resolution’ button. Screen Resolution I used GA 4 for 2 days and discontinued it because GA4 has fewer features (when I was using it) compared to Universal analytics and if I use Google Tag Manager JS to deploy Google Analytics, it will add more weight to my website.

What else can we do with these data?

  1. You can simulate Screen resolution or screen size on your Dev tools or use LT Browser and see if your hero image is in the viewport or not.
  2. You can also simulate and test your site in Browserstack or Lambda (Affiliate Link), etc, and do the same thing.
  3. Using Web-Vitals JS libraries and sending the debug_target in Google Analytics Events data. And figure out whether it is a good idea to preload a hero image or not.
  4. In Advanced testing, you can use the webpagetest – Desktop Browser Dimensions feature (see the screenshot below).Webpagetest advanced settings in advanced testing
One of the ways I used to identify or debug the Largest Contentful Paint(LCP) is by implementing Web Vitals JS libraries and analyzing the data with the help of Data Studio and Web Vitals report. Example use – Remove unused CSS article and creative Landing Page Template.

Debug Largest Contentful Paint Elements with Web Vitals JS:

I use Web-vitals JS libraries and send the debug_target (CSS selector) / debug_identifiers events to GA4 and then send it to Data Studio to visualize the data. If you inspect elements on my post and search it with the ‘selector’ below, it will refer to my hero image and title tag. debug_target from Data studio First Selector referring to my feature image as an LCP event
The first selector refers to my Feature image because it is the largest element on the page.Heading 1 as Largest elements in the viewport

Debug identifier is referring to me as an H1 tag.

2nd CSS selectors refer to my (H1) Heading tag because H1 to H6 are block-level elements and it is visible in the initial viewport of the post.

Plugins Recommendation:

From my understanding, not all people are tech-savvy like me who love digging around, and sometimes it is not possible to what I did on my landing page or blog post, so it means your best way is to implement it with the help of 3rd parties plugins that will automatically preload critical resources (like CSS, fonts, etc):
  1. FlyingPress
FlyingPress- preload critical images
  1. Swift Performance Pro (Affiliate Link): See Version 2.3 (beta) ([NEW] Preload Images) to learn more (if you have a screenshot referring to preloading, please send it to me) 
Preloading images in Swift Performance
  1. Automatically Preload “Featured image with PHP: Only works with feature images (Attachment below), not with any images visible in the initial viewport or above the fold.
Feature image
Preloading resources from Perfmatters
Credit to Perfmatters:
  1. Autoptimize: It doesn’t preload all the featured image, right now you have to manually preload the image.
Autoptimize metabox


I have over 4K users that use 1920×1080 screen resolutions according to Google Analytics that are a huge user base.
Please keep this mind that Google Analytics (GA) Data might be inaccurate for these reasons:
  1. Bots can inflate my data.
  2. Adblockers like uBlock Origin block all any tracking so it means data will not be sent by the browsers to GA Servers.
  3. Some people preferred disabling JS entirely.
So I decided to test my article remove unused CSS in the webpagetest with many different screen resolutions and turn out my feature image (screenshot or links below) triggers my Largest Contentful Paint elements. Feature image is my Largest Contentful paint


The best way to figure out the largest Contentful Paint (LCP) elements is by monitoring and gathering real user data with the help of web-vitals JS libraries or any RUM solution and deciding properly. Because Preloading and Pre-connect can become a double-edged sword if you don’t do it properly. You can see the full comparison in full detail (data is unavailable) I have tested on the webpagetest. I hope it helps you too if you love this kind of post and give you insights on whether to preload or not preload feature images. You can support me by buying a cup of coffee using any of my Affiliate links presented in the post or hiring me. (This commission comes at no additional cost to you but it will keep the website a little help and write more comprehensive articles just for you)
  1. Thank you Gijo Varghese for reviewing my post and providing me FlyingPress image.
  2. Thank you Nicola Caldognetto for sharing the PHP code on the WP Speedmatters’s Facebook Group.
Thank you for reading till this end. Stay safe and don’t forget to post comments if you find this helpful 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *