UNPKG

@objectiv/plugin-path-context-from-url

Version:

Plugin for Objectiv trackers to automatically generate and attach PathContext from URLs

28 lines (25 loc) 938 B
import { TrackerPluginInterface, ContextsConfig } from '@objectiv/tracker-core'; /** * The PathContextFromURL Plugin gathers the current URL using the Location API. * It implements the `enrich` lifecycle method. This ensures the URL is retrieved before each Event is sent. * * Event Validation: * - Must be present in Global Contexts * - Must not be present multiple times */ declare class PathContextFromURLPlugin implements TrackerPluginInterface { readonly pluginName = "PathContextFromURLPlugin"; /** * Initializes validation rules. */ initialize(): void; /** * Generate a fresh PathContext before each TrackerEvent is handed over to the TrackerTransport. */ enrich(contexts: Required<ContextsConfig>): void; /** * Make this plugin usable only on web, eg: Document and Location APIs are both available */ isUsable(): boolean; } export { PathContextFromURLPlugin };