Skip to main content
Answered

Google page speed error suggests lazy loading the Intercom widget with a facade (Wordpress site)

  • February 21, 2023
  • 3 replies
  • 1577 views

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

Best answer by Nur Nahid

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.

View original
Did this topic help you find an answer to your question?

3 replies

Racheal
Intercom Team
Forum|alt.badge.img+5
  • Customer Support Engineer
  • 512 replies
  • February 23, 2023

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


  • New Participant
  • 1 reply
  • January 13, 2024

Nur Nahid
Super User ✨
Forum|alt.badge.img+3
  • Super User ✨
  • 95 replies
  • Answer
  • October 27, 2024

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.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings