npm.io
0.7.22 • Published 1 week ago

@amplitude/plugin-page-url-enrichment-browser

Licence
MIT
Version
0.7.22
Deps
2
Size
89 kB
Vulns
0
Weekly
0
Stars
179


@amplitude/plugin-page-url-enrichment-browser

Official Browser SDK plugin for page url enrichment

Installation

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

# npm
npm install @amplitude/plugin-page-url-enrichment-browser

# yarn
yarn add @amplitude/plugin-page-url-enrichment-browser

Usage

This plugin works on top of Amplitude Browser SDK and adds page url enrichment properties to all events. To use this plugin, you need to install @amplitude/analytics-browser version v2.0.0 or later.

1. Import Amplitude packages
  • @amplitude/plugin-page-url-enrichment-browser
import { pageUrlEnrichmentPlugin } from '@amplitude/plugin-page-url-enrichment-browser';
2. Instantiate page url enrichment plugin
const pageUrlEnrichment = pageUrlEnrichmentPlugin();
Options
3. Install plugin to Amplitude SDK
amplitude.add(pageUrlEnrichment);
4. Initialize Amplitude SDK
amplitude.init('API_KEY');

Resulting Page URL properties

This plugin adds Page URL properties to all events based on your configuration

Event type
  • No event type added
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
'[Amplitude] Previous Page Location' The URL of the previous page the user visited; document.referrer if coming from an external domain; and using the sessionStorage which tracks the last url otherwise
'Amplitude] Previous Page Type' A classification of the previous page (e.g., 'Internal', 'External', 'Direct'), typically derived from a custom function that analyzes the previous page's URL