/** * Autocapture Types * * Type definitions for the DOM autocapture feature. * Privacy-first patterns for element capture and sensitive data handling. */ /** * DOM event types that can be autocaptured */ export type DomAutocaptureEvents = "click" | "change" | "submit"; /** * Elements that are compatible with autocapture */ export type AutocaptureCompatibleElement = "a" | "button" | "form" | "input" | "select" | "textarea" | "label"; /** * Autocapture configuration options */ export interface AutocaptureConfig { /** * List of URLs to allow autocapture on, can be strings to match * or regexes e.g. ['https://example.com', 'test.com/.*'] * this is useful when you want to autocapture on specific pages only * * if you set both url_allowlist and url_ignorelist, * we check the allowlist first and then the ignorelist. * the ignorelist can override the allowlist */ url_allowlist?: (string | RegExp)[]; /** * List of URLs to not allow autocapture on, can be strings to match * or regexes e.g. ['https://example.com', 'test.com/.*'] * this is useful when you want to autocapture on most pages but not some specific ones * * if you set both url_allowlist and url_ignorelist, * we check the allowlist first and then the ignorelist. * the ignorelist can override the allowlist */ url_ignorelist?: (string | RegExp)[]; /** * List of DOM events to allow autocapture on e.g. ['click', 'change', 'submit'] */ dom_event_allowlist?: DomAutocaptureEvents[]; /** * List of DOM elements to allow autocapture on * e.g. ['a', 'button', 'form', 'input', 'select', 'textarea', 'label'] * * We consider the tree of elements from the root to the target element of the click event * so for the tree `div > div > button > svg` * if the allowlist has `button` then we allow the capture when the `button` or the `svg` is the click target * but not if either of the `div`s are detected as the click target */ element_allowlist?: AutocaptureCompatibleElement[]; /** * List of CSS selectors to allow autocapture on * e.g. ['[vt-capture]'] * we consider the tree of elements from the root to the target element of the click event * so for the tree div > div > button > svg * and allow list config `['[id]']` * we will capture the click if the click-target or its parents has any id * * Everything is allowed when there's no allowlist */ css_selector_allowlist?: string[]; /** * List of CSS selectors to exclude from autocapture. * e.g. ['[data-cookie-banner]', '#cookie-consent'] * * If any element in the tree (from target to root) matches a selector in this list, * the event will NOT be captured. * * By default, common cookie consent banner patterns are excluded: * - Elements with 'cookie', 'consent', 'gdpr', 'privacy' in id/class * - Known consent management platforms (CookieBot, OneTrust, etc.) * * Set to empty array [] to disable default filtering. */ css_selector_ignorelist?: string[]; /** * Exclude certain element attributes from autocapture * E.g. ['aria-label'] or [data-attr-pii] */ element_attribute_ignorelist?: string[]; /** * When set to true, autocapture will capture the text of any element that is cut or copied. */ capture_copied_text?: boolean; /** * Capture form field values on change events (default: false) * * When enabled, captures $el_value and $selected_text properties: * - $el_value: The programmatic value (input.value, option.value, checkbox checked state) * - $selected_text: Human-readable selection (option text, checkbox label) * * Protected by multiple privacy layers: * - Password and hidden inputs are never captured * - Fields with sensitive names (cc, pass, ssn, etc.) are skipped * - Credit card and SSN patterns in values are filtered out * - Elements with vt-sensitive or vt-no-capture classes are excluded * * Use case: Tracking search keywords, filter selections, etc. * * @default false */ capture_element_values?: boolean; /** * Scroll depth autocapture — two independently opt-in modes (both default off). */ scroll_depth?: ScrollDepthConfig; } /** * Scroll depth autocapture configuration. */ export interface ScrollDepthConfig { /** Fire `$scroll_depth` when the user crosses depth thresholds while scrolling. */ milestones?: boolean | { thresholds?: number[]; }; /** Add max scroll depth to `$pageleave` as `$prev_pageview_scroll_depth_pct`. */ pageleave?: boolean; /** CSS selector(s) for the scroll container; falls back to `window`. */ scroll_root_selector?: string | string[]; } /** * Properties extracted from a DOM element */ export interface ElementProperties { tag_name: string; $el_text?: string; $el_value?: string; $selected_text?: string; classes?: string[]; nth_child?: number; nth_of_type?: number; attr__href?: string; attr__id?: string; attr__class?: string | string[]; [key: `attr__${string}`]: string | string[] | undefined; } /** * Internal element representation for chain string generation */ export interface ChainElement { text?: string; tag_name?: string; href?: string; attr_id?: string; attr_class?: string[]; nth_child?: number; nth_of_type?: number; attributes?: Record; event_id?: number; order?: number; group_id?: number; } /** * Properties for autocapture events */ export interface Properties { [key: string]: unknown; } /** * Default tags to capture events on */ export declare const autocaptureCompatibleElements: AutocaptureCompatibleElement[]; /** * Copy autocapture event name */ export declare const COPY_AUTOCAPTURE_EVENT = "$copy_autocapture"; /** * Default CSS selectors to ignore for autocapture. * These patterns match common cookie consent banners and privacy notices. * * Includes: * - Generic patterns: elements with 'cookie', 'consent', 'gdpr', 'privacy' in id/class * - CookieBot: #CybotCookiebotDialog, .CybotCookiebotDialog* * - OneTrust: #onetrust-*, .onetrust-* * - Cookie Consent (Insites): #cc-*, .cc-banner, .cc-window * - Cookieconsent.com: #cookieconsent*, .cookieconsent* * - GDPR Cookie Compliance: #gdpr-cookie-* * - Quantcast Choice: #qc-cmp2-* * - Termly: #termly-code-snippet-support * - Iubenda: #iubenda-* * - TrustArc: #truste-*, .truste-* * - Didomi: #didomi-* * - Usercentrics: #usercentrics-* */ export declare const DEFAULT_CSS_SELECTOR_IGNORELIST: string[];