@damianb123
Same way like already I have shared with you, save js file on the local system and include it into your xml file.
Assuming your script is located in <module_root>/view/frontend/web/ script.js, the simplest way to add a script to all pages and all themes you can create a module containing <module_root>/view/frontend/layout/default.xml file with the following contents:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<script src="YourNamespace_YourModule::script.js"/>
</head>
</page>
Manish Mittal
https://www.manishmittal.com/