trackPressEvent
Triggers a PressEvent for the given TrackedElement.
trackPressEvent = (parameters: {
element: TrackedElement;
locationStack?: LocationStack;
globalContexts?: GlobalContexts;
tracker?: BrowserTracker;
onError?: TrackerErrorHandlerCallback;
}) => void
info
trackPressEvent
is triggered automatically, on click event, by tagPressable, tagLink or tagExpandable.
Parameters
type | default value | ||
---|---|---|---|
required | element | TrackedElement | |
optional | locationStack | LocationStack | |
optional | globalContexts | GlobalContexts | |
optional | tracker | BrowserTracker | |
optional | onError | TrackerErrorHandlerCallback | TrackerConsole.error |
Returns
trackPressEvent
is a void function.
Usage example
import { trackPressEvent } from '@objectiv/tracker-browser';
<div
onClick={(event) => {
trackPressEvent({ element: event.target })
}}
/>
<Accordion
onClick={(event) => {
trackPressEvent({ element: event.target })
}}
/>
Did you know ?
trackPressEvent
is just syntactic sugar on top of trackEvent.