Well, I answered my own question: the change was done on this file:
templates\rt_gemini\custom\config\default\page\head.yaml
and looked something like this at line 13:
- { location: '', inline: "<!-- Global site tag (gtag.js) - Google Analytics -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxxxxxx-1\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'UA-xxxxxxxxxx-1');\n</script>", in_footer: '0', extra: { }, priority: '0', name: 'google analytics' }
I deleted the code and now the site is back to working fine. Just in case anyone does the same idiotic thing, this is how you fix it (for the record, I did a global serch for "Google Analytics -->". Unfortunately, I use Dreamweaver and it is notoriously bad at sesarching inside files that are not PHP, HTML etc. There is a workaround but given the page of updates DW goes through it is no longer feasible to fix it.
I used notepad++ to find the offending code.