# @amplitude/plugin-page-view-tracking-browser

Latest version **2.11.19** (published 2026-09-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install @amplitude/plugin-page-view-tracking-browser
pnpm add @amplitude/plugin-page-view-tracking-browser
yarn add @amplitude/plugin-page-view-tracking-browser
bun add @amplitude/plugin-page-view-tracking-browser
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.11.19 |
| Published | 2026-09-29 |
| First published | 2022-09-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 81.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 180 |
| Author | Amplitude Inc |
| Maintainers | curtisbliu, kelson.warner, sdk.dev, eric_amplitude, daniel-graham-amplitude, jjwang123 |

## Links

- npm: https://www.npmjs.com/package/@amplitude/plugin-page-view-tracking-browser
- Repository: https://github.com/amplitude/Amplitude-TypeScript
- Issues: https://github.com/amplitude/Amplitude-TypeScript/issues
- npm.io page: https://npm.io/package/@amplitude/plugin-page-view-tracking-browser

## Dependencies (2)

- [tslib](https://npm.io/package/tslib.md) ^2.4.1
- [@amplitude/analytics-core](https://npm.io/package/@amplitude/analytics-core.md) 2.59.0

## Recent versions

- 2.11.19 (latest) — 2026-09-29
- 2.11.17-video-analytics-5.0 (video-analytics-5) — 2026-09-22
- 2.11.16-video-analytics-4.0 (video-analytics-4) — 2026-09-17
- 2.11.15-video-analytics-2.0 (video-analytics-2) — 2026-09-09
- 2.11.13-video-analytics.0 (video-analytics) — 2026-07-31
- 2.11.4-featelement-selector-v1.0 (featelement-selector-v1) — 2026-06-15
- 2.11.3-SR-4497-custom-transport-hooks.0 (SR-4497-custom-transport-hooks) — 2026-06-09
- 2.11.2-sr-perf-reliability-rc.0 (sr-perf-reliability-rc) — 2026-06-05
- 2.11.2-sr-4646-rc.0 (sr-4646-rc) — 2026-06-03
- 2.11.1-sr-idb-multitab-test-rc.0 (sr-idb-multitab-test-rc) — 2026-05-04
- 2.10.1-sr-3531-rc-2.0 (sr-3531-rc-2) — 2026-04-20
- 2.9.6-SR-3115-rc2.0 (SR-3115-rc2) — 2026-04-08
- 2.9.6-SR-3115-rc1.0 (SR-3115-rc1) — 2026-04-03
- 2.9.6-SR-3115.0 (SR-3115) — 2026-04-03
- 2.8.4-SR-2728.0 (SR-2728) — 2026-03-12
- … 262 more at https://npm.io/package/@amplitude/plugin-page-view-tracking-browser/versions

## README

<p align="center">
  <a href="https://amplitude.com" target="_blank" align="center">
    <img src="https://static.amplitude.com/lightning/46c85bfd91905de8047f1ee65c7c93d6fa9ee6ea/static/media/amplitude-logo-with-text.4fb9e463.svg" width="280">
  </a>
  <br />
</p>

# @amplitude/plugin-page-view-tracking-browser

Official Browser SDK plugin for page view tracking

## Installation

This package is published on NPM registry and is available to be installed using npm and yarn.

```sh
# npm
npm install @amplitude/plugin-page-view-tracking-browser

# yarn
yarn add @amplitude/plugin-page-view-tracking-browser
```

## Usage

This plugin works on top of Amplitude Browser SDK and adds page view tracking features to built-in features. To use this plugin, you need to install `@amplitude/analytics-browser` version `v2.0.0` or later.

### 1. Import Amplitude packages

* `@amplitude/plugin-page-view-tracking-browser`

```typescript
import { pageViewTrackingPlugin } from '@amplitude/plugin-page-view-tracking-browser';
```

### 2. Instantiate page view plugin

The plugin accepts an optional parameter of type `Object` to configure the plugin based on your use case.

```typescript
const pageViewTracking = pageViewTrackingPlugin({
  trackOn: undefined,
  trackHistoryChanges: undefined,
});
```

#### Options

|Name|Type|Default|Description|
|-|-|-|-|
|`trackOn`|`"attribution"` or `() => boolean`|`undefined`|Use this option to control when to track a page view event. By default, a page view event is sent on each SDK initialization.<br/><br/>Use `() => boolean` to control sending page view events using custom conditional logic.<br/><br/>Use `"attribution"` to send page view events with attribution events. This option requires using [@amplitude/plugin-web-attribution-browser](https://github.com/amplitude/Amplitude-TypeScript/tree/main/packages/plugin-web-attribution-browser).|
|`trackHistoryChanges`|`"all"` or `"pathOnly"`|`undefined`|Use this option to subscribe to page view changes based on full URL or URL path in a single page application like React.js. By default, page view changes are based on full URL.<br/><br/>Use `"all"` to compare the full url changes.<br/><br/>Use `"pathOnly"` to compare only url path changes.|

### 3. Install plugin to Amplitude SDK

```typescript
amplitude.add(pageViewTracking);
```

### 4. Initialize Amplitude SDK

```typescript
amplitude.init('API_KEY');
```

## Resulting page view event

This plugin tracks page views based on your configuration. A page view event is composed of the following values:

#### Event type
* `"[Amplitude ]Page Viewed"`

#### Event properties

|Property|Description|
|-|-|
|`'[Amplitude] Page Domain'`|The website's hostname or `location.hostname`|
|`'[Amplitude] Page Location'`|The website's full url or `location.href`|
|`'[Amplitude] Page Path'`|The website's pathname or `location.pathname`|
|`'[Amplitude] Page Title'`|The website's title or `document.title`|
|`'[Amplitude] Page URL'`|The website's url excluding query parameters|

---
_Source: https://npm.io/package/@amplitude/plugin-page-view-tracking-browser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
