Similarly, lazysizes may be used with iframes for other third-party embeds.Note that lazysizes uses the Intersection Observer API to detect when an element becomes visible.Using data-lazy in Facebook #Facebook provides different types of social plugins that can be embedded. This includes posts, comments, videos, and the most popular Like button. All plugins include a setting for data-lazy. Setting it to true ensures that the plugin will use the browser's lazy-loading mechanism by setting the loading=\"lazy\" iframe attribute.Lazy-loading Instagram feeds #Instagram provides a block of markup and a script as part of the embed. The script injects an <iframe> into the page. Lazy-loading this <iframe> can improve performance as the embed can be over 100 KB gzipped in size. Many Instagram plugins for WordPress sites like WPZoom and Elfsight provide the lazy-loading option.Replace embeds with facades #While interactive embeds add value to the page, many users may not interact with them. For example, not every user browsing a restaurant page will click, expand, scroll, and navigate the map embed. Similarly, not every user to a telecom service providers page will interact with the chatbot. In these cases, you can avoid loading or lazy-loading the embed altogether by displaying a facade in its place.A map embed with a zoom in and out feature.A map facade that is an image.A facade is a static element that looks similar to the actual embedded third-party but is not functional and, therefore, much less taxing on the page load. Following are a few strategies to load such embeds optimally while still providing some value to the user.Use static images as facades #Static images can be used instead of map embeds where you might not need to make the map interactive. You can zoom in on the area of interest on the map, capture an image, and use this instead of the interactive map embed. You can also use DevTools Capture node screenshot functionality to capture a screenshot of the embedded iframe element, as shown below.
DevTools captures the image as a png, but you can also consider converting it to WebP format for better performance.Use dynamic images as facades #This technique allows you to generate images corresponding to an interactive embed at run time. Following are some of the tools that allow you to generate static versions of embeds on your pages.Maps Static API: The Google Maps Static API service generates a map based on the URL parameters included in a standard HTTP request and returns the map as an image you can display on your web page. The URL needs to include the Google Maps API key and must be placed in the <img> tag on the page as the src attribute.
The click-to-load concept combines lazy-loading and facades. The page initially loads with the facade. When the user interacts with the static placeholder by clicking on it, the third-party embed is loaded. This is also known as the import on interaction pattern and can be implemented using the following steps.On page load: Facade or static element is included on the page.On mouseover: Facade preconnects to the third-party embed provider.On click: The facade is replaced by the third-party product.Facades may be used with third-party embeds for video players, chat widgets, authentication services, and social media widgets. YouTube video embeds that are just images with a play button are facades that we come across frequently. The actual video loads only when you click on the image.You can build a custom click-to-load facade using the import on interaction pattern or use one of the following open source facades available for different types of embeds.YouTube facade
React-live-chat-loader loads a button that looks like a chat embed instead of the embed itself. It can be used with various chat provider platforms such as Intercom, Help Scout, Messenger, and so on. The look-alike widget is much lighter than the chat-widget and loads faster. It can be replaced by the actual chat widget when the user hovers or clicks on the button or if the page has been idle for a long time. The Postmark case study explains how they implemented react-live-chat-loader and performance improvements they achieved.
In general, video embeds, social button widgets, and chat widgets can all employ the facade pattern. The list below offers our recommendations of open-source facades. When choosing a facade, take into account the balance between the size and feature set. You can also use a lazy iframe loader such as vb/lazyframe.
There are some tradeoffs when lazily loading third-parties with facades as they do not have the full range of functionality of the actual embeds. For example, the Drift Live Chat bubble has a badge indicating the number of new messages. If the live chat bubble is deferred with a facade, the bubble appears when the actual chat widget is loaded in after the browser fires requestIdleCallback. For video embeds, autoplay may not work consistently if it's loaded lazily.
If you plan on embedding your event, navigate to the Event tab on the Live Settings page. In addition to the player embed, you can also embed the chat module. Click Chat embed code to grab the iframe to paste into your website.