Update the path of the current page stored in the tracker. 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'll need to call the trackPageView function to track the view of the current page.
This function will only update the path of the URL. The domain is set automatically based on the URL of the page load. The path will always be relative to the detected domain.
- Repeated use of
setPathwill override the referrer, which can impact a contact's original source, depending on when a tracking request is made.
- 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.