On the web, a pageview is defined as when the page loads, or when the url changes.
In native mobile apps, a pageview is defined as when a user navigates to a new screen. Pageview events are captured when a new ViewController is presented to the user in an iOS app, and when a new Activity is presented to the user in an Android app.
For iOS apps, Heap implements additional logic to define a pageview. ViewControllers are the closest proxy for a “page” on iOS, but not all ViewControllers are pages. For screens with multiple ViewControllers, Heap captures a pageview event for a ViewController if it is the root ViewController for a window.
Additionally, Heap will issue a pageview event for the first screen a user is presented after foregrounding the app.
Pageviews and Single Page Applications (SPAs)
Heap detects a pageview whenever the URL’s Path or Hash changes. In the past, if developers wanted to render new information on a page, they would typically redirect the user to a different path, and the user’s browser would load a new HTML page.
Modern front-end frameworks allow developers to rerender the contents of the page without having to redirect the user to a new HTML page. This is called a single page application (SPA). This minimizes the load time and greatly improves the user experience.
To learn more about Heap and SPAs, see Using Heap With Single Page Application (SPA) Websites.