Like @joerghoh mentioned, based on title or your post I assume you are using core components and use Adobe data layer. Now you can use delegation pattern to additionally add more properties that can either be consumed by HTL code (you can choose to include as part of custom header libs.html) to expose the site name property as a data attribute and then in your js you can read the data attributes from there or directly override the data layer generation method in your custom page implementation so your js can directly consume it from the generated data layer.
But let's say you don't use Adobe data layer. In that case also you can still add your logic in customheaderlibs.html using HTL code to directly inject a script block (context will be script or script variable I guess) with values available via page properties or inherited page properties global objects. And now that it is available as a js variable you can directly consume it in another js to update data later with this value.
Point is with custom js and HTL exposing the property, there were many ways.
Hope these insights help you.
Thanks