Skip to main content

Hello, we have Intercom on our WordPress site (installed via the plugin).

We're getting a suggestion from Google Page Speed to lazy load the Intercom widget with a facade.

Does anyone have experience with this? google page speed error

Hey @user1424​ Racheal from the support engineer team here👋 

 

We actually have another community post here that can help you out!

https://www.intercom.com/help/en/articles/5053693-can-i-delay-loading-intercom-on-my-site-to-reduce-the-js-load


The code suggested in https://www.intercom.com/help/en/articles/5053693-can-i-delay-loading-intercom-on-my-site-to-reduce-the-js-load doesn’t seem to change anything:

 


To lazy load the Intercom widget on your WordPress site with a facade, follow these steps:

What is a Facade?  
A facade loads a placeholder for the widget, which reduces initial page load time. The full Intercom widget only loads when a user interacts with the placeholder.

How to Implement Lazy Loading:
   - Use JavaScript to delay the loading of the Intercom script until user interaction (e.g., a click or scroll).
   - Here’s a basic example:  
 

     document.getElementById('intercom-facade').addEventListener('click', function() {
window.Intercom('boot', { app_id: 'your_app_id' });
});

- Replace 'your_app_id' with your actual Intercom app ID.

 

Use a Lazy Load Plugin:  
    Alternatively, some WordPress plugins (like Lazy Load for Scripts) allow you to defer loading of non-essential scripts like the Intercom widget.

Testing and Optimization:
    After implementing lazy loading, run your site through Google PageSpeed Insights to ensure the change improves performance.

This method will help optimize performance by preventing the widget from loading until needed. You can try maybe this can solve your problem.


Reply