How do I tag a Single Page Application (SPA) or one page site?
Tagging SPAs - key principle
In the case of a one page website (or a Single Page Application), you can still collect data related to the page by triggering events during user interactions with your site (scroll, click on a button, an object displayed on the site, etc.).
For instance, if a user, while being on your website, displays a specific section of the page, you can trigger a page.display event using the pa.sendEvent() method:
pa.sendEvent('page.display', {
page: page_name,
page_chapter1: section_1
});
These events can feed almost all the properties of your Data Model, according to your needs.
Because SPAs do not reload pages, you typically replace “page load” tracking with “view” tracking (for example, when a route changes, when a new section becomes visible, or when a modal/screen is displayed). You can trigger:
page.displaywhen the user views a screen/route/sectionClick or interaction events when users take actions (button clicks, scroll thresholds, etc.)
This allows you to retrieve standard metrics such as visits, visitors, and time spent, even without traditional page loads.