You have to create new file on server called “gtag.js” (or “server-gtag.js” – to be sure, what is it).
1) copy original gtag.js to some online tool to formate it (in original form it’s minified)
2) now remove old url to gtag.js (in analytics code you paste to site) and paste new path to your “server-gtag.js”
3) it will still not work, but in console, you will see specific lines that have to be put into comment
4) save and done