Usage
Basic Page View
For Single-Page Applications
Notes
- Use this method when you need to track page views without reloading the page
- Commonly used in single-page applications (SPAs)
- Use with
setPathto track the correct page path in SPAs
trackPageView is automatically called when the tracking code loads, so you should not push any trackPageView calls to _hsq before the page loads.var _hsq = (window._hsq = window._hsq || []);
_hsq.push(["trackPageView"]);
var _hsq = (window._hsq = window._hsq || []);
// First set the path
_hsq.push(["setPath", "/about-us"]);
// Then track the page view
_hsq.push(["trackPageView"]);
setPath to track the correct page path in SPAsWas this page helpful?