> ## Documentation Index
> Fetch the complete documentation index at: https://developers.hubspot.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

---
id: 8ce93991-d33b-481e-b01c-91bb2677ba71
---

# Track a page view

Manually track a page view. This is automatically called when the tracking code loads, but can be used for single-page applications.

<Warning>
  **Please note:** `trackPageView` is automatically called when the tracking code loads, so you should not push any `trackPageView` calls to `_hsq` before the page loads.
</Warning>

## Usage

### Basic Page View

```javascript theme={null}
var _hsq = (window._hsq = window._hsq || []);
_hsq.push(["trackPageView"]);
```

### For Single-Page Applications

```javascript theme={null}
var _hsq = (window._hsq = window._hsq || []);
// First set the path
_hsq.push(["setPath", "/about-us"]);
// Then track the page view
_hsq.push(["trackPageView"]);
```

## Notes

* Use this method when you need to track page views without reloading the page.
* Commonly used in single-page applications (SPAs).
* Use with `setPath` to track the correct page path in SPAs.
