Track your page views in your single-page application


Hi Everyone,

Today we’re announcing some new functions for the HubSpot tracking code that will allow you to track page views in a single-page application (SPA for short).

The two functions are setPath and trackPageView. The setPath allows you to manually update the current path stored in the tracker, while trackPageView will record a page view for that stored path. You can use these two functions together (updating the path and then tracking that view) to record page views in your single-page application whenever you load a new view.

You can find more details for these functions, and examples for using them together in SPAs, on their documentation pages:

Page visits and page views tracking as same number for SPA