We just merged an option to upgrade to GA v4 into core:
To upgrade to Universal Analytics v4 which uses gtag as a wrapper for analytics.js, head to Admin > Settings and search for ga_version. Switch this setting to v4_gtag and refresh to upgrade to version 4.
Be aware in upgrading to v4 you will need to change any custom events you’ve defined in theme components to use the new gtag API instead of ga.