TrackerPlugin
Plugins can enrich a Tracker's LocationStack or GlobalContexts or even trigger automatic Events.
Properties
pluginName
Required, string.
Used for logging messages and, in general, to uniquely identify this plugin.
Methods
isUsable
isUsable(): boolean
Should return if the TrackerPlugin can be used, e.g. a browser based plugin may want to return false
during SSR.
Lifecycle
Plugins may implement lifecycle methods. These receive as parameter the Tracker's contexts.
initialize
initialize: (tracker: TrackerInterface) => void
Trackers will invoke initialize
:
- at construction
- when switching
active
state - when switching
anonymous
state
enrich
enrich: (contexts: Required<ContextsConfig>) => void
Trackers will invoke enrich
before validate
.
validate
validate: (event: TrackerEvent) => void
Trackers will invoke validate
before handing events over to Queue / Transport.
see also