How to use Google analytics with PWA

Do the following methods work with native applications or PWA?
ionic native Google Analytics

Is there a way to use googpeanalytics without using ionic’s plugin?

Google ‘angular 5 add google analytics’

For example: