import { RefObject } from 'react'; export interface UseAnalyticsContentProps { onMount: (content?: string) => any; onUnmount?: (content?: string) => any; } /** * Use this hook to retrieve rendered content for use in analytics events. * It accepts `onMount` and `onUnmount` event handlers, which will be called * with the rendered textContent of the desired element. It grabs text content * from the first element that has it, in order of the returned refs array. * In the example below, it will favor content from `headingRef` (first ref) * but will fall back to `bodyRef` (second ref) if no content is found: * * const [headingRef, bodyRef] = useAnalyticsContent({ * onMount: (content: string | undefined) => { * if (!content) { * console.error('No content found for [component-name] analytics event'); * return; * } * sendLinkEvent({ * event_name: 'alert_impression', * heading: content, * type: variation, * }); * } * }) * * return ( *
*

Hello World

*

* I'm some body text *

*
* ) */ export declare function useAnalyticsContent({ onMount, onUnmount }: UseAnalyticsContentProps): RefObject[];