How to improve PageSpeed score of a page with our widget

Have you noticed that the page with your Elfsight widget doesn't have good PageSpeed scores? If so, this article can significantly help you improve your results.

In today's digital landscape, PageSpeed optimization has become crucial for online success. With search engines like Google considering site speed as a crucial ranking factor, businesses and developers are constantly seeking effective strategies to enhance their website's performance.

The main aim of this article is to tell you more about the lazy loading feature, which can significantly enhance your metrics.

Lazy loading allows the widget to load only when a visitor interacts with the page, such as scrolling or simply moving the mouse over the page's content. As a result, the widget isn't loaded immediately and, therefore, the page speed performance is not affected.

The lazy loading feature is now included in the widgets' installation codes by default. If you examine your widget's code within your account, you will notice the following attribute included in the code:

data-elfsight-app-lazy

However, it was not always like that. If you've noticed that the PageSpeed metrics for the page with the widget are unsatisfactory, it's possible that you installed the widget on your website before we introduced this feature.

As an example, here's how the code looked before this feature was rolled out:

<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 sum up, if your PageSpeed metrics of the page with the widget are far from good, please locate the placement of the widget's code on your website and check whether it includes the data-elfsight-app-lazy attribute. If you find it missing, we recommend adding this attribute to your widget's code.

With these changes, your PageSpeed scores should significantly improve.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us