Well, again, this is one of those situations where recommendations from Google Page speed should be taken with a grain of salt. The 2 caching time is fine to be honest, it allows frequent updates from the script with very good caching. It means the script will be actually downloaded only every 2 hours so it will affect only a very small number of URLs and really is not something that will affect user experience.
On the other hand, scripts similar to the one you linked to - it's not complex, we even have one of our own for some internal servers - appears like a good idea but may not always be. Issues are:
- missing features and reliance on 3rd party fro bug fixes and new features - Client ID api for instance
- the script will be downloaded from the user server, which will always be much slower than Google's
- more importantly, for most pages of most sites, there will be no download at all because the Analytics script is the same for every one and most sites have it. So even when you come to a site for the first time, the Analytics script is already there, from another site and does not need to be downloaded.
When using a 3rd party script, then it will have to be downloaded separately for each site which is a net loss.
I have looked at this in the past a few times but the conclusion is always the same, pros and cons are in favor of using the original script.
What would be a real change is to use something like Matomo (ex-Piwik), but that's a totally different thing of course.