UNPKG

@sajari/sdk-react

Version:
47 lines (46 loc) 1.66 kB
import { CallbackFn } from "../listener"; import { Pipeline } from "../pipeline"; import { Response } from "../response"; import { Tracking } from "../tracking"; /** * Analytics is an adaptor which listens for events on Pipeline and * Tracking and re-emits them as analytics-based events. */ export declare class Analytics { private enabled; private body; private pipeline; private tracking; private listeners; private longestNonAutocompletedBody; private longestAutocompletedBody; private bodyLabel; private bodyAutocompletedLabel; /** * Constructs an analytics object that operates on the specified pipeline. */ constructor(pipeline: Pipeline, tracking: Tracking); /** * Register a listener for a specific event. * @param event Event to listen for * @param callback Callback to run when the event happens. * @return The unregister function to remove the callback from the listener. */ listen(event: string, callback: CallbackFn): import("../listener").UnlistenFn; /** * Runs before the page is closed/navigated away from. Can trigger a ga onPageClose call. */ beforeunload: () => void; /** * Resets the currently held parameters. Can trigger a ga onBodyReset call. */ resetBody: () => void; /** * Runs when the response has been updated. Updates the currently held search parameters. */ responseUpdated: (response: Response) => void; /** * Runs when a result has been clicked. Can trigger a ga onResultClicked call. */ resultClicked: () => void; }