Google Global Site Tag (gtag.js) tracking code insertion issue

I see the issue
If you remove the script tags from the database and manually hard code them into the head with the actuall script between

<script>
    {{serverconnect1.data.query_tag.script}}
</script>

it does not render

If you render the entire script into the head, it is rendered but moved to the body

    {{serverconnect1.data.query_tag.script}}

it is rendered but moved to the body

image