From what I can tell, how google recommends to set up gtag, it's a function that is always pushing more variables onto an array:
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
Following the docs on how to use it in a SPA, it seems I'm actually creating a memory leak.
gtag('config', 'GA_TRACKING_ID', {'page_path': '/new-page.html'});
console.log('window.dataLayer', window.dataLayer);
My console shows that every time I navigate to a new page the window.dataLayer array gets larger.
I'm assuming there's something I'm not understanding, because I doubt that Google wants me to create a memory leak in my app, but I'm stumped now.