How to Add Scripts?

I'm using the Studio theme on a site. I need to add a Javascript block of code before the /body tag on all pages of the website.

How do I accomplish this without impacting future theme upgrades?