Hii @drewfullleaf , As you have mentioned, you have a CLS problem for the desktop view, but when I tested your site through Google Page Insights Report, the results are very different, as there is no CLS issue existing in your site for both views. Rather than having CLS, you are having issues with other core web vitals like LCP, FCP, and TBT you need to make changes to improve them.
Here are the practices you can follow to fix the issue -
Delaying page rendering
You can delay the page rendering or certain scripts for a specific period, you can use setTimeout.
window.addEventListener('load', function() {
setTimeout(function() {
// Delayed content or scripts
document.getElementById('delayed-content').style.display = 'block'; // Show an element after delay
}, 3000); // Delay by 3 seconds
});
Defer CSS for Non-Essential Styles
For non-essential CSS (styles that don’t impact the immediate display), you can load them after the page load using JavaScript:
<script>
window.addEventListener('load', function() {
var link = document.createElement('link');
link.rel = 'stylesheet';
link.href = '{{ 'deferred-style.css' | asset_url }}';
document.head.appendChild(link);
});
</script>
Additionally, you can use requestIdleCallback to Delay Non-Essential Tasks
Like the below example-
if ('requestIdleCallback' in window) {
requestIdleCallback(function() {
// Load non-essential resources or do things that don't block the rendering
console.log('This task is delayed until the browser is idle');
});
}
Use efficient cache lifetimes
You can configure cache headers to define how long resources should be cached by the browser or proxy caches. This helps reduce the load on Shopify’s servers and improves performance for returning visitors. You can apply caching for non-essential resources by adding specific cache-control headers.
Like the mentioned example -
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/service-worker.js').then(function(registration) {
console.log('Service Worker registered with scope:', registration.scope);
}).catch(function(error) {
console.log('Service Worker registration failed:', error);
});
}
After applying the above practices, I recommend testing your site again and seeing if the issue is solved or not. If you still have issues, then I recommend trying Website Speedy- an optimization app that automatically fixes the core web vitals and increases the store’s performance.