Please add a service worker to the websites and allow users to add custom code to the service worker.
Service workers are not like normal scripts: the location matters and you usually have to put them in the root folder. Also, there can be only one service worker per scope.
This is important to allow users to add web push notifications. For example:
I also suggest to check out the strategy that Wordpress is adopting for service workers:
I hope that you will implement this feature.