I managed to do it by
-
creating a new component and activating it for the current theme
-
going the the Edit CSS/HTML button and pasting the script in the head region
-
Important part was to add the Atlassian URL loading the script to the Content Security Policy script src in the Settings .