I have built an Angular SPA and I am ready to implement tracking. I want to keep it simple so no plug-in just direct gtag tracking. So, I've gone through all this documentation for the most part it makes sense. The only thing I am confused about is screen_view vs page_view and how does page_path fit in. Have a look at the following snippet:
screen documentation page
When building web apps, use screen_view events to measure specific screen views in Google Analytics. This provides similar functionality to Firebase screen_view events on native Android or iOS apps, or pageview events on standard web pages.
Since i built a web app and it is not standard web pages this to me means I should be using screen_view over page_view. If you take that at face value it's fine but it's followed up with another piece of documentation saying:
SPA documentation page
When your application loads content dynamically and updates the URL in the address bar, the page URL stored with gtag.js should be updated as well.
Alright if I've taken what I have learned above, on navigation to a new page, I should be doing this:
gtag('config', GA_MEASUREMENT_ID, {'page_path': page_path});
gtag('event', 'screen_view', {
'app_name': app_name,
'screen_name' : screen_name
});
Is this correct? Should I be running both of these? Also, is screen_view over page_view the correct event to use with SPAs?
one note: if this is correct my plan is to turn off page_view all together and just go with screen_view
The Page View event/metric goes back to Google Analytics origins in 2005 (probably even to Urchin, the service GA was built upon).
The ability to use GA for mobile apps didn't exist until much later (the iPhone was introduced in 2007 mind you). Page Views make less sense in apps (there's no URL, path. etc), so I guess this is when the Screen View was added.
App only - you most likely use Screen View (*see disclaimer below)
An app and a website (for example IMDb, a website where users can find info about movie/tv titles and the people involved, but they have an app as well) - sending Screen View events from the website allows for a unified measurement with similar events coming from the app. Depending on the exact structure of your app & website, Page View events may become redundant.
Website only - you can use Screen View instead of Page View but I don't see any advantage in doing so. The difference between a static website and a SPA is whether the Page View events are natural or synthetic.
Disclaimer: I'm a frontend dev so I don't have experience with native mobile apps. I'm also not a Google Analytics expert. However, I was interested in the question in subject, was disappointed by the lack of answers, so decided to share my understanding.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With