In the following pages, I will assume that you are familiar with Google Analytics and that you have correctly configured Google Analytics tracking in your application. If not, you can Google it, understand how it works, and come back here. A basic understanding is more than enough to proceed with the following pages.
The first step is to add this Google Analytics tracking code snippet to the index.html file:
<!-- index.html -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script>
window.dataLayer = window.dataLayer || ;
gtag('js', new Date());
After that, a global gtag(...) function...