Altering vuepress theme’s can be a daunting task. The best kind of developer is a lazy one.
If your site is deployed with netlify all you need to do is the following.
Go to your site -> Site settings -> Build & deploy -> Post processing -> Snippet injection
Click the drop down -> hit before head.
Then copy and past the google analytics code they provide. Netlify will inject this script in as your page loads. No need to attempt to modify your theme.