Update the path of the current page. This function should be used by single-page applications to update the current page whenever a page is loaded. After using this function to update the path, you will need to call the trackPageView function to track the view of the current page.
- This function call only updates the path stored in the tracker. You'll need to call the trackPageView function to actually track the updated page.
- Single-page applications should push a
_hsqbefore the tracking code loads to set the URL that gets tracked for the first page view (the
trackPageViewfunction is called automatically when the tracking code is loaded). See the Tracking Code overview page for an example of this.
- This function can only update the path of the URL. The domain is set automatically based on the URL of the page on load, and the path that is set using this function is always treated as relative to that detected domain.