@@ -44,6 +44,81 @@ export interface RegisterOptions {
4444 persistent : boolean ;
4545}
4646
47+ export type TrackPageView =
48+ | boolean
49+ | "url-with-path"
50+ | "url-with-path-and-query-string"
51+ | "full-url" ;
52+
53+ export interface AutocaptureConfig {
54+ /**
55+ * When set to `true`, Mixpanel will track element clicks. It will not track textContent unless `capture_text_content` is also set to `true`.
56+ * @default true
57+ */
58+ click ?: boolean ;
59+ /**
60+ * When set to `true`, Mixpanel will track when an input is provided. It will not capture input content.
61+ * @default true
62+ */
63+ input ?: boolean ;
64+ /**
65+ * When set, Mixpanel will collect pageviews when some components of the URL change — including UTM parameters.
66+ * @default 'full-url'
67+ */
68+ pageview ?: TrackPageView ;
69+ /**
70+ * When set, Mixpanel will collect page scrolls at specified scroll intervals.
71+ * @default true
72+ */
73+ scroll ?: boolean ;
74+ /**
75+ * When set to `true`, Mixpanel will track form submissions (but not submission content).
76+ * @default true
77+ */
78+ submit ?: boolean ;
79+ /**
80+ * When set to `true`, Mixpanel will capture the textContent of any element.
81+ * @default false
82+ */
83+ capture_text_content ?: boolean ;
84+ /** Enables specification of additional attributes to track. */
85+ capture_extra_attrs ?: string [ ] ;
86+ /**
87+ * Establishes the scroll depth intervals which trigger `Page Scroll` event.
88+ * @default [25, 50, 75, 100]
89+ */
90+ scroll_depth_percent_checkpoints ?: number [ ] ;
91+ /**
92+ * When set to true, overrides `scroll_depth_percentage_checkpoints` and captures all scroll events.
93+ * @default false
94+ */
95+ scroll_capture_all ?: boolean ;
96+ /** Opts out specific pages from Autocapture. */
97+ block_url_regexes ?: RegExp [ ] ;
98+ /** Opts in specific pages to Autocapture. */
99+ allow_url_regexes ?: RegExp [ ] ;
100+ /** Opts out specific classes from Autocapture. */
101+ block_selectors ?: string [ ] ;
102+ /** Opts in specific classes to Autocapture. */
103+ allow_selectors ?: string [ ] ;
104+ /** Opts out specific attributes from Autocapture. */
105+ block_attrs ?: string [ ] ;
106+ /**
107+ * A user-provided function that determines whether a specific element should be
108+ * tracked via Autocapture or not. The function receives the element as its first
109+ * argument, and the DOM event as its second argument, and should return `true` if
110+ * the element should be tracked (otherwise the element will NOT be tracked).
111+ */
112+ allow_element_callback ?: ( element : Element , event : Event ) => boolean ;
113+ /**
114+ * A user-provided function that determines whether a specific element should be
115+ * blocked from tracking via Autocapture or not. The function receives the element
116+ * as its first argument, and the DOM event as its second argument, and should
117+ * return `true` if the element should be blocked.
118+ */
119+ block_element_callback ?: ( element : Element , event : Event ) => boolean ;
120+ }
121+
47122export interface Config {
48123 api_host : string ;
49124 api_routes : {
@@ -76,11 +151,8 @@ export interface Config {
76151 */
77152 debug : boolean ;
78153 track_links_timeout : number ;
79- track_pageview :
80- | boolean
81- | "url-with-path"
82- | "url-with-path-and-query-string"
83- | "full-url" ;
154+ track_pageview : TrackPageView ;
155+ autocapture : boolean | AutocaptureConfig ;
84156 skip_first_touch_marketing : boolean ;
85157 cookie_expiration : number ;
86158 upgrade : boolean ;
0 commit comments