I want to delay scripts of the shopify apps

I have shopify website and i want to boost website speed. So for that i want to delay apps scripts as well. I already delay theme js but now can anyone let me know how to delay unwanted scripts?

1 Like

Hi @Dhruv444

To delay or completely block the third party apps scripts ( not css ) you can use Yett Library

create a snippet & name it optimization or name you like and add below script


Explanation

The code added in window.YETT_BLACKLIST 3rd party scrips url parts.

For example if check /onsite/ . So there is a script used for klaviyo app which is https://a.klaviyo.com/media/js**/onsite/**onsite.js so to block this I have taken a part from URL which is /onsite/. As YETT script work based on regex. so it will check the script’s for specific part of it and then block it.

you can also use script name like this /onsite.js/ in window.YETT_BLACKLIST array.

Other method

If you are able to access the js then you can add to block it

window.yett.unblock is to use for unblocking the script once the store is loaded. To completely block it remove same reference from window.yett.unblock & it will blocked.

Thank you.

DP

1 Like

Hi @Dhruv444

If the solution presented meets your needs and addresses your query effectively, I encourage you to accept it as the chosen answer. This will acknowledge your support and aid fellow community members in identifying reliable and effective solutions for their similar concerns.
Thank you.

Hello,

This didn’t work for me. I created a snippet and added the below code for monster cart upsells app for our page here https://furre.pl/products/oczyszczacz-powietrza-dla-zwierzat and it didn’t work

Want to delay this script here - https://cdn.shopify.com/extensions/ac65fde2-2227-41db-bb8f-d0fe3db1024a/monster-cart-upsell-free-gifts-286/assets/cart_renderer.js

window.YETT_BLACKLIST = [/monster-cart-upsell-free-gifts-286/];

Hi @furre
I checked the URL https://furre.pl/products/oczyszczacz-powietrza-dla-zwierzat
But I didn’t find the script YETT_BLACKLIST I suggested on this page.

Hello,

I followed your instructions as mentioned. See below snippet that we created with your code. But I don’t see the script either.