How to improve PageSpeed on pages with Elfsight widget

Have you noticed that your page with the Elfsight widget has low PageSpeed scores? This article will help you improve those results.

In this article

This guide shows how to improve your PageSpeed score. For tips on making your widget load faster on a webpage, check out this article: How to make a widget load faster.

Check lazy loading for optimal performance

At Elfsight, we've designed our widgets to minimize resource use and maintain fast website performance. To achieve the best results, we recommend using the latest versions of our widgets available at Elfsight.com, which now include performance-enhancing features like lazy loading.

Lazy loading delays the widget's load until visitors interact with the page (e.g., scrolling or hovering), reducing the initial load time and keeping your site running quickly.

All Elfsight widgets now come with lazy loading enabled by default. You can verify this by checking for the data-elfsight-app-lazy attribute in the widget code, ensuring it loads only when needed.

Add lazy loading to older widget code

If your PageSpeed metrics are still low, it may be because your widget was installed before this feature was added. Older versions of the widget code do not include the data-elfsight-app-lazy attribute and look like this:

<script src="https://static.elfsight.com/platform/platform.js" data-use-service-core defer></script>
<div class="elfsight-app-7e006c54-fd6b-40d8-a506-4201fa910630"></div>

To fix this, locate your widget’s code on your website and add the data-elfsight-app-lazy attribute, like in the screenshot:

This simple change should significantly improve your PageSpeed scores.

Add lazy loading for iFrame installations

If you're using widgets installed via an iFrame, lazy loading is not enabled by default. To enable it, you'll need to add the loading="lazy" attribute to the iFrame code. Here's how you can update your existing iFrame code:

<script src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.2.10/iframeResizer.min.js"></script>
<iframe 
  src="https://442ee0d83cf24f0e8c11412acc591fc7.elf.site"
  loading="lazy"
  style="border: none; width: 100%"
  onload="iFrameResize(this)"></iframe>

Once you've made this update, it should help improve your PageSpeed score.

Need more help?

If the data-elfsight-app-lazy attribute is already present and your PageSpeed scores remain low, especially if the widget is mentioned in the PageSpeed report, please contact our Support Team. We’ll be happy to help you investigate and resolve the issue.

Did this article answer your question? Share your feedback: Thanks for sharing your feedback. It helps us grow! There was a problem submitting your feedback. Please try again later.

Still looking for assistance? Contact Us Contact Us