Google Pagespeed score issues

Hello! I noticed that my Google Pagespeed score drops a good bit when adding a widget for Google Reviews “the reduce unused Javascript section” which is now up to a 5.44s delay.

Any tips on how to improve performance? I’ve decreased the number of reviews that pull into the widget & removed the slider option but neither seems to make much of a difference.

Hi Kyle and welcome to the forum!

I’m sorry that you’re facing issues with the page speed, and I’ll try my best to help.

Could you please share a link to the page with the widget so that we can check things for you and see what solution we could come up with?

Hi Helga! Thank you for the follow-up. Here’s the site.

Here are the current Google Page Speed insights w/ Elfsight enabled & on the homepage. Most alerts point directly towards the widget - https://pagespeed.web.dev/report?url=https%3A%2F%2Fthejumpparty.com%2F

Please let me know if there is anything else that you need. Thank you!

Thanks for the information provided, Kyle!

Unfortunately, I need to tell you that there’s no possibility to reduce the unused JavaScript size, I’m really sorry about it. The thing is that the majority of our widgets, including Google Reviews widget, have hidden functionality that is not used all the time but activated when needed. For example, the Google Reviews widget uses cache and updates once every 48 hours. Between the update period, the part of the code used for it is considered unused by Google PageSpeed.

However, you are very welcome to reinstall your widget by using some kind of lazy loading. Though, please keep in mind that this way of installation won’t meet your needs in case you would like to display your static widget above the fold.

Here is your installation code:

<div id="widgetContainer"></div>
<script src="https://apps.elfsight.com/p/platform.js" defer></script>
<script>
function inViewport(element){
const bb = element.getBoundingClientRect();
return !(bb.top > innerHeight || bb.bottom < 0);
}

let widgetVisible = false;
const widgetContainer = document.querySelector('#widgetContainer');

document.addEventListener('scroll', event => {
if (inViewport( widgetContainer ) && !widgetVisible){
widgetVisible = true;
const widget = document.createElement('div');
widget.className = "elfsight-app-WIDGET_ID ";
widgetContainer.append(widget);
}
});
</script>

Please replace WIDGET_ID in the code above with the ID of your own widget and add this code to your website backend right to the place where you’d like to display the widget.

Please let me know if you have other questions!Preformatted text

2 Likes

This seems like a super cool solution.

Will it work for floating forms that have a button on the bottom right, or do they need to load right away?

Also can you tell me, once the website visitor scrolls down to the section where the reviews or social feed or whatever widget is displayed, how long will it take to display if it “lazy loads”?

1 Like

This worked beautifully. Thank you!

1 Like

Hi @Kyle , thanks for the update, it’s awesome that my solution worked! :slight_smile:

Hi @Hugh, my apologies for the late reply! It seems we’re in different time zones :frowning:

By now, our developers have found a lazy loading workaround for static widgets only, so I’m afraid we can’t improve the loading speed for floating widgets at the moment. We hope that our devs will find a workaround in the future, though.

At the moment, the only thing I can recommend you in this situation is to change the widget’s layout to Embed and install it to a certain place of your website.

As for the lazy loading speed, it mostly depends on a user’s Internet connection speed :slight_smile:

1 Like

Thanks for this.

Is there a typo in the code above, or is this right?

const wiget = document.createElement(‘div’);
wiget.className = "elfsight-app-WIDGET_ID ";

Hi Hugh, it seems there is indeed a typo in this word, thanks!

The good news is that it doesn’t affect the functionality, but we’ve corrected the code anyway so not to confuse anybody :slight_smile:

Thanks for your help!

Thanks for sharing! I didn’t even notice the typo earlier.

Best wishes, Jane, manager, Work Time

2 Likes

Hello,
I have performance issues as well on multiple pages. As you can see on the screenshot, the loading times of almost 7 seconds are very huge for roughly 700kb of data.

Here is my website: https://shop-studio.io/

How can this be optimized?

The TTFB (time to first bytes) is high too. Could be a performance issue on the server.

For example

Hello @user451, my apologies for the late reply!

I’m really sorry for this error, but I’m happy to say that everything should be working just fine now. You see, unfortunately, we did experience a temporary technical glitch on July 1, which might have been the reason for the issue you encountered.

Could you please check your widget now and let me know if you’re good?

@Helga Hello, yes, it seems to be faster now. Thank you

1 Like

@user451 thank you for the update, it’s awesome that everything’s fine now!

I do hope nothing of this kind will ever come up from now on, and we’ll do our best to prevent such issues.

Have a great week! :hugs: