With Swift Performance you can add arbitrary javascript which won’t be executed in the browser, but during the caching process.
So you can use javascript for DOM manipulations, before the page has been loaded for the user. It can be really useful, when you need to resize an element based on the screen size, remove or add classes, hide or show elements, etc.
If you enable Separate Mobile Device Cache, server side scripts will be executed separately on desktop-sized and mobile-sized screen as well, so you can resize elements for both screens.
Debugging
If you enable logging in General settings, and set the loglevel to Error, then if there is any javascript error on the server side, you can see the errors in the Swift Performance debug log, and the browser console if you check the cached page.