Add banner to personal spaces in confluence

Hi Team ,

Thanks for looking into this post.

I know we can add HTML within CustomHTML page to add a sitewide banner across confluence. I was wondering if there is a way I could have the banner appear only across all personal spaces.

I am thinking maybe with some java script. I know confluence has a differentiator in the system between global spaces and personal spaces so maybe an if personal space then display.

Any idea how it can be done ?