@aranova/tracking-next 0.15.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -140,6 +140,49 @@ export function LeadForm() {
140
140
 
141
141
  `fields[].value` can be any JSON value: string, number, boolean, null, array, or object. Only send reviewed, allowlisted, non-sensitive values; do not send names, emails, phone numbers entered by the visitor, addresses, payment data, medical details, passwords, file contents, or free-text messages.
142
142
 
143
+ ### CTA clicks — manual or auto-capture
144
+
145
+ Fire `cta_click` yourself for full control over the name:
146
+
147
+ ```tsx
148
+ tracking.trackEvent("cta_click", {
149
+ cta_name: "Book appointment",
150
+ section: "hero",
151
+ destination_url: "/booking",
152
+ page: { path: window.location.pathname },
153
+ });
154
+ ```
155
+
156
+ Or opt into **auto-capture** and skip per-button code. Add `autoCapture` to the
157
+ `cta_click` registration — this attaches a single delegated click listener:
158
+
159
+ ```tsx
160
+ manual: {
161
+ cta_click: { autoCapture: {} }, // default selector: [data-aranova-cta]
162
+ // or target existing classes: { autoCapture: { selector: "a.cta, .btn-primary" } }
163
+ },
164
+ ```
165
+
166
+ Then tag your CTAs in markup — no imports, no handlers:
167
+
168
+ ```tsx
169
+ <a href="/booking" data-aranova-cta="Book now" data-aranova-section="hero">Book now</a>
170
+ <button data-aranova-cta="Get a quote">Get a quote</button>
171
+ ```
172
+
173
+ `cta_name` resolves to the `data-aranova-cta` value, else the element's trimmed text
174
+ (capped 120 chars), else `tag#id`. `section` comes from an optional `data-aranova-section`;
175
+ `href`/`destination_url` and a short `element` descriptor are captured automatically. Point
176
+ the selector at real CTAs (an explicit attribute is the safe default) — every matching click
177
+ is counted, including ones that later `stopPropagation`.
178
+
179
+ ### Automatic dwell + exit (`page_exit`)
180
+
181
+ `page_exit` is captured automatically — no registration. On route change, tab hide, and page
182
+ unload it records the **active** (visible) time spent on the page plus the max scroll depth
183
+ reached, delivered via a keepalive beacon so the final page still counts. This powers per-page
184
+ dwell and drop-off in the dashboard Analytics tab; there is nothing to configure.
185
+
143
186
  ## Phone Fields
144
187
 
145
188
  Bundled `libphonenumber-js`: parse/format utils + a React input. Display is configurable; the
package/dist/index.d.mts CHANGED
@@ -80,6 +80,8 @@ declare const ctaClickMetadataSchema: z.ZodObject<{
80
80
  }>;
81
81
  section: z.ZodOptional<z.ZodNullable<z.ZodString>>;
82
82
  destination_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
83
+ href: z.ZodOptional<z.ZodNullable<z.ZodString>>;
84
+ element: z.ZodOptional<z.ZodNullable<z.ZodString>>;
83
85
  }, "strict", z.ZodTypeAny, {
84
86
  page: {
85
87
  path: string;
@@ -87,6 +89,8 @@ declare const ctaClickMetadataSchema: z.ZodObject<{
87
89
  cta_name: string;
88
90
  section?: string | null | undefined;
89
91
  destination_url?: string | null | undefined;
92
+ href?: string | null | undefined;
93
+ element?: string | null | undefined;
90
94
  }, {
91
95
  page: {
92
96
  path: string;
@@ -94,14 +98,34 @@ declare const ctaClickMetadataSchema: z.ZodObject<{
94
98
  cta_name: string;
95
99
  section?: string | null | undefined;
96
100
  destination_url?: string | null | undefined;
101
+ href?: string | null | undefined;
102
+ element?: string | null | undefined;
97
103
  }>;
98
104
  type CtaClickMetadata = z.infer<typeof ctaClickMetadataSchema>;
99
105
  /**
100
106
  * Registration config for `cta_click`.
101
107
  *
102
- * This event is manual-only and currently has no registration options.
108
+ * The event stays manually fireable; `autoCapture` additionally attaches a
109
+ * delegated click listener that fires it for any element matching `selector`
110
+ * (default `[data-aranova-cta]`) — tag your CTAs, get analytics for free.
103
111
  */
104
- declare const ctaClickConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
112
+ declare const ctaClickConfigSchema: z.ZodObject<{
113
+ autoCapture: z.ZodOptional<z.ZodObject<{
114
+ selector: z.ZodOptional<z.ZodString>;
115
+ }, "strict", z.ZodTypeAny, {
116
+ selector?: string | undefined;
117
+ }, {
118
+ selector?: string | undefined;
119
+ }>>;
120
+ }, "strict", z.ZodTypeAny, {
121
+ autoCapture?: {
122
+ selector?: string | undefined;
123
+ } | undefined;
124
+ }, {
125
+ autoCapture?: {
126
+ selector?: string | undefined;
127
+ } | undefined;
128
+ }>;
105
129
  type CtaClickConfig = z.infer<typeof ctaClickConfigSchema>;
106
130
 
107
131
  /**
@@ -265,6 +289,49 @@ declare const multiPageSessionConfigSchema: z.ZodObject<{
265
289
  }>;
266
290
  type MultiPageSessionConfig = z.infer<typeof multiPageSessionConfigSchema>;
267
291
 
292
+ /**
293
+ * Metadata for the automatic `page_exit` event.
294
+ *
295
+ * Fired when the user leaves a page (SPA navigation away, tab hidden, or
296
+ * pagehide). `dwell_ms` is the ACTIVE (visible) time spent on the page segment
297
+ * being closed — hidden time never counts, matching `time_on_site` semantics.
298
+ * A page revisited after being hidden emits another `page_exit` for the next
299
+ * visible segment, so summing `dwell_ms` per page/session yields total active
300
+ * dwell without double counting.
301
+ */
302
+ declare const pageExitMetadataSchema: z.ZodObject<{
303
+ dwell_ms: z.ZodNumber;
304
+ max_scroll_percent: z.ZodNullable<z.ZodNumber>;
305
+ page: z.ZodObject<{
306
+ path: z.ZodString;
307
+ }, "strict", z.ZodTypeAny, {
308
+ path: string;
309
+ }, {
310
+ path: string;
311
+ }>;
312
+ }, "strict", z.ZodTypeAny, {
313
+ page: {
314
+ path: string;
315
+ };
316
+ dwell_ms: number;
317
+ max_scroll_percent: number | null;
318
+ }, {
319
+ page: {
320
+ path: string;
321
+ };
322
+ dwell_ms: number;
323
+ max_scroll_percent: number | null;
324
+ }>;
325
+ type PageExitMetadata = z.infer<typeof pageExitMetadataSchema>;
326
+ /**
327
+ * Registration config for automatic `page_exit`.
328
+ *
329
+ * SDK-internal: attached unconditionally (like `sdk_heartbeat`), so there are
330
+ * no registration options.
331
+ */
332
+ declare const pageExitConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
333
+ type PageExitConfig = z.infer<typeof pageExitConfigSchema>;
334
+
268
335
  /**
269
336
  * Metadata for the automatic `page_view` event.
270
337
  *
@@ -796,6 +863,33 @@ declare const EVENT_REGISTRY: {
796
863
  }>;
797
864
  readonly configSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
798
865
  };
866
+ readonly page_exit: {
867
+ readonly kind: "automatic";
868
+ readonly metadataSchema: z.ZodObject<{
869
+ dwell_ms: z.ZodNumber;
870
+ max_scroll_percent: z.ZodNullable<z.ZodNumber>;
871
+ page: z.ZodObject<{
872
+ path: z.ZodString;
873
+ }, "strict", z.ZodTypeAny, {
874
+ path: string;
875
+ }, {
876
+ path: string;
877
+ }>;
878
+ }, "strict", z.ZodTypeAny, {
879
+ page: {
880
+ path: string;
881
+ };
882
+ dwell_ms: number;
883
+ max_scroll_percent: number | null;
884
+ }, {
885
+ page: {
886
+ path: string;
887
+ };
888
+ dwell_ms: number;
889
+ max_scroll_percent: number | null;
890
+ }>;
891
+ readonly configSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
892
+ };
799
893
  readonly form_submit: {
800
894
  readonly kind: "manual";
801
895
  readonly metadataSchema: z.ZodObject<{
@@ -915,6 +1009,8 @@ declare const EVENT_REGISTRY: {
915
1009
  }>;
916
1010
  section: z.ZodOptional<z.ZodNullable<z.ZodString>>;
917
1011
  destination_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1012
+ href: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1013
+ element: z.ZodOptional<z.ZodNullable<z.ZodString>>;
918
1014
  }, "strict", z.ZodTypeAny, {
919
1015
  page: {
920
1016
  path: string;
@@ -922,6 +1018,8 @@ declare const EVENT_REGISTRY: {
922
1018
  cta_name: string;
923
1019
  section?: string | null | undefined;
924
1020
  destination_url?: string | null | undefined;
1021
+ href?: string | null | undefined;
1022
+ element?: string | null | undefined;
925
1023
  }, {
926
1024
  page: {
927
1025
  path: string;
@@ -929,8 +1027,26 @@ declare const EVENT_REGISTRY: {
929
1027
  cta_name: string;
930
1028
  section?: string | null | undefined;
931
1029
  destination_url?: string | null | undefined;
1030
+ href?: string | null | undefined;
1031
+ element?: string | null | undefined;
1032
+ }>;
1033
+ readonly configSchema: z.ZodObject<{
1034
+ autoCapture: z.ZodOptional<z.ZodObject<{
1035
+ selector: z.ZodOptional<z.ZodString>;
1036
+ }, "strict", z.ZodTypeAny, {
1037
+ selector?: string | undefined;
1038
+ }, {
1039
+ selector?: string | undefined;
1040
+ }>>;
1041
+ }, "strict", z.ZodTypeAny, {
1042
+ autoCapture?: {
1043
+ selector?: string | undefined;
1044
+ } | undefined;
1045
+ }, {
1046
+ autoCapture?: {
1047
+ selector?: string | undefined;
1048
+ } | undefined;
932
1049
  }>;
933
- readonly configSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
934
1050
  };
935
1051
  };
936
1052
  /**
@@ -959,6 +1075,7 @@ type MetadataByName = {
959
1075
  multi_page_session: MultiPageSessionMetadata;
960
1076
  form_start: FormStartMetadata;
961
1077
  sdk_heartbeat: SdkHeartbeatMetadata;
1078
+ page_exit: PageExitMetadata;
962
1079
  form_submit: FormSubmitMetadata;
963
1080
  phone_click: PhoneClickMetadata;
964
1081
  cta_click: CtaClickMetadata;
@@ -971,6 +1088,7 @@ type ConfigByName = {
971
1088
  multi_page_session: MultiPageSessionConfig;
972
1089
  form_start: FormStartConfig;
973
1090
  sdk_heartbeat: SdkHeartbeatConfig;
1091
+ page_exit: PageExitConfig;
974
1092
  form_submit: FormSubmitConfig;
975
1093
  phone_click: PhoneClickConfig;
976
1094
  cta_click: CtaClickConfig;
@@ -1085,8 +1203,14 @@ interface TrackEventInput {
1085
1203
  interface TrackingClient {
1086
1204
  /** Enqueue an event for batched delivery. */
1087
1205
  trackEvent: (input: TrackEventInput) => void;
1088
- /** Flush queued events immediately. */
1206
+ /** Flush queued events immediately (fetch, non-keepalive). */
1089
1207
  flush: () => Promise<void>;
1208
+ /**
1209
+ * Flush queued events through the keepalive transport so the request
1210
+ * survives document unload. Use from `pagehide`/`visibilitychange:hidden`
1211
+ * handlers — a plain `flush()` there is aborted by the browser on unload.
1212
+ */
1213
+ flushBeacon: () => void;
1090
1214
  /** Return the current rolling session id. */
1091
1215
  getSessionId: () => string;
1092
1216
  /** Return the persistent visitor id. */
@@ -1466,4 +1590,4 @@ interface PhoneFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "t
1466
1590
  */
1467
1591
  declare const PhoneField: react.ForwardRefExoticComponent<PhoneFieldProps & react.RefAttributes<HTMLInputElement>>;
1468
1592
 
1469
- export { ALL_AUTOMATIC_EVENT_NAMES, ALL_MANUAL_EVENT_NAMES, AdPlatformTracking, type AdPlatformTrackingProps, type AutomaticEventName, ConsentBanner, type ConsentBannerProps, ConsentChoiceState, ConsentSource, ConsentState, ConversionConfig, type CreateTrackingOptions, type CreateTrackingResult, type CtaClickConfig, type CtaClickMetadata, EVENT_REGISTRY, type EventConfig, type EventKind, type EventMetadata, type EventName, type FormStartConfig, type FormStartMetadata, FormSubmitConfig, FormSubmitMetadata, GoogleAdsTracking, type GoogleAdsTrackingProps, GtagEnvironmentMap, type ManualEventName, MetaPixelEnvironmentMap, type MultiPageSessionConfig, type MultiPageSessionMetadata, type PageViewConfig, type PageViewMetadata, ParsedPhone, type PhoneClickConfig, type PhoneClickMetadata, PhoneConfig, PhoneDisplayFormat, PhoneField, type PhoneFieldApi, type PhoneFieldProps, type PhoneInputProps, type RegisteredAutomaticEvents, type RegisteredManualEvents, SPECIFIC_PAGE_NAMES, type ScrollDepthConfig, type ScrollDepthMetadata, type SdkHeartbeatConfig, type SdkHeartbeatMetadata, type SpecificPageName, type SpecificPageVisitConfig, type SpecificPageVisitMetadata, TRACKING_PARAM_KEYS, type TimeOnSiteConfig, type TimeOnSiteMetadata, type TrackableEvent, type TrackingClient, TrackingClientContext, TrackingEventCreatePayload, TrackingInstallSurface, TrackingParams, type TrackingProviderProps, TrackingSessionUpsertPayload, type TriggerRegistryConfig, type TypedTrackEventOptions, type TypedTrackingClient, type UseConsentResult, type UseCookiePreferencesOptions, type UseCookiePreferencesResult, type UsePhoneFieldOptions, captureTrackingParamsFromLocation, createTracking, createTrackingClientContext, createTrackingEventCreatePayload, createTrackingSessionUpsertPayload, ctaClickConfigSchema, ctaClickMetadataSchema, formStartConfigSchema, formStartMetadataSchema, getEventDefinition, multiPageSessionConfigSchema, multiPageSessionMetadataSchema, pageViewConfigSchema, pageViewMetadataSchema, phoneClickConfigSchema, phoneClickMetadataSchema, scrollDepthConfigSchema, scrollDepthMetadataSchema, sdkHeartbeatConfigSchema, sdkHeartbeatMetadataSchema, sdkHeartbeatTriggersSchema, specificPageNameSchema, specificPageVisitConfigSchema, specificPageVisitMetadataSchema, timeOnSiteConfigSchema, timeOnSiteMetadataSchema, useConsent, useConsentState, useCookiePreferences, useGclid, usePhoneConfig, usePhoneField, useTrackingParams };
1593
+ export { ALL_AUTOMATIC_EVENT_NAMES, ALL_MANUAL_EVENT_NAMES, AdPlatformTracking, type AdPlatformTrackingProps, type AutomaticEventName, ConsentBanner, type ConsentBannerProps, ConsentChoiceState, ConsentSource, ConsentState, ConversionConfig, type CreateTrackingOptions, type CreateTrackingResult, type CtaClickConfig, type CtaClickMetadata, EVENT_REGISTRY, type EventConfig, type EventKind, type EventMetadata, type EventName, type FormStartConfig, type FormStartMetadata, FormSubmitConfig, FormSubmitMetadata, GoogleAdsTracking, type GoogleAdsTrackingProps, GtagEnvironmentMap, type ManualEventName, MetaPixelEnvironmentMap, type MultiPageSessionConfig, type MultiPageSessionMetadata, type PageExitConfig, type PageExitMetadata, type PageViewConfig, type PageViewMetadata, ParsedPhone, type PhoneClickConfig, type PhoneClickMetadata, PhoneConfig, PhoneDisplayFormat, PhoneField, type PhoneFieldApi, type PhoneFieldProps, type PhoneInputProps, type RegisteredAutomaticEvents, type RegisteredManualEvents, SPECIFIC_PAGE_NAMES, type ScrollDepthConfig, type ScrollDepthMetadata, type SdkHeartbeatConfig, type SdkHeartbeatMetadata, type SpecificPageName, type SpecificPageVisitConfig, type SpecificPageVisitMetadata, TRACKING_PARAM_KEYS, type TimeOnSiteConfig, type TimeOnSiteMetadata, type TrackableEvent, type TrackingClient, TrackingClientContext, TrackingEventCreatePayload, TrackingInstallSurface, TrackingParams, type TrackingProviderProps, TrackingSessionUpsertPayload, type TriggerRegistryConfig, type TypedTrackEventOptions, type TypedTrackingClient, type UseConsentResult, type UseCookiePreferencesOptions, type UseCookiePreferencesResult, type UsePhoneFieldOptions, captureTrackingParamsFromLocation, createTracking, createTrackingClientContext, createTrackingEventCreatePayload, createTrackingSessionUpsertPayload, ctaClickConfigSchema, ctaClickMetadataSchema, formStartConfigSchema, formStartMetadataSchema, getEventDefinition, multiPageSessionConfigSchema, multiPageSessionMetadataSchema, pageExitConfigSchema, pageExitMetadataSchema, pageViewConfigSchema, pageViewMetadataSchema, phoneClickConfigSchema, phoneClickMetadataSchema, scrollDepthConfigSchema, scrollDepthMetadataSchema, sdkHeartbeatConfigSchema, sdkHeartbeatMetadataSchema, sdkHeartbeatTriggersSchema, specificPageNameSchema, specificPageVisitConfigSchema, specificPageVisitMetadataSchema, timeOnSiteConfigSchema, timeOnSiteMetadataSchema, useConsent, useConsentState, useCookiePreferences, useGclid, usePhoneConfig, usePhoneField, useTrackingParams };
package/dist/index.d.ts CHANGED
@@ -80,6 +80,8 @@ declare const ctaClickMetadataSchema: z.ZodObject<{
80
80
  }>;
81
81
  section: z.ZodOptional<z.ZodNullable<z.ZodString>>;
82
82
  destination_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
83
+ href: z.ZodOptional<z.ZodNullable<z.ZodString>>;
84
+ element: z.ZodOptional<z.ZodNullable<z.ZodString>>;
83
85
  }, "strict", z.ZodTypeAny, {
84
86
  page: {
85
87
  path: string;
@@ -87,6 +89,8 @@ declare const ctaClickMetadataSchema: z.ZodObject<{
87
89
  cta_name: string;
88
90
  section?: string | null | undefined;
89
91
  destination_url?: string | null | undefined;
92
+ href?: string | null | undefined;
93
+ element?: string | null | undefined;
90
94
  }, {
91
95
  page: {
92
96
  path: string;
@@ -94,14 +98,34 @@ declare const ctaClickMetadataSchema: z.ZodObject<{
94
98
  cta_name: string;
95
99
  section?: string | null | undefined;
96
100
  destination_url?: string | null | undefined;
101
+ href?: string | null | undefined;
102
+ element?: string | null | undefined;
97
103
  }>;
98
104
  type CtaClickMetadata = z.infer<typeof ctaClickMetadataSchema>;
99
105
  /**
100
106
  * Registration config for `cta_click`.
101
107
  *
102
- * This event is manual-only and currently has no registration options.
108
+ * The event stays manually fireable; `autoCapture` additionally attaches a
109
+ * delegated click listener that fires it for any element matching `selector`
110
+ * (default `[data-aranova-cta]`) — tag your CTAs, get analytics for free.
103
111
  */
104
- declare const ctaClickConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
112
+ declare const ctaClickConfigSchema: z.ZodObject<{
113
+ autoCapture: z.ZodOptional<z.ZodObject<{
114
+ selector: z.ZodOptional<z.ZodString>;
115
+ }, "strict", z.ZodTypeAny, {
116
+ selector?: string | undefined;
117
+ }, {
118
+ selector?: string | undefined;
119
+ }>>;
120
+ }, "strict", z.ZodTypeAny, {
121
+ autoCapture?: {
122
+ selector?: string | undefined;
123
+ } | undefined;
124
+ }, {
125
+ autoCapture?: {
126
+ selector?: string | undefined;
127
+ } | undefined;
128
+ }>;
105
129
  type CtaClickConfig = z.infer<typeof ctaClickConfigSchema>;
106
130
 
107
131
  /**
@@ -265,6 +289,49 @@ declare const multiPageSessionConfigSchema: z.ZodObject<{
265
289
  }>;
266
290
  type MultiPageSessionConfig = z.infer<typeof multiPageSessionConfigSchema>;
267
291
 
292
+ /**
293
+ * Metadata for the automatic `page_exit` event.
294
+ *
295
+ * Fired when the user leaves a page (SPA navigation away, tab hidden, or
296
+ * pagehide). `dwell_ms` is the ACTIVE (visible) time spent on the page segment
297
+ * being closed — hidden time never counts, matching `time_on_site` semantics.
298
+ * A page revisited after being hidden emits another `page_exit` for the next
299
+ * visible segment, so summing `dwell_ms` per page/session yields total active
300
+ * dwell without double counting.
301
+ */
302
+ declare const pageExitMetadataSchema: z.ZodObject<{
303
+ dwell_ms: z.ZodNumber;
304
+ max_scroll_percent: z.ZodNullable<z.ZodNumber>;
305
+ page: z.ZodObject<{
306
+ path: z.ZodString;
307
+ }, "strict", z.ZodTypeAny, {
308
+ path: string;
309
+ }, {
310
+ path: string;
311
+ }>;
312
+ }, "strict", z.ZodTypeAny, {
313
+ page: {
314
+ path: string;
315
+ };
316
+ dwell_ms: number;
317
+ max_scroll_percent: number | null;
318
+ }, {
319
+ page: {
320
+ path: string;
321
+ };
322
+ dwell_ms: number;
323
+ max_scroll_percent: number | null;
324
+ }>;
325
+ type PageExitMetadata = z.infer<typeof pageExitMetadataSchema>;
326
+ /**
327
+ * Registration config for automatic `page_exit`.
328
+ *
329
+ * SDK-internal: attached unconditionally (like `sdk_heartbeat`), so there are
330
+ * no registration options.
331
+ */
332
+ declare const pageExitConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
333
+ type PageExitConfig = z.infer<typeof pageExitConfigSchema>;
334
+
268
335
  /**
269
336
  * Metadata for the automatic `page_view` event.
270
337
  *
@@ -796,6 +863,33 @@ declare const EVENT_REGISTRY: {
796
863
  }>;
797
864
  readonly configSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
798
865
  };
866
+ readonly page_exit: {
867
+ readonly kind: "automatic";
868
+ readonly metadataSchema: z.ZodObject<{
869
+ dwell_ms: z.ZodNumber;
870
+ max_scroll_percent: z.ZodNullable<z.ZodNumber>;
871
+ page: z.ZodObject<{
872
+ path: z.ZodString;
873
+ }, "strict", z.ZodTypeAny, {
874
+ path: string;
875
+ }, {
876
+ path: string;
877
+ }>;
878
+ }, "strict", z.ZodTypeAny, {
879
+ page: {
880
+ path: string;
881
+ };
882
+ dwell_ms: number;
883
+ max_scroll_percent: number | null;
884
+ }, {
885
+ page: {
886
+ path: string;
887
+ };
888
+ dwell_ms: number;
889
+ max_scroll_percent: number | null;
890
+ }>;
891
+ readonly configSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
892
+ };
799
893
  readonly form_submit: {
800
894
  readonly kind: "manual";
801
895
  readonly metadataSchema: z.ZodObject<{
@@ -915,6 +1009,8 @@ declare const EVENT_REGISTRY: {
915
1009
  }>;
916
1010
  section: z.ZodOptional<z.ZodNullable<z.ZodString>>;
917
1011
  destination_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1012
+ href: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1013
+ element: z.ZodOptional<z.ZodNullable<z.ZodString>>;
918
1014
  }, "strict", z.ZodTypeAny, {
919
1015
  page: {
920
1016
  path: string;
@@ -922,6 +1018,8 @@ declare const EVENT_REGISTRY: {
922
1018
  cta_name: string;
923
1019
  section?: string | null | undefined;
924
1020
  destination_url?: string | null | undefined;
1021
+ href?: string | null | undefined;
1022
+ element?: string | null | undefined;
925
1023
  }, {
926
1024
  page: {
927
1025
  path: string;
@@ -929,8 +1027,26 @@ declare const EVENT_REGISTRY: {
929
1027
  cta_name: string;
930
1028
  section?: string | null | undefined;
931
1029
  destination_url?: string | null | undefined;
1030
+ href?: string | null | undefined;
1031
+ element?: string | null | undefined;
1032
+ }>;
1033
+ readonly configSchema: z.ZodObject<{
1034
+ autoCapture: z.ZodOptional<z.ZodObject<{
1035
+ selector: z.ZodOptional<z.ZodString>;
1036
+ }, "strict", z.ZodTypeAny, {
1037
+ selector?: string | undefined;
1038
+ }, {
1039
+ selector?: string | undefined;
1040
+ }>>;
1041
+ }, "strict", z.ZodTypeAny, {
1042
+ autoCapture?: {
1043
+ selector?: string | undefined;
1044
+ } | undefined;
1045
+ }, {
1046
+ autoCapture?: {
1047
+ selector?: string | undefined;
1048
+ } | undefined;
932
1049
  }>;
933
- readonly configSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
934
1050
  };
935
1051
  };
936
1052
  /**
@@ -959,6 +1075,7 @@ type MetadataByName = {
959
1075
  multi_page_session: MultiPageSessionMetadata;
960
1076
  form_start: FormStartMetadata;
961
1077
  sdk_heartbeat: SdkHeartbeatMetadata;
1078
+ page_exit: PageExitMetadata;
962
1079
  form_submit: FormSubmitMetadata;
963
1080
  phone_click: PhoneClickMetadata;
964
1081
  cta_click: CtaClickMetadata;
@@ -971,6 +1088,7 @@ type ConfigByName = {
971
1088
  multi_page_session: MultiPageSessionConfig;
972
1089
  form_start: FormStartConfig;
973
1090
  sdk_heartbeat: SdkHeartbeatConfig;
1091
+ page_exit: PageExitConfig;
974
1092
  form_submit: FormSubmitConfig;
975
1093
  phone_click: PhoneClickConfig;
976
1094
  cta_click: CtaClickConfig;
@@ -1085,8 +1203,14 @@ interface TrackEventInput {
1085
1203
  interface TrackingClient {
1086
1204
  /** Enqueue an event for batched delivery. */
1087
1205
  trackEvent: (input: TrackEventInput) => void;
1088
- /** Flush queued events immediately. */
1206
+ /** Flush queued events immediately (fetch, non-keepalive). */
1089
1207
  flush: () => Promise<void>;
1208
+ /**
1209
+ * Flush queued events through the keepalive transport so the request
1210
+ * survives document unload. Use from `pagehide`/`visibilitychange:hidden`
1211
+ * handlers — a plain `flush()` there is aborted by the browser on unload.
1212
+ */
1213
+ flushBeacon: () => void;
1090
1214
  /** Return the current rolling session id. */
1091
1215
  getSessionId: () => string;
1092
1216
  /** Return the persistent visitor id. */
@@ -1466,4 +1590,4 @@ interface PhoneFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "t
1466
1590
  */
1467
1591
  declare const PhoneField: react.ForwardRefExoticComponent<PhoneFieldProps & react.RefAttributes<HTMLInputElement>>;
1468
1592
 
1469
- export { ALL_AUTOMATIC_EVENT_NAMES, ALL_MANUAL_EVENT_NAMES, AdPlatformTracking, type AdPlatformTrackingProps, type AutomaticEventName, ConsentBanner, type ConsentBannerProps, ConsentChoiceState, ConsentSource, ConsentState, ConversionConfig, type CreateTrackingOptions, type CreateTrackingResult, type CtaClickConfig, type CtaClickMetadata, EVENT_REGISTRY, type EventConfig, type EventKind, type EventMetadata, type EventName, type FormStartConfig, type FormStartMetadata, FormSubmitConfig, FormSubmitMetadata, GoogleAdsTracking, type GoogleAdsTrackingProps, GtagEnvironmentMap, type ManualEventName, MetaPixelEnvironmentMap, type MultiPageSessionConfig, type MultiPageSessionMetadata, type PageViewConfig, type PageViewMetadata, ParsedPhone, type PhoneClickConfig, type PhoneClickMetadata, PhoneConfig, PhoneDisplayFormat, PhoneField, type PhoneFieldApi, type PhoneFieldProps, type PhoneInputProps, type RegisteredAutomaticEvents, type RegisteredManualEvents, SPECIFIC_PAGE_NAMES, type ScrollDepthConfig, type ScrollDepthMetadata, type SdkHeartbeatConfig, type SdkHeartbeatMetadata, type SpecificPageName, type SpecificPageVisitConfig, type SpecificPageVisitMetadata, TRACKING_PARAM_KEYS, type TimeOnSiteConfig, type TimeOnSiteMetadata, type TrackableEvent, type TrackingClient, TrackingClientContext, TrackingEventCreatePayload, TrackingInstallSurface, TrackingParams, type TrackingProviderProps, TrackingSessionUpsertPayload, type TriggerRegistryConfig, type TypedTrackEventOptions, type TypedTrackingClient, type UseConsentResult, type UseCookiePreferencesOptions, type UseCookiePreferencesResult, type UsePhoneFieldOptions, captureTrackingParamsFromLocation, createTracking, createTrackingClientContext, createTrackingEventCreatePayload, createTrackingSessionUpsertPayload, ctaClickConfigSchema, ctaClickMetadataSchema, formStartConfigSchema, formStartMetadataSchema, getEventDefinition, multiPageSessionConfigSchema, multiPageSessionMetadataSchema, pageViewConfigSchema, pageViewMetadataSchema, phoneClickConfigSchema, phoneClickMetadataSchema, scrollDepthConfigSchema, scrollDepthMetadataSchema, sdkHeartbeatConfigSchema, sdkHeartbeatMetadataSchema, sdkHeartbeatTriggersSchema, specificPageNameSchema, specificPageVisitConfigSchema, specificPageVisitMetadataSchema, timeOnSiteConfigSchema, timeOnSiteMetadataSchema, useConsent, useConsentState, useCookiePreferences, useGclid, usePhoneConfig, usePhoneField, useTrackingParams };
1593
+ export { ALL_AUTOMATIC_EVENT_NAMES, ALL_MANUAL_EVENT_NAMES, AdPlatformTracking, type AdPlatformTrackingProps, type AutomaticEventName, ConsentBanner, type ConsentBannerProps, ConsentChoiceState, ConsentSource, ConsentState, ConversionConfig, type CreateTrackingOptions, type CreateTrackingResult, type CtaClickConfig, type CtaClickMetadata, EVENT_REGISTRY, type EventConfig, type EventKind, type EventMetadata, type EventName, type FormStartConfig, type FormStartMetadata, FormSubmitConfig, FormSubmitMetadata, GoogleAdsTracking, type GoogleAdsTrackingProps, GtagEnvironmentMap, type ManualEventName, MetaPixelEnvironmentMap, type MultiPageSessionConfig, type MultiPageSessionMetadata, type PageExitConfig, type PageExitMetadata, type PageViewConfig, type PageViewMetadata, ParsedPhone, type PhoneClickConfig, type PhoneClickMetadata, PhoneConfig, PhoneDisplayFormat, PhoneField, type PhoneFieldApi, type PhoneFieldProps, type PhoneInputProps, type RegisteredAutomaticEvents, type RegisteredManualEvents, SPECIFIC_PAGE_NAMES, type ScrollDepthConfig, type ScrollDepthMetadata, type SdkHeartbeatConfig, type SdkHeartbeatMetadata, type SpecificPageName, type SpecificPageVisitConfig, type SpecificPageVisitMetadata, TRACKING_PARAM_KEYS, type TimeOnSiteConfig, type TimeOnSiteMetadata, type TrackableEvent, type TrackingClient, TrackingClientContext, TrackingEventCreatePayload, TrackingInstallSurface, TrackingParams, type TrackingProviderProps, TrackingSessionUpsertPayload, type TriggerRegistryConfig, type TypedTrackEventOptions, type TypedTrackingClient, type UseConsentResult, type UseCookiePreferencesOptions, type UseCookiePreferencesResult, type UsePhoneFieldOptions, captureTrackingParamsFromLocation, createTracking, createTrackingClientContext, createTrackingEventCreatePayload, createTrackingSessionUpsertPayload, ctaClickConfigSchema, ctaClickMetadataSchema, formStartConfigSchema, formStartMetadataSchema, getEventDefinition, multiPageSessionConfigSchema, multiPageSessionMetadataSchema, pageExitConfigSchema, pageExitMetadataSchema, pageViewConfigSchema, pageViewMetadataSchema, phoneClickConfigSchema, phoneClickMetadataSchema, scrollDepthConfigSchema, scrollDepthMetadataSchema, sdkHeartbeatConfigSchema, sdkHeartbeatMetadataSchema, sdkHeartbeatTriggersSchema, specificPageNameSchema, specificPageVisitConfigSchema, specificPageVisitMetadataSchema, timeOnSiteConfigSchema, timeOnSiteMetadataSchema, useConsent, useConsentState, useCookiePreferences, useGclid, usePhoneConfig, usePhoneField, useTrackingParams };