包详细信息

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

amplitude147.7kMIT0.5.6

<b

自述文件


@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

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

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