Remove third party script

Solved
Highlighted
New Member
4 0 0

Hey Shopify Community,

 

I'm trying to increase the performance of my site by removing unnecessary javascript. One script in particular I'm trying to remove is sdk.js which is 63kb and loads from facebook.com. My site does not have any facebook integrations so this seems like a safe candidate for removal. It's not part of the theme I'm using, I'm guessing it's part of Shopify's bundle. How would I go about disabling this?

0 Likes
Highlighted
Shopify Expert
716 54 160

This is an accepted solution.

If it's not in your theme files, then it's probably being actively injected by one of your apps.

 

To debug this, I'd probably do this:

1) Check various page templates on your site to see if it's loading on every template or just certain areas

2) View the source of the loaded page and see where it's injected (specifically, if it's loaded in the head with the other shopify scripts, or somewhere else)

3) Use Chrome dev tools to try and see when it loads during the page, and where it loads from

 

With that information, you should be able to get some clues on where it's loading.

Founder of Speed Boostr (Shopify optimization and dev agency).
Creator of Theme Scientist (A/B testing app).
Creator of Order Automator (app that auto tags + fulfills orders, send emails).
Creator of Tip Jar (add a tip button to your store).
Creator of Shopify Analyzer (free performance analysis tool).
My team also builds custom apps and automated solutions.
Enjoy the adventure!
0 Likes
Highlighted
New Member
4 0 0

Thanks for the response! The script is not in my theme files, and I don't have any apps installed. I looked at the head, it's actually two of them, and it looks like they load in order with my theme files. So does this mean my theme is injecting this tag? If it was, it would make sense that it wasn't in with the other assets since it's being served by facebook. I'll dig through my theme and see if I can find where its adding this tag.

 

screenshot4.png

0 Likes
Highlighted
New Member
4 0 0

I couldn't find the script tag in the head because it was being injected by a script in the footer.

0 Likes