כיצד להפוך כתובות IP לאנונימיות ב-Google Analytics בשנת 2021 ב-Discourse?

The above is correct (of course change your UA ID). Extra step that’s needed is: go to your admin settings and search for content security policy script src.

There add https://www.google-analytics.com/analytics.js, then it works.