PathContextFromURL

PathContext indicates where an event occurred.

On Web we retrieve this information from the URL by using the Location.href.

info

PathContexts are parsed further server-side for generating other Contexts as well, such as MarketingContext.

Installation

The package @objectiv/plugin-path-context-from-url is included by default in ReactTracker.

Implementation

Implements PluginInterface's enrich and validate methods.

enrich

Creates a new instance of PathContext, where its identifier equals the current URL, and adds it to the list of Global Contexts of the outgoing Event.

validate

If this plugin is usable, PathContext must be present once in Global Contexts.

isUsable

True if both Document and Location interfaces are available.

Configuration

Can be disabled by setting ReactTracker's trackPathContextFromURL parameter to false.

caution

Disabling this plugin implies providing your own implementation, as PathContext is still required.