Hey everyone
We had a very beneficial conversation in this topic and, as a result, we’ve implemented a new feature!
Shout out to @user552 @Charlie and @Hugh for the great ideas and participation in the development of our company!
Without further ado, let’s delve into details!
New lazy loading feature
This feature will help you significantly improve Google Page Speed Score of the page where the widget is installed.
You can think: “What is the difference between the new and the old one?”
This new method makes the widget load only when a visitor interacts with the page’s content or scrolls down to the place where the widget is installed. Thereby, the widget is not loaded straight away, so the page speed performance shouldn’t be affected.
Note: The code will work correctly if it is not installed in the initial viewport, i.e. users have to scroll down at least for a little bit before they reach the widget.
When you assure that the code is installed in the right place, you can start creating code for lazy loading.
How to do it?
Just add the “data-elfsight-app-lazy ” attribute to the <div>
element of your installation code.
For example, here’s what the installation code looks like initially:
<script src="https://static.elfsight.com/platform/platform.js" data-use-service-core defer></script>
<div class="elfsight-app-86c61122-896c-43d7-a080-5709c75753f7"></div>
And here’s what it should look like with the attribute added:
<script src=“https://static.elfsight.com/platform/platform.js” data-use-service-core defer></script>
<div class=“elfsight-app-86c61122-896c-43d7-a080-5709c75753f7" data-elfsight-app-lazy></div>
Your code is ready! Now you should add this code to your website and the PageSpeed score will become much better.
Guys, feel free to share your thoughts ask any questions about this feature in the comments below
Upd: we’ve revised the codes in the post and made them compatible with our new dashboard.