Automagically download analytics.js, keep it updated using WordPress' built-in Cron-schedule, generate the tracking code, add it to your site's header or footer and tons of other features!
https://daan.dev/wordpress-plugins/optimize-analytics-wordpress/