@aranova/tracking-next 0.4.2 → 0.5.1
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/dist/index.d.mts +544 -100
- package/dist/index.d.ts +544 -100
- package/dist/index.js +453 -55
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +453 -55
- package/dist/index.mjs.map +1 -1
- package/dist/middleware.js +147 -37
- package/dist/middleware.js.map +1 -1
- package/dist/middleware.mjs +147 -37
- package/dist/middleware.mjs.map +1 -1
- package/dist/server.js +147 -37
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +147 -37
- package/dist/server.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -34,19 +34,227 @@ declare function createTrackingEventCreatePayload(trackingParams: TrackingParams
|
|
|
34
34
|
declare const TRACKING_PARAM_KEYS: readonly ["gclid", "fbclid", "utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"];
|
|
35
35
|
declare function captureTrackingParamsFromLocation(url?: string, maxAgeSeconds?: number): TrackingParams;
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
37
|
+
declare const ctaClickMetadataSchema: z.ZodObject<{
|
|
38
|
+
cta_name: z.ZodString;
|
|
39
|
+
page: z.ZodObject<{
|
|
40
|
+
path: z.ZodString;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
path: string;
|
|
43
|
+
}, {
|
|
44
|
+
path: string;
|
|
45
|
+
}>;
|
|
46
|
+
section: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
47
|
+
destination_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
48
|
+
}, "strict", z.ZodTypeAny, {
|
|
49
|
+
page: {
|
|
50
|
+
path: string;
|
|
51
|
+
};
|
|
52
|
+
cta_name: string;
|
|
53
|
+
section?: string | null | undefined;
|
|
54
|
+
destination_url?: string | null | undefined;
|
|
55
|
+
}, {
|
|
56
|
+
page: {
|
|
57
|
+
path: string;
|
|
58
|
+
};
|
|
59
|
+
cta_name: string;
|
|
60
|
+
section?: string | null | undefined;
|
|
61
|
+
destination_url?: string | null | undefined;
|
|
62
|
+
}>;
|
|
63
|
+
type CtaClickMetadata = z.infer<typeof ctaClickMetadataSchema>;
|
|
64
|
+
declare const ctaClickConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
65
|
+
type CtaClickConfig = z.infer<typeof ctaClickConfigSchema>;
|
|
66
|
+
|
|
67
|
+
declare const sdkHeartbeatMetadataSchema: z.ZodObject<{
|
|
68
|
+
sdk_version: z.ZodString;
|
|
69
|
+
package_name: z.ZodNullable<z.ZodString>;
|
|
70
|
+
surface: z.ZodEnum<["next", "react", "script"]>;
|
|
71
|
+
triggers: z.ZodObject<{
|
|
72
|
+
automatic: z.ZodArray<z.ZodString, "many">;
|
|
73
|
+
manual: z.ZodArray<z.ZodString, "many">;
|
|
74
|
+
}, "strict", z.ZodTypeAny, {
|
|
75
|
+
automatic: string[];
|
|
76
|
+
manual: string[];
|
|
77
|
+
}, {
|
|
78
|
+
automatic: string[];
|
|
79
|
+
manual: string[];
|
|
80
|
+
}>;
|
|
81
|
+
trigger_config: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
82
|
+
}, "strict", z.ZodTypeAny, {
|
|
83
|
+
sdk_version: string;
|
|
84
|
+
package_name: string | null;
|
|
85
|
+
surface: "next" | "react" | "script";
|
|
86
|
+
triggers: {
|
|
87
|
+
automatic: string[];
|
|
88
|
+
manual: string[];
|
|
89
|
+
};
|
|
90
|
+
trigger_config?: Record<string, Record<string, unknown>> | null | undefined;
|
|
91
|
+
}, {
|
|
92
|
+
sdk_version: string;
|
|
93
|
+
package_name: string | null;
|
|
94
|
+
surface: "next" | "react" | "script";
|
|
95
|
+
triggers: {
|
|
96
|
+
automatic: string[];
|
|
97
|
+
manual: string[];
|
|
98
|
+
};
|
|
99
|
+
trigger_config?: Record<string, Record<string, unknown>> | null | undefined;
|
|
100
|
+
}>;
|
|
101
|
+
type SdkHeartbeatMetadata = z.infer<typeof sdkHeartbeatMetadataSchema>;
|
|
102
|
+
declare const sdkHeartbeatConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
103
|
+
type SdkHeartbeatConfig = z.infer<typeof sdkHeartbeatConfigSchema>;
|
|
104
|
+
|
|
105
|
+
declare const formStartMetadataSchema: z.ZodObject<{
|
|
106
|
+
form: z.ZodObject<{
|
|
107
|
+
id: z.ZodString;
|
|
108
|
+
action: z.ZodNullable<z.ZodString>;
|
|
109
|
+
}, "strip", z.ZodTypeAny, {
|
|
110
|
+
id: string;
|
|
111
|
+
action: string | null;
|
|
112
|
+
}, {
|
|
113
|
+
id: string;
|
|
114
|
+
action: string | null;
|
|
115
|
+
}>;
|
|
116
|
+
page: z.ZodObject<{
|
|
117
|
+
path: z.ZodString;
|
|
118
|
+
}, "strip", z.ZodTypeAny, {
|
|
119
|
+
path: string;
|
|
120
|
+
}, {
|
|
121
|
+
path: string;
|
|
122
|
+
}>;
|
|
123
|
+
}, "strict", z.ZodTypeAny, {
|
|
124
|
+
form: {
|
|
125
|
+
id: string;
|
|
126
|
+
action: string | null;
|
|
127
|
+
};
|
|
128
|
+
page: {
|
|
129
|
+
path: string;
|
|
130
|
+
};
|
|
131
|
+
}, {
|
|
132
|
+
form: {
|
|
133
|
+
id: string;
|
|
134
|
+
action: string | null;
|
|
135
|
+
};
|
|
136
|
+
page: {
|
|
137
|
+
path: string;
|
|
138
|
+
};
|
|
139
|
+
}>;
|
|
140
|
+
type FormStartMetadata = z.infer<typeof formStartMetadataSchema>;
|
|
141
|
+
declare const formStartConfigSchema: z.ZodObject<{
|
|
142
|
+
selector: z.ZodOptional<z.ZodString>;
|
|
143
|
+
}, "strict", z.ZodTypeAny, {
|
|
144
|
+
selector?: string | undefined;
|
|
145
|
+
}, {
|
|
146
|
+
selector?: string | undefined;
|
|
147
|
+
}>;
|
|
148
|
+
type FormStartConfig = z.infer<typeof formStartConfigSchema>;
|
|
149
|
+
|
|
150
|
+
declare const formSubmitMetadataSchema: z.ZodObject<{
|
|
151
|
+
form: z.ZodObject<{
|
|
152
|
+
id: z.ZodString;
|
|
153
|
+
action: z.ZodNullable<z.ZodString>;
|
|
154
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
155
|
+
name: z.ZodString;
|
|
156
|
+
type: z.ZodString;
|
|
157
|
+
label: z.ZodNullable<z.ZodString>;
|
|
158
|
+
has_value: z.ZodBoolean;
|
|
159
|
+
}, "strip", z.ZodTypeAny, {
|
|
160
|
+
label: string | null;
|
|
161
|
+
type: string;
|
|
162
|
+
name: string;
|
|
163
|
+
has_value: boolean;
|
|
164
|
+
}, {
|
|
165
|
+
label: string | null;
|
|
166
|
+
type: string;
|
|
167
|
+
name: string;
|
|
168
|
+
has_value: boolean;
|
|
169
|
+
}>, "many">>;
|
|
170
|
+
}, "strip", z.ZodTypeAny, {
|
|
171
|
+
id: string;
|
|
172
|
+
action: string | null;
|
|
173
|
+
fields?: {
|
|
174
|
+
label: string | null;
|
|
175
|
+
type: string;
|
|
176
|
+
name: string;
|
|
177
|
+
has_value: boolean;
|
|
178
|
+
}[] | undefined;
|
|
179
|
+
}, {
|
|
180
|
+
id: string;
|
|
181
|
+
action: string | null;
|
|
182
|
+
fields?: {
|
|
183
|
+
label: string | null;
|
|
184
|
+
type: string;
|
|
185
|
+
name: string;
|
|
186
|
+
has_value: boolean;
|
|
187
|
+
}[] | undefined;
|
|
188
|
+
}>;
|
|
189
|
+
page: z.ZodObject<{
|
|
190
|
+
path: z.ZodString;
|
|
191
|
+
}, "strip", z.ZodTypeAny, {
|
|
192
|
+
path: string;
|
|
193
|
+
}, {
|
|
194
|
+
path: string;
|
|
195
|
+
}>;
|
|
196
|
+
}, "strict", z.ZodTypeAny, {
|
|
197
|
+
form: {
|
|
198
|
+
id: string;
|
|
199
|
+
action: string | null;
|
|
200
|
+
fields?: {
|
|
201
|
+
label: string | null;
|
|
202
|
+
type: string;
|
|
203
|
+
name: string;
|
|
204
|
+
has_value: boolean;
|
|
205
|
+
}[] | undefined;
|
|
206
|
+
};
|
|
207
|
+
page: {
|
|
208
|
+
path: string;
|
|
209
|
+
};
|
|
210
|
+
}, {
|
|
211
|
+
form: {
|
|
212
|
+
id: string;
|
|
213
|
+
action: string | null;
|
|
214
|
+
fields?: {
|
|
215
|
+
label: string | null;
|
|
216
|
+
type: string;
|
|
217
|
+
name: string;
|
|
218
|
+
has_value: boolean;
|
|
219
|
+
}[] | undefined;
|
|
220
|
+
};
|
|
221
|
+
page: {
|
|
222
|
+
path: string;
|
|
223
|
+
};
|
|
224
|
+
}>;
|
|
225
|
+
type FormSubmitMetadata = z.infer<typeof formSubmitMetadataSchema>;
|
|
226
|
+
declare const formSubmitConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
227
|
+
type FormSubmitConfig = z.infer<typeof formSubmitConfigSchema>;
|
|
228
|
+
|
|
229
|
+
declare const multiPageSessionMetadataSchema: z.ZodObject<{
|
|
230
|
+
page_count: z.ZodNumber;
|
|
231
|
+
page: z.ZodObject<{
|
|
232
|
+
path: z.ZodString;
|
|
233
|
+
}, "strip", z.ZodTypeAny, {
|
|
234
|
+
path: string;
|
|
235
|
+
}, {
|
|
236
|
+
path: string;
|
|
237
|
+
}>;
|
|
238
|
+
}, "strict", z.ZodTypeAny, {
|
|
239
|
+
page: {
|
|
240
|
+
path: string;
|
|
241
|
+
};
|
|
242
|
+
page_count: number;
|
|
243
|
+
}, {
|
|
244
|
+
page: {
|
|
245
|
+
path: string;
|
|
246
|
+
};
|
|
247
|
+
page_count: number;
|
|
248
|
+
}>;
|
|
249
|
+
type MultiPageSessionMetadata = z.infer<typeof multiPageSessionMetadataSchema>;
|
|
250
|
+
declare const multiPageSessionConfigSchema: z.ZodObject<{
|
|
251
|
+
pageThreshold: z.ZodNumber;
|
|
252
|
+
}, "strict", z.ZodTypeAny, {
|
|
253
|
+
pageThreshold: number;
|
|
254
|
+
}, {
|
|
255
|
+
pageThreshold: number;
|
|
256
|
+
}>;
|
|
257
|
+
type MultiPageSessionConfig = z.infer<typeof multiPageSessionConfigSchema>;
|
|
50
258
|
|
|
51
259
|
declare const pageViewMetadataSchema: z.ZodObject<{
|
|
52
260
|
page: z.ZodObject<{
|
|
@@ -105,7 +313,8 @@ type PageViewMetadata = z.infer<typeof pageViewMetadataSchema>;
|
|
|
105
313
|
declare const pageViewConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
106
314
|
type PageViewConfig = z.infer<typeof pageViewConfigSchema>;
|
|
107
315
|
|
|
108
|
-
declare const
|
|
316
|
+
declare const phoneClickMetadataSchema: z.ZodObject<{
|
|
317
|
+
phone_number: z.ZodString;
|
|
109
318
|
page: z.ZodObject<{
|
|
110
319
|
path: z.ZodString;
|
|
111
320
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -113,36 +322,26 @@ declare const contactPageVisitMetadataSchema: z.ZodObject<{
|
|
|
113
322
|
}, {
|
|
114
323
|
path: string;
|
|
115
324
|
}>;
|
|
325
|
+
section: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
116
326
|
}, "strict", z.ZodTypeAny, {
|
|
117
327
|
page: {
|
|
118
328
|
path: string;
|
|
119
329
|
};
|
|
330
|
+
phone_number: string;
|
|
331
|
+
section?: string | null | undefined;
|
|
120
332
|
}, {
|
|
121
333
|
page: {
|
|
122
334
|
path: string;
|
|
123
335
|
};
|
|
336
|
+
phone_number: string;
|
|
337
|
+
section?: string | null | undefined;
|
|
124
338
|
}>;
|
|
125
|
-
type
|
|
126
|
-
declare const
|
|
127
|
-
|
|
128
|
-
}, "strict", z.ZodTypeAny, {
|
|
129
|
-
pathPattern: RegExp;
|
|
130
|
-
}, {
|
|
131
|
-
pathPattern: RegExp;
|
|
132
|
-
}>;
|
|
133
|
-
type ContactPageVisitConfig = z.infer<typeof contactPageVisitConfigSchema>;
|
|
339
|
+
type PhoneClickMetadata = z.infer<typeof phoneClickMetadataSchema>;
|
|
340
|
+
declare const phoneClickConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
341
|
+
type PhoneClickConfig = z.infer<typeof phoneClickConfigSchema>;
|
|
134
342
|
|
|
135
|
-
declare const
|
|
136
|
-
|
|
137
|
-
id: z.ZodString;
|
|
138
|
-
action: z.ZodNullable<z.ZodString>;
|
|
139
|
-
}, "strip", z.ZodTypeAny, {
|
|
140
|
-
id: string;
|
|
141
|
-
action: string | null;
|
|
142
|
-
}, {
|
|
143
|
-
id: string;
|
|
144
|
-
action: string | null;
|
|
145
|
-
}>;
|
|
343
|
+
declare const scrollDepthMetadataSchema: z.ZodObject<{
|
|
344
|
+
depth_percent: z.ZodNumber;
|
|
146
345
|
page: z.ZodObject<{
|
|
147
346
|
path: z.ZodString;
|
|
148
347
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -151,40 +350,30 @@ declare const formSubmitMetadataSchema: z.ZodObject<{
|
|
|
151
350
|
path: string;
|
|
152
351
|
}>;
|
|
153
352
|
}, "strict", z.ZodTypeAny, {
|
|
154
|
-
form: {
|
|
155
|
-
id: string;
|
|
156
|
-
action: string | null;
|
|
157
|
-
};
|
|
158
353
|
page: {
|
|
159
354
|
path: string;
|
|
160
355
|
};
|
|
356
|
+
depth_percent: number;
|
|
161
357
|
}, {
|
|
162
|
-
form: {
|
|
163
|
-
id: string;
|
|
164
|
-
action: string | null;
|
|
165
|
-
};
|
|
166
358
|
page: {
|
|
167
359
|
path: string;
|
|
168
360
|
};
|
|
361
|
+
depth_percent: number;
|
|
169
362
|
}>;
|
|
170
|
-
type
|
|
171
|
-
declare const
|
|
172
|
-
|
|
363
|
+
type ScrollDepthMetadata = z.infer<typeof scrollDepthMetadataSchema>;
|
|
364
|
+
declare const scrollDepthConfigSchema: z.ZodObject<{
|
|
365
|
+
thresholds: z.ZodArray<z.ZodNumber, "many">;
|
|
366
|
+
}, "strict", z.ZodTypeAny, {
|
|
367
|
+
thresholds: number[];
|
|
368
|
+
}, {
|
|
369
|
+
thresholds: number[];
|
|
370
|
+
}>;
|
|
371
|
+
type ScrollDepthConfig = z.infer<typeof scrollDepthConfigSchema>;
|
|
173
372
|
|
|
174
|
-
declare const
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
href: z.ZodString;
|
|
179
|
-
}, "strip", z.ZodTypeAny, {
|
|
180
|
-
text: string | null;
|
|
181
|
-
tag: string;
|
|
182
|
-
href: string;
|
|
183
|
-
}, {
|
|
184
|
-
text: string | null;
|
|
185
|
-
tag: string;
|
|
186
|
-
href: string;
|
|
187
|
-
}>;
|
|
373
|
+
declare const SPECIFIC_PAGE_NAMES: readonly ["contact_page", "about_page", "services_page", "booking_page", "location_page", "pricing_page", "faq_page", "testimonials_page"];
|
|
374
|
+
type SpecificPageName = (typeof SPECIFIC_PAGE_NAMES)[number];
|
|
375
|
+
declare const specificPageVisitMetadataSchema: z.ZodObject<{
|
|
376
|
+
page_name: z.ZodEnum<["contact_page", "about_page", "services_page", "booking_page", "location_page", "pricing_page", "faq_page", "testimonials_page"]>;
|
|
188
377
|
page: z.ZodObject<{
|
|
189
378
|
path: z.ZodString;
|
|
190
379
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -196,24 +385,37 @@ declare const phoneClickMetadataSchema: z.ZodObject<{
|
|
|
196
385
|
page: {
|
|
197
386
|
path: string;
|
|
198
387
|
};
|
|
199
|
-
|
|
200
|
-
text: string | null;
|
|
201
|
-
tag: string;
|
|
202
|
-
href: string;
|
|
203
|
-
};
|
|
388
|
+
page_name: "contact_page" | "about_page" | "services_page" | "booking_page" | "location_page" | "pricing_page" | "faq_page" | "testimonials_page";
|
|
204
389
|
}, {
|
|
205
390
|
page: {
|
|
206
391
|
path: string;
|
|
207
392
|
};
|
|
208
|
-
|
|
209
|
-
text: string | null;
|
|
210
|
-
tag: string;
|
|
211
|
-
href: string;
|
|
212
|
-
};
|
|
393
|
+
page_name: "contact_page" | "about_page" | "services_page" | "booking_page" | "location_page" | "pricing_page" | "faq_page" | "testimonials_page";
|
|
213
394
|
}>;
|
|
214
|
-
type
|
|
215
|
-
declare const
|
|
216
|
-
|
|
395
|
+
type SpecificPageVisitMetadata = z.infer<typeof specificPageVisitMetadataSchema>;
|
|
396
|
+
declare const specificPageVisitConfigSchema: z.ZodObject<{
|
|
397
|
+
pages: z.ZodArray<z.ZodObject<{
|
|
398
|
+
name: z.ZodEnum<["contact_page", "about_page", "services_page", "booking_page", "location_page", "pricing_page", "faq_page", "testimonials_page"]>;
|
|
399
|
+
pathPattern: z.ZodType<RegExp, z.ZodTypeDef, RegExp>;
|
|
400
|
+
}, "strip", z.ZodTypeAny, {
|
|
401
|
+
name: "contact_page" | "about_page" | "services_page" | "booking_page" | "location_page" | "pricing_page" | "faq_page" | "testimonials_page";
|
|
402
|
+
pathPattern: RegExp;
|
|
403
|
+
}, {
|
|
404
|
+
name: "contact_page" | "about_page" | "services_page" | "booking_page" | "location_page" | "pricing_page" | "faq_page" | "testimonials_page";
|
|
405
|
+
pathPattern: RegExp;
|
|
406
|
+
}>, "many">;
|
|
407
|
+
}, "strict", z.ZodTypeAny, {
|
|
408
|
+
pages: {
|
|
409
|
+
name: "contact_page" | "about_page" | "services_page" | "booking_page" | "location_page" | "pricing_page" | "faq_page" | "testimonials_page";
|
|
410
|
+
pathPattern: RegExp;
|
|
411
|
+
}[];
|
|
412
|
+
}, {
|
|
413
|
+
pages: {
|
|
414
|
+
name: "contact_page" | "about_page" | "services_page" | "booking_page" | "location_page" | "pricing_page" | "faq_page" | "testimonials_page";
|
|
415
|
+
pathPattern: RegExp;
|
|
416
|
+
}[];
|
|
417
|
+
}>;
|
|
418
|
+
type SpecificPageVisitConfig = z.infer<typeof specificPageVisitConfigSchema>;
|
|
217
419
|
|
|
218
420
|
declare const timeOnSiteMetadataSchema: z.ZodObject<{
|
|
219
421
|
duration_ms: z.ZodNumber;
|
|
@@ -333,9 +535,10 @@ declare const EVENT_REGISTRY: {
|
|
|
333
535
|
thresholdSeconds: number;
|
|
334
536
|
}>;
|
|
335
537
|
};
|
|
336
|
-
readonly
|
|
538
|
+
readonly specific_page_visit: {
|
|
337
539
|
readonly kind: "automatic";
|
|
338
540
|
readonly metadataSchema: z.ZodObject<{
|
|
541
|
+
page_name: z.ZodEnum<["contact_page", "about_page", "services_page", "booking_page", "location_page", "pricing_page", "faq_page", "testimonials_page"]>;
|
|
339
542
|
page: z.ZodObject<{
|
|
340
543
|
path: z.ZodString;
|
|
341
544
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -347,31 +550,219 @@ declare const EVENT_REGISTRY: {
|
|
|
347
550
|
page: {
|
|
348
551
|
path: string;
|
|
349
552
|
};
|
|
553
|
+
page_name: "contact_page" | "about_page" | "services_page" | "booking_page" | "location_page" | "pricing_page" | "faq_page" | "testimonials_page";
|
|
350
554
|
}, {
|
|
351
555
|
page: {
|
|
352
556
|
path: string;
|
|
353
557
|
};
|
|
558
|
+
page_name: "contact_page" | "about_page" | "services_page" | "booking_page" | "location_page" | "pricing_page" | "faq_page" | "testimonials_page";
|
|
354
559
|
}>;
|
|
355
560
|
readonly configSchema: z.ZodObject<{
|
|
356
|
-
|
|
561
|
+
pages: z.ZodArray<z.ZodObject<{
|
|
562
|
+
name: z.ZodEnum<["contact_page", "about_page", "services_page", "booking_page", "location_page", "pricing_page", "faq_page", "testimonials_page"]>;
|
|
563
|
+
pathPattern: z.ZodType<RegExp, z.ZodTypeDef, RegExp>;
|
|
564
|
+
}, "strip", z.ZodTypeAny, {
|
|
565
|
+
name: "contact_page" | "about_page" | "services_page" | "booking_page" | "location_page" | "pricing_page" | "faq_page" | "testimonials_page";
|
|
566
|
+
pathPattern: RegExp;
|
|
567
|
+
}, {
|
|
568
|
+
name: "contact_page" | "about_page" | "services_page" | "booking_page" | "location_page" | "pricing_page" | "faq_page" | "testimonials_page";
|
|
569
|
+
pathPattern: RegExp;
|
|
570
|
+
}>, "many">;
|
|
357
571
|
}, "strict", z.ZodTypeAny, {
|
|
358
|
-
|
|
572
|
+
pages: {
|
|
573
|
+
name: "contact_page" | "about_page" | "services_page" | "booking_page" | "location_page" | "pricing_page" | "faq_page" | "testimonials_page";
|
|
574
|
+
pathPattern: RegExp;
|
|
575
|
+
}[];
|
|
359
576
|
}, {
|
|
360
|
-
|
|
577
|
+
pages: {
|
|
578
|
+
name: "contact_page" | "about_page" | "services_page" | "booking_page" | "location_page" | "pricing_page" | "faq_page" | "testimonials_page";
|
|
579
|
+
pathPattern: RegExp;
|
|
580
|
+
}[];
|
|
361
581
|
}>;
|
|
362
582
|
};
|
|
583
|
+
readonly scroll_depth: {
|
|
584
|
+
readonly kind: "automatic";
|
|
585
|
+
readonly metadataSchema: z.ZodObject<{
|
|
586
|
+
depth_percent: z.ZodNumber;
|
|
587
|
+
page: z.ZodObject<{
|
|
588
|
+
path: z.ZodString;
|
|
589
|
+
}, "strip", z.ZodTypeAny, {
|
|
590
|
+
path: string;
|
|
591
|
+
}, {
|
|
592
|
+
path: string;
|
|
593
|
+
}>;
|
|
594
|
+
}, "strict", z.ZodTypeAny, {
|
|
595
|
+
page: {
|
|
596
|
+
path: string;
|
|
597
|
+
};
|
|
598
|
+
depth_percent: number;
|
|
599
|
+
}, {
|
|
600
|
+
page: {
|
|
601
|
+
path: string;
|
|
602
|
+
};
|
|
603
|
+
depth_percent: number;
|
|
604
|
+
}>;
|
|
605
|
+
readonly configSchema: z.ZodObject<{
|
|
606
|
+
thresholds: z.ZodArray<z.ZodNumber, "many">;
|
|
607
|
+
}, "strict", z.ZodTypeAny, {
|
|
608
|
+
thresholds: number[];
|
|
609
|
+
}, {
|
|
610
|
+
thresholds: number[];
|
|
611
|
+
}>;
|
|
612
|
+
};
|
|
613
|
+
readonly multi_page_session: {
|
|
614
|
+
readonly kind: "automatic";
|
|
615
|
+
readonly metadataSchema: z.ZodObject<{
|
|
616
|
+
page_count: z.ZodNumber;
|
|
617
|
+
page: z.ZodObject<{
|
|
618
|
+
path: z.ZodString;
|
|
619
|
+
}, "strip", z.ZodTypeAny, {
|
|
620
|
+
path: string;
|
|
621
|
+
}, {
|
|
622
|
+
path: string;
|
|
623
|
+
}>;
|
|
624
|
+
}, "strict", z.ZodTypeAny, {
|
|
625
|
+
page: {
|
|
626
|
+
path: string;
|
|
627
|
+
};
|
|
628
|
+
page_count: number;
|
|
629
|
+
}, {
|
|
630
|
+
page: {
|
|
631
|
+
path: string;
|
|
632
|
+
};
|
|
633
|
+
page_count: number;
|
|
634
|
+
}>;
|
|
635
|
+
readonly configSchema: z.ZodObject<{
|
|
636
|
+
pageThreshold: z.ZodNumber;
|
|
637
|
+
}, "strict", z.ZodTypeAny, {
|
|
638
|
+
pageThreshold: number;
|
|
639
|
+
}, {
|
|
640
|
+
pageThreshold: number;
|
|
641
|
+
}>;
|
|
642
|
+
};
|
|
643
|
+
readonly form_start: {
|
|
644
|
+
readonly kind: "automatic";
|
|
645
|
+
readonly metadataSchema: z.ZodObject<{
|
|
646
|
+
form: z.ZodObject<{
|
|
647
|
+
id: z.ZodString;
|
|
648
|
+
action: z.ZodNullable<z.ZodString>;
|
|
649
|
+
}, "strip", z.ZodTypeAny, {
|
|
650
|
+
id: string;
|
|
651
|
+
action: string | null;
|
|
652
|
+
}, {
|
|
653
|
+
id: string;
|
|
654
|
+
action: string | null;
|
|
655
|
+
}>;
|
|
656
|
+
page: z.ZodObject<{
|
|
657
|
+
path: z.ZodString;
|
|
658
|
+
}, "strip", z.ZodTypeAny, {
|
|
659
|
+
path: string;
|
|
660
|
+
}, {
|
|
661
|
+
path: string;
|
|
662
|
+
}>;
|
|
663
|
+
}, "strict", z.ZodTypeAny, {
|
|
664
|
+
form: {
|
|
665
|
+
id: string;
|
|
666
|
+
action: string | null;
|
|
667
|
+
};
|
|
668
|
+
page: {
|
|
669
|
+
path: string;
|
|
670
|
+
};
|
|
671
|
+
}, {
|
|
672
|
+
form: {
|
|
673
|
+
id: string;
|
|
674
|
+
action: string | null;
|
|
675
|
+
};
|
|
676
|
+
page: {
|
|
677
|
+
path: string;
|
|
678
|
+
};
|
|
679
|
+
}>;
|
|
680
|
+
readonly configSchema: z.ZodObject<{
|
|
681
|
+
selector: z.ZodOptional<z.ZodString>;
|
|
682
|
+
}, "strict", z.ZodTypeAny, {
|
|
683
|
+
selector?: string | undefined;
|
|
684
|
+
}, {
|
|
685
|
+
selector?: string | undefined;
|
|
686
|
+
}>;
|
|
687
|
+
};
|
|
688
|
+
readonly sdk_heartbeat: {
|
|
689
|
+
readonly kind: "automatic";
|
|
690
|
+
readonly metadataSchema: z.ZodObject<{
|
|
691
|
+
sdk_version: z.ZodString;
|
|
692
|
+
package_name: z.ZodNullable<z.ZodString>;
|
|
693
|
+
surface: z.ZodEnum<["next", "react", "script"]>;
|
|
694
|
+
triggers: z.ZodObject<{
|
|
695
|
+
automatic: z.ZodArray<z.ZodString, "many">;
|
|
696
|
+
manual: z.ZodArray<z.ZodString, "many">;
|
|
697
|
+
}, "strict", z.ZodTypeAny, {
|
|
698
|
+
automatic: string[];
|
|
699
|
+
manual: string[];
|
|
700
|
+
}, {
|
|
701
|
+
automatic: string[];
|
|
702
|
+
manual: string[];
|
|
703
|
+
}>;
|
|
704
|
+
trigger_config: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
705
|
+
}, "strict", z.ZodTypeAny, {
|
|
706
|
+
sdk_version: string;
|
|
707
|
+
package_name: string | null;
|
|
708
|
+
surface: "next" | "react" | "script";
|
|
709
|
+
triggers: {
|
|
710
|
+
automatic: string[];
|
|
711
|
+
manual: string[];
|
|
712
|
+
};
|
|
713
|
+
trigger_config?: Record<string, Record<string, unknown>> | null | undefined;
|
|
714
|
+
}, {
|
|
715
|
+
sdk_version: string;
|
|
716
|
+
package_name: string | null;
|
|
717
|
+
surface: "next" | "react" | "script";
|
|
718
|
+
triggers: {
|
|
719
|
+
automatic: string[];
|
|
720
|
+
manual: string[];
|
|
721
|
+
};
|
|
722
|
+
trigger_config?: Record<string, Record<string, unknown>> | null | undefined;
|
|
723
|
+
}>;
|
|
724
|
+
readonly configSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
725
|
+
};
|
|
363
726
|
readonly form_submit: {
|
|
364
727
|
readonly kind: "manual";
|
|
365
728
|
readonly metadataSchema: z.ZodObject<{
|
|
366
729
|
form: z.ZodObject<{
|
|
367
730
|
id: z.ZodString;
|
|
368
731
|
action: z.ZodNullable<z.ZodString>;
|
|
732
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
733
|
+
name: z.ZodString;
|
|
734
|
+
type: z.ZodString;
|
|
735
|
+
label: z.ZodNullable<z.ZodString>;
|
|
736
|
+
has_value: z.ZodBoolean;
|
|
737
|
+
}, "strip", z.ZodTypeAny, {
|
|
738
|
+
label: string | null;
|
|
739
|
+
type: string;
|
|
740
|
+
name: string;
|
|
741
|
+
has_value: boolean;
|
|
742
|
+
}, {
|
|
743
|
+
label: string | null;
|
|
744
|
+
type: string;
|
|
745
|
+
name: string;
|
|
746
|
+
has_value: boolean;
|
|
747
|
+
}>, "many">>;
|
|
369
748
|
}, "strip", z.ZodTypeAny, {
|
|
370
749
|
id: string;
|
|
371
750
|
action: string | null;
|
|
751
|
+
fields?: {
|
|
752
|
+
label: string | null;
|
|
753
|
+
type: string;
|
|
754
|
+
name: string;
|
|
755
|
+
has_value: boolean;
|
|
756
|
+
}[] | undefined;
|
|
372
757
|
}, {
|
|
373
758
|
id: string;
|
|
374
759
|
action: string | null;
|
|
760
|
+
fields?: {
|
|
761
|
+
label: string | null;
|
|
762
|
+
type: string;
|
|
763
|
+
name: string;
|
|
764
|
+
has_value: boolean;
|
|
765
|
+
}[] | undefined;
|
|
375
766
|
}>;
|
|
376
767
|
page: z.ZodObject<{
|
|
377
768
|
path: z.ZodString;
|
|
@@ -384,6 +775,12 @@ declare const EVENT_REGISTRY: {
|
|
|
384
775
|
form: {
|
|
385
776
|
id: string;
|
|
386
777
|
action: string | null;
|
|
778
|
+
fields?: {
|
|
779
|
+
label: string | null;
|
|
780
|
+
type: string;
|
|
781
|
+
name: string;
|
|
782
|
+
has_value: boolean;
|
|
783
|
+
}[] | undefined;
|
|
387
784
|
};
|
|
388
785
|
page: {
|
|
389
786
|
path: string;
|
|
@@ -392,6 +789,12 @@ declare const EVENT_REGISTRY: {
|
|
|
392
789
|
form: {
|
|
393
790
|
id: string;
|
|
394
791
|
action: string | null;
|
|
792
|
+
fields?: {
|
|
793
|
+
label: string | null;
|
|
794
|
+
type: string;
|
|
795
|
+
name: string;
|
|
796
|
+
has_value: boolean;
|
|
797
|
+
}[] | undefined;
|
|
395
798
|
};
|
|
396
799
|
page: {
|
|
397
800
|
path: string;
|
|
@@ -402,19 +805,34 @@ declare const EVENT_REGISTRY: {
|
|
|
402
805
|
readonly phone_click: {
|
|
403
806
|
readonly kind: "manual";
|
|
404
807
|
readonly metadataSchema: z.ZodObject<{
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
href: z.ZodString;
|
|
808
|
+
phone_number: z.ZodString;
|
|
809
|
+
page: z.ZodObject<{
|
|
810
|
+
path: z.ZodString;
|
|
409
811
|
}, "strip", z.ZodTypeAny, {
|
|
410
|
-
|
|
411
|
-
tag: string;
|
|
412
|
-
href: string;
|
|
812
|
+
path: string;
|
|
413
813
|
}, {
|
|
414
|
-
|
|
415
|
-
tag: string;
|
|
416
|
-
href: string;
|
|
814
|
+
path: string;
|
|
417
815
|
}>;
|
|
816
|
+
section: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
817
|
+
}, "strict", z.ZodTypeAny, {
|
|
818
|
+
page: {
|
|
819
|
+
path: string;
|
|
820
|
+
};
|
|
821
|
+
phone_number: string;
|
|
822
|
+
section?: string | null | undefined;
|
|
823
|
+
}, {
|
|
824
|
+
page: {
|
|
825
|
+
path: string;
|
|
826
|
+
};
|
|
827
|
+
phone_number: string;
|
|
828
|
+
section?: string | null | undefined;
|
|
829
|
+
}>;
|
|
830
|
+
readonly configSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
831
|
+
};
|
|
832
|
+
readonly cta_click: {
|
|
833
|
+
readonly kind: "manual";
|
|
834
|
+
readonly metadataSchema: z.ZodObject<{
|
|
835
|
+
cta_name: z.ZodString;
|
|
418
836
|
page: z.ZodObject<{
|
|
419
837
|
path: z.ZodString;
|
|
420
838
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -422,24 +840,22 @@ declare const EVENT_REGISTRY: {
|
|
|
422
840
|
}, {
|
|
423
841
|
path: string;
|
|
424
842
|
}>;
|
|
843
|
+
section: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
844
|
+
destination_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
425
845
|
}, "strict", z.ZodTypeAny, {
|
|
426
846
|
page: {
|
|
427
847
|
path: string;
|
|
428
848
|
};
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
href: string;
|
|
433
|
-
};
|
|
849
|
+
cta_name: string;
|
|
850
|
+
section?: string | null | undefined;
|
|
851
|
+
destination_url?: string | null | undefined;
|
|
434
852
|
}, {
|
|
435
853
|
page: {
|
|
436
854
|
path: string;
|
|
437
855
|
};
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
href: string;
|
|
442
|
-
};
|
|
856
|
+
cta_name: string;
|
|
857
|
+
section?: string | null | undefined;
|
|
858
|
+
destination_url?: string | null | undefined;
|
|
443
859
|
}>;
|
|
444
860
|
readonly configSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
445
861
|
};
|
|
@@ -454,16 +870,26 @@ type ManualEventName = {
|
|
|
454
870
|
type MetadataByName = {
|
|
455
871
|
page_view: PageViewMetadata;
|
|
456
872
|
time_on_site: TimeOnSiteMetadata;
|
|
457
|
-
|
|
873
|
+
specific_page_visit: SpecificPageVisitMetadata;
|
|
874
|
+
scroll_depth: ScrollDepthMetadata;
|
|
875
|
+
multi_page_session: MultiPageSessionMetadata;
|
|
876
|
+
form_start: FormStartMetadata;
|
|
877
|
+
sdk_heartbeat: SdkHeartbeatMetadata;
|
|
458
878
|
form_submit: FormSubmitMetadata;
|
|
459
879
|
phone_click: PhoneClickMetadata;
|
|
880
|
+
cta_click: CtaClickMetadata;
|
|
460
881
|
};
|
|
461
882
|
type ConfigByName = {
|
|
462
883
|
page_view: PageViewConfig;
|
|
463
884
|
time_on_site: TimeOnSiteConfig;
|
|
464
|
-
|
|
885
|
+
specific_page_visit: SpecificPageVisitConfig;
|
|
886
|
+
scroll_depth: ScrollDepthConfig;
|
|
887
|
+
multi_page_session: MultiPageSessionConfig;
|
|
888
|
+
form_start: FormStartConfig;
|
|
889
|
+
sdk_heartbeat: SdkHeartbeatConfig;
|
|
465
890
|
form_submit: FormSubmitConfig;
|
|
466
891
|
phone_click: PhoneClickConfig;
|
|
892
|
+
cta_click: CtaClickConfig;
|
|
467
893
|
};
|
|
468
894
|
type EventMetadata<K extends EventName> = MetadataByName[K];
|
|
469
895
|
type EventConfig<K extends EventName> = ConfigByName[K];
|
|
@@ -472,16 +898,34 @@ type TriggerRegistryConfig = {
|
|
|
472
898
|
page_view: EventConfig<'page_view'>;
|
|
473
899
|
} & Partial<{
|
|
474
900
|
time_on_site: EventConfig<'time_on_site'>;
|
|
475
|
-
|
|
901
|
+
specific_page_visit: EventConfig<'specific_page_visit'>;
|
|
902
|
+
scroll_depth: EventConfig<'scroll_depth'>;
|
|
903
|
+
multi_page_session: EventConfig<'multi_page_session'>;
|
|
904
|
+
form_start: EventConfig<'form_start'>;
|
|
476
905
|
}>;
|
|
477
906
|
manual?: Partial<{
|
|
478
907
|
form_submit: EventConfig<'form_submit'>;
|
|
479
908
|
phone_click: EventConfig<'phone_click'>;
|
|
909
|
+
cta_click: EventConfig<'cta_click'>;
|
|
480
910
|
}>;
|
|
481
911
|
};
|
|
482
912
|
type RegisteredManualEvents<TRegistry extends TriggerRegistryConfig> = Extract<keyof NonNullable<TRegistry['manual']>, ManualEventName>;
|
|
483
913
|
type RegisteredAutomaticEvents<TRegistry extends TriggerRegistryConfig> = Extract<keyof TRegistry['automatic'], AutomaticEventName>;
|
|
484
914
|
|
|
915
|
+
interface TrackEventInput {
|
|
916
|
+
eventType: string;
|
|
917
|
+
pageUrl?: string | null;
|
|
918
|
+
metadata?: Record<string, unknown> | null;
|
|
919
|
+
occurredAt?: Date | string | null;
|
|
920
|
+
}
|
|
921
|
+
interface TrackingClient {
|
|
922
|
+
trackEvent: (input: TrackEventInput) => void;
|
|
923
|
+
flush: () => Promise<void>;
|
|
924
|
+
getSessionId: () => string;
|
|
925
|
+
getVisitorId: () => string;
|
|
926
|
+
destroy: () => void;
|
|
927
|
+
}
|
|
928
|
+
|
|
485
929
|
interface TypedTrackEventOptions {
|
|
486
930
|
/** Override the page URL captured automatically. Rarely needed. */
|
|
487
931
|
pageUrl?: string | null;
|
|
@@ -538,4 +982,4 @@ interface CreateTrackingResult<TRegistry extends TriggerRegistryConfig> {
|
|
|
538
982
|
*/
|
|
539
983
|
declare function createTracking<TRegistry extends TriggerRegistryConfig>(options: CreateTrackingOptions<TRegistry>): CreateTrackingResult<TRegistry>;
|
|
540
984
|
|
|
541
|
-
export { type AutomaticEventName, ConsentBanner, ConsentState, type
|
|
985
|
+
export { type AutomaticEventName, ConsentBanner, ConsentState, type CreateTrackingOptions, type CreateTrackingResult, type CtaClickConfig, type CtaClickMetadata, type EventConfig, type EventMetadata, type EventName, type FormStartConfig, type FormStartMetadata, type FormSubmitConfig, type FormSubmitMetadata, GoogleAdsTracking, type GoogleAdsTrackingProps, type ManualEventName, type MultiPageSessionConfig, type MultiPageSessionMetadata, type PageViewConfig, type PageViewMetadata, type PhoneClickConfig, type PhoneClickMetadata, type RegisteredAutomaticEvents, type RegisteredManualEvents, type ScrollDepthConfig, type ScrollDepthMetadata, type SpecificPageName, type SpecificPageVisitConfig, type SpecificPageVisitMetadata, TRACKING_PARAM_KEYS, type TimeOnSiteConfig, type TimeOnSiteMetadata, type TrackingClient, TrackingClientContext, TrackingEventCreatePayload, TrackingInstallSurface, TrackingParams, type TrackingProviderProps, TrackingSessionUpsertPayload, type TriggerRegistryConfig, type TypedTrackEventOptions, type TypedTrackingClient, captureTrackingParamsFromLocation, createTracking, createTrackingClientContext, createTrackingEventCreatePayload, createTrackingSessionUpsertPayload, getConsentState, setConsentState, useConsentState, useGclid, useTrackingParams };
|