I think it should look like this, with no hyphens in <s-cript>:
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXX-1"></script>
window.dataLayer = window.dataLayer || ;
gtag('js', new Date());
The hyphen is getting there when I save the template. I tried with the code you provided. Tried with another user (no editor defined) same behavior. I am using PHP Version 7.4.13, Astroid 2.47., Joomla 3.9.23, Apache 2.4.46. Will try with a base template.
JoomDev is not affiliated with or endorsed by Open Source Matters or the Joomla! Project. The Joomla! logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.