Need to install a service worker in the root dierctory

This is an old post from 2018 and as Ido has said, you can’t get to the root of your Wix site.

You can however, add your html code from a third party to a new custom tool in Tracking and Analytics that you can put in your head, body or end section.
https://support.wix.com/en/article/embedding-custom-code-to-your-site
https://support.wix.com/en/article/using-iframes-to-display-visible-content-on-your-site

Or, if the third party has a API (preferably REST), then you can expose your Wix site to their API.
https://www.wix.com/corvid/reference/wix-fetch.html
https://support.wix.com/en/article/corvid-accessing-third-party-services-with-the-fetch-api
https://www.wix.com/corvid/reference/wix-http-functions.html
https://support.wix.com/en/article/corvid-exposing-a-site-api-with-http-functions
Example:
https://www.wix.com/corvid/forum/corvid-tips-and-updates/example-myapi-and-myapiclient

Finally, check third parties own websites, like with Subscribers.com
https://subscribers.freshdesk.com/support/home
It is amazing what you can find there already…
https://subscribers.freshdesk.com/support/solutions/articles/35000119671-wix-installation

Please add a new post if you still require help with this issue