Hi Jannes,
You can download the Javascript snippet widget from the mendix app store and refer the documentation https://github.com/mrgroen/JavaScript-Snippet
You can also make use of HTML/ Javascript snippet from mendix app store, by using this widget you can trigger the external .js file too (by default it will search the .js file in your theme folder)
https://github.com/mendix/HTMLSnippet