zorihq 0.6.0 → 0.8.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.
Files changed (66) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/package.json +1 -1
  3. package/resources/v1/analytics/analytics.d.mts +179 -5
  4. package/resources/v1/analytics/analytics.d.mts.map +1 -1
  5. package/resources/v1/analytics/analytics.d.ts +179 -5
  6. package/resources/v1/analytics/analytics.d.ts.map +1 -1
  7. package/resources/v1/analytics/analytics.js +4 -0
  8. package/resources/v1/analytics/analytics.js.map +1 -1
  9. package/resources/v1/analytics/analytics.mjs +4 -0
  10. package/resources/v1/analytics/analytics.mjs.map +1 -1
  11. package/resources/v1/analytics/events.d.mts +49 -2
  12. package/resources/v1/analytics/events.d.mts.map +1 -1
  13. package/resources/v1/analytics/events.d.ts +49 -2
  14. package/resources/v1/analytics/events.d.ts.map +1 -1
  15. package/resources/v1/analytics/events.js +16 -1
  16. package/resources/v1/analytics/events.js.map +1 -1
  17. package/resources/v1/analytics/events.mjs +16 -1
  18. package/resources/v1/analytics/events.mjs.map +1 -1
  19. package/resources/v1/analytics/index.d.mts +4 -3
  20. package/resources/v1/analytics/index.d.mts.map +1 -1
  21. package/resources/v1/analytics/index.d.ts +4 -3
  22. package/resources/v1/analytics/index.d.ts.map +1 -1
  23. package/resources/v1/analytics/index.js +3 -1
  24. package/resources/v1/analytics/index.js.map +1 -1
  25. package/resources/v1/analytics/index.mjs +1 -0
  26. package/resources/v1/analytics/index.mjs.map +1 -1
  27. package/resources/v1/analytics/revenue.d.mts +60 -0
  28. package/resources/v1/analytics/revenue.d.mts.map +1 -0
  29. package/resources/v1/analytics/revenue.d.ts +60 -0
  30. package/resources/v1/analytics/revenue.d.ts.map +1 -0
  31. package/resources/v1/analytics/revenue.js +39 -0
  32. package/resources/v1/analytics/revenue.js.map +1 -0
  33. package/resources/v1/analytics/revenue.mjs +35 -0
  34. package/resources/v1/analytics/revenue.mjs.map +1 -0
  35. package/resources/v1/analytics/visitors.d.mts +27 -1
  36. package/resources/v1/analytics/visitors.d.mts.map +1 -1
  37. package/resources/v1/analytics/visitors.d.ts +27 -1
  38. package/resources/v1/analytics/visitors.d.ts.map +1 -1
  39. package/resources/v1/analytics/visitors.js +16 -0
  40. package/resources/v1/analytics/visitors.js.map +1 -1
  41. package/resources/v1/analytics/visitors.mjs +16 -0
  42. package/resources/v1/analytics/visitors.mjs.map +1 -1
  43. package/resources/v1/index.d.mts +1 -1
  44. package/resources/v1/index.d.mts.map +1 -1
  45. package/resources/v1/index.d.ts +1 -1
  46. package/resources/v1/index.d.ts.map +1 -1
  47. package/resources/v1/index.js.map +1 -1
  48. package/resources/v1/index.mjs.map +1 -1
  49. package/resources/v1/v1.d.mts +2 -2
  50. package/resources/v1/v1.d.mts.map +1 -1
  51. package/resources/v1/v1.d.ts +2 -2
  52. package/resources/v1/v1.d.ts.map +1 -1
  53. package/resources/v1/v1.js.map +1 -1
  54. package/resources/v1/v1.mjs.map +1 -1
  55. package/src/resources/v1/analytics/analytics.ts +273 -2
  56. package/src/resources/v1/analytics/events.ts +66 -2
  57. package/src/resources/v1/analytics/index.ts +11 -1
  58. package/src/resources/v1/analytics/revenue.ts +79 -0
  59. package/src/resources/v1/analytics/visitors.ts +39 -0
  60. package/src/resources/v1/index.ts +8 -0
  61. package/src/resources/v1/v1.ts +16 -0
  62. package/src/version.ts +1 -1
  63. package/version.d.mts +1 -1
  64. package/version.d.ts +1 -1
  65. package/version.js +1 -1
  66. package/version.mjs +1 -1
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { APIResource } from '../../../core/resource';
4
4
  import * as EventsAPI from './events';
5
- import { EventRecentParams, Events } from './events';
5
+ import { EventFilterOptionsParams, EventRecentParams, Events } from './events';
6
6
  import * as RetentionAPI from './retention';
7
7
  import {
8
8
  Retention,
@@ -10,6 +10,8 @@ import {
10
10
  RetentionCohortsParams,
11
11
  RetentionReturnRateParams,
12
12
  } from './retention';
13
+ import * as RevenueAPI from './revenue';
14
+ import { Revenue, RevenueByUtmParams, RevenueTimelineParams } from './revenue';
13
15
  import * as SessionsAPI from './sessions';
14
16
  import { SessionBounceRateParams, SessionMetricsParams, Sessions } from './sessions';
15
17
  import * as UsersAPI from './users';
@@ -19,6 +21,7 @@ import {
19
21
  VisitorByCountryParams,
20
22
  VisitorByDeviceParams,
21
23
  VisitorByOriginParams,
24
+ VisitorIdentifyParams,
22
25
  VisitorProfileParams,
23
26
  VisitorTimelineParams,
24
27
  VisitorTopParams,
@@ -30,6 +33,7 @@ import { RequestOptions } from '../../../internal/request-options';
30
33
  export class Analytics extends APIResource {
31
34
  visitors: VisitorsAPI.Visitors = new VisitorsAPI.Visitors(this._client);
32
35
  events: EventsAPI.Events = new EventsAPI.Events(this._client);
36
+ revenue: RevenueAPI.Revenue = new RevenueAPI.Revenue(this._client);
33
37
  sessions: SessionsAPI.Sessions = new SessionsAPI.Sessions(this._client);
34
38
  users: UsersAPI.Users = new UsersAPI.Users(this._client);
35
39
  retention: RetentionAPI.Retention = new RetentionAPI.Retention(this._client);
@@ -117,6 +121,21 @@ export interface CountryDataPoint {
117
121
  export interface DashboardMetricsResponse {
118
122
  avg_pages_per_session?: number;
119
123
 
124
+ /**
125
+ * Average revenue for identified visitors only (deprecated)
126
+ */
127
+ avg_revenue_per_identified_customer?: number;
128
+
129
+ /**
130
+ * 3. Average revenue per unique session
131
+ */
132
+ avg_revenue_per_session?: number;
133
+
134
+ /**
135
+ * Average revenue per paying visitor
136
+ */
137
+ avg_revenue_per_visitor?: number;
138
+
120
139
  avg_session_duration_seconds?: number;
121
140
 
122
141
  /**
@@ -124,6 +143,18 @@ export interface DashboardMetricsResponse {
124
143
  */
125
144
  bounce_rate?: number;
126
145
 
146
+ /**
147
+ * 4. % of unique visitors who made payment
148
+ */
149
+ conversion_rate?: number;
150
+
151
+ /**
152
+ * Same as ConversionRate (deprecated, use ConversionRate)
153
+ */
154
+ conversion_to_paying?: number;
155
+
156
+ currency?: string;
157
+
127
158
  /**
128
159
  * Active users
129
160
  */
@@ -131,6 +162,11 @@ export interface DashboardMetricsResponse {
131
162
 
132
163
  mau?: number;
133
164
 
165
+ /**
166
+ * Additional revenue metrics (kept for compatibility)
167
+ */
168
+ paying_visitors?: number;
169
+
134
170
  return_rate?: number;
135
171
 
136
172
  /**
@@ -143,24 +179,105 @@ export interface DashboardMetricsResponse {
143
179
  */
144
180
  total_events?: number;
145
181
 
182
+ /**
183
+ * Count of successful payments
184
+ */
185
+ total_payments?: number;
186
+
187
+ /**
188
+ * Revenue metrics - 4 key metrics as separate queries
189
+ */
190
+ total_revenue?: number;
191
+
192
+ /**
193
+ * 2. Total revenue for identified customers only
194
+ */
195
+ total_revenue_identified_customers?: number;
196
+
146
197
  total_sessions_in_period?: number;
147
198
 
199
+ /**
200
+ * Total unique sessions in period
201
+ */
202
+ unique_sessions?: number;
203
+
148
204
  unique_visitors?: number;
149
205
 
150
206
  wau?: number;
151
207
  }
152
208
 
209
+ export interface EventFilterOptionsResponse {
210
+ /**
211
+ * Unique page paths
212
+ */
213
+ pages?: Array<string>;
214
+
215
+ /**
216
+ * Unique referrer domains
217
+ */
218
+ traffic_origins?: Array<string>;
219
+ }
220
+
153
221
  export interface EventsOverTimeDataPoint {
154
222
  event_count?: number;
155
223
 
156
224
  timestamp?: string;
157
225
  }
158
226
 
227
+ export interface ManualIdentifyRequest {
228
+ project_id: string;
229
+
230
+ visitor_id: string;
231
+
232
+ additional_properties?: { [key: string]: unknown };
233
+
234
+ email?: string;
235
+
236
+ external_id?: string;
237
+
238
+ name?: string;
239
+
240
+ phone?: string;
241
+
242
+ user_id?: string;
243
+ }
244
+
245
+ export interface ManualIdentifyResponse {
246
+ message?: string;
247
+
248
+ success?: boolean;
249
+
250
+ visitor_id?: string;
251
+ }
252
+
159
253
  export interface OriginDataPoint {
254
+ /**
255
+ * Average revenue per paying visitor
256
+ */
257
+ avg_revenue_per_visitor?: number;
258
+
259
+ /**
260
+ * paying_visitors / unique_visitors \* 100
261
+ */
262
+ conversion_rate?: number;
263
+
264
+ currency?: string;
265
+
160
266
  origin?: string;
161
267
 
268
+ paying_visitors?: number;
269
+
270
+ payment_count?: number;
271
+
162
272
  percentage?: number;
163
273
 
274
+ revenue_percentage?: number;
275
+
276
+ /**
277
+ * Revenue in smallest currency unit (cents)
278
+ */
279
+ total_revenue?: number;
280
+
164
281
  unique_visitors?: number;
165
282
  }
166
283
 
@@ -173,22 +290,36 @@ export interface RecentEvent {
173
290
 
174
291
  event_name?: string;
175
292
 
293
+ external_id?: string;
294
+
176
295
  location_city?: string;
177
296
 
178
297
  location_country_iso?: string;
179
298
 
299
+ location_latitude?: number;
300
+
301
+ location_longitude?: number;
302
+
180
303
  page_path?: string;
181
304
 
182
305
  page_url?: string;
183
306
 
307
+ referrer_domain?: string;
308
+
184
309
  referrer_url?: string;
185
310
 
311
+ user_id?: string;
312
+
186
313
  visitor_id?: string;
187
314
  }
188
315
 
189
316
  export interface RecentEventsResponse {
190
317
  events?: Array<RecentEvent>;
191
318
 
319
+ limit?: number;
320
+
321
+ offset?: number;
322
+
192
323
  total?: number;
193
324
  }
194
325
 
@@ -202,6 +333,27 @@ export interface ReturnRateResponse {
202
333
  total_users?: number;
203
334
  }
204
335
 
336
+ export interface RevenueByUtmResponse {
337
+ data?: Array<UtmRevenueDataPoint>;
338
+ }
339
+
340
+ export interface RevenueTimelineDataPoint {
341
+ currency?: string;
342
+
343
+ payment_count?: number;
344
+
345
+ timestamp?: string;
346
+
347
+ /**
348
+ * Revenue in smallest currency unit (cents)
349
+ */
350
+ total_revenue?: number;
351
+ }
352
+
353
+ export interface RevenueTimelineResponse {
354
+ data?: Array<RevenueTimelineDataPoint>;
355
+ }
356
+
205
357
  export interface SessionMetricsResponse {
206
358
  average_pages_per_session?: number;
207
359
 
@@ -213,10 +365,14 @@ export interface SessionMetricsResponse {
213
365
  export interface TopVisitor {
214
366
  browser_name?: string;
215
367
 
368
+ currency?: string;
369
+
216
370
  device_type?: string;
217
371
 
218
372
  event_count?: number;
219
373
 
374
+ external_id?: string;
375
+
220
376
  first_seen?: string;
221
377
 
222
378
  last_seen?: string;
@@ -225,6 +381,15 @@ export interface TopVisitor {
225
381
 
226
382
  location_country_iso?: string;
227
383
 
384
+ payment_count?: number;
385
+
386
+ /**
387
+ * Total revenue in smallest currency unit (cents)
388
+ */
389
+ total_revenue?: number;
390
+
391
+ user_id?: string;
392
+
228
393
  visitor_id?: string;
229
394
  }
230
395
 
@@ -246,6 +411,38 @@ export interface UniqueVisitorsTimelineResponse {
246
411
  data?: Array<UniqueVisitorsDataPoint>;
247
412
  }
248
413
 
414
+ export interface UtmRevenueDataPoint {
415
+ /**
416
+ * Average revenue per paying visitor
417
+ */
418
+ avg_revenue_per_visitor?: number;
419
+
420
+ /**
421
+ * paying_visitors / unique_visitors \* 100
422
+ */
423
+ conversion_rate?: number;
424
+
425
+ currency?: string;
426
+
427
+ paying_visitors?: number;
428
+
429
+ payment_count?: number;
430
+
431
+ revenue_percentage?: number;
432
+
433
+ /**
434
+ * Revenue in smallest currency unit (cents)
435
+ */
436
+ total_revenue?: number;
437
+
438
+ unique_visitors?: number;
439
+
440
+ /**
441
+ * The UTM parameter value
442
+ */
443
+ utm_value?: string;
444
+ }
445
+
249
446
  export interface VisitorDataPoint {
250
447
  desktop?: number;
251
448
 
@@ -272,25 +469,79 @@ export interface VisitorEvent {
272
469
  referrer_url?: string;
273
470
  }
274
471
 
472
+ export interface VisitorPayment {
473
+ amount?: number;
474
+
475
+ currency?: string;
476
+
477
+ payment_id?: string;
478
+
479
+ payment_timestamp?: string;
480
+
481
+ product_name?: string;
482
+
483
+ provider_type?: string;
484
+
485
+ status?: string;
486
+ }
487
+
275
488
  export interface VisitorProfileResponse {
489
+ /**
490
+ * Average payment amount
491
+ */
492
+ avg_order_value?: number;
493
+
494
+ currency?: string;
495
+
496
+ custom_traits?: { [key: string]: unknown };
497
+
498
+ email?: string;
499
+
276
500
  events?: Array<VisitorEvent>;
277
501
 
278
502
  events_over_time?: Array<EventsOverTimeDataPoint>;
279
503
 
504
+ external_id?: string;
505
+
506
+ first_identified_at?: string;
507
+
508
+ first_payment_date?: string;
509
+
280
510
  first_referrer_url?: string;
281
511
 
282
512
  first_seen?: string;
283
513
 
284
514
  first_traffic_origin?: string;
285
515
 
516
+ is_identified?: boolean;
517
+
518
+ last_identified_at?: string;
519
+
520
+ last_payment_date?: string;
521
+
286
522
  last_seen?: string;
287
523
 
288
524
  location_city?: string;
289
525
 
290
526
  location_country_iso?: string;
291
527
 
528
+ name?: string;
529
+
530
+ payment_count?: number;
531
+
532
+ payments?: Array<VisitorPayment>;
533
+
534
+ phone?: string;
535
+
292
536
  total_events?: number;
293
537
 
538
+ /**
539
+ * Revenue fields
540
+ */
541
+ total_revenue?: number;
542
+
543
+ user_id?: string;
544
+
294
545
  visitor_id?: string;
295
546
  }
296
547
 
@@ -320,6 +571,7 @@ export interface AnalyticsDashboardParams {
320
571
 
321
572
  Analytics.Visitors = Visitors;
322
573
  Analytics.Events = Events;
574
+ Analytics.Revenue = Revenue;
323
575
  Analytics.Sessions = Sessions;
324
576
  Analytics.Users = Users;
325
577
  Analytics.Retention = Retention;
@@ -334,18 +586,26 @@ export declare namespace Analytics {
334
586
  type CohortData as CohortData,
335
587
  type CountryDataPoint as CountryDataPoint,
336
588
  type DashboardMetricsResponse as DashboardMetricsResponse,
589
+ type EventFilterOptionsResponse as EventFilterOptionsResponse,
337
590
  type EventsOverTimeDataPoint as EventsOverTimeDataPoint,
591
+ type ManualIdentifyRequest as ManualIdentifyRequest,
592
+ type ManualIdentifyResponse as ManualIdentifyResponse,
338
593
  type OriginDataPoint as OriginDataPoint,
339
594
  type RecentEvent as RecentEvent,
340
595
  type RecentEventsResponse as RecentEventsResponse,
341
596
  type ReturnRateResponse as ReturnRateResponse,
597
+ type RevenueByUtmResponse as RevenueByUtmResponse,
598
+ type RevenueTimelineDataPoint as RevenueTimelineDataPoint,
599
+ type RevenueTimelineResponse as RevenueTimelineResponse,
342
600
  type SessionMetricsResponse as SessionMetricsResponse,
343
601
  type TopVisitor as TopVisitor,
344
602
  type TopVisitorsResponse as TopVisitorsResponse,
345
603
  type UniqueVisitorsDataPoint as UniqueVisitorsDataPoint,
346
604
  type UniqueVisitorsTimelineResponse as UniqueVisitorsTimelineResponse,
605
+ type UtmRevenueDataPoint as UtmRevenueDataPoint,
347
606
  type VisitorDataPoint as VisitorDataPoint,
348
607
  type VisitorEvent as VisitorEvent,
608
+ type VisitorPayment as VisitorPayment,
349
609
  type VisitorProfileResponse as VisitorProfileResponse,
350
610
  type VisitorsByCountryResponse as VisitorsByCountryResponse,
351
611
  type VisitorsByDeviceResponse as VisitorsByDeviceResponse,
@@ -358,12 +618,23 @@ export declare namespace Analytics {
358
618
  type VisitorByCountryParams as VisitorByCountryParams,
359
619
  type VisitorByDeviceParams as VisitorByDeviceParams,
360
620
  type VisitorByOriginParams as VisitorByOriginParams,
621
+ type VisitorIdentifyParams as VisitorIdentifyParams,
361
622
  type VisitorProfileParams as VisitorProfileParams,
362
623
  type VisitorTimelineParams as VisitorTimelineParams,
363
624
  type VisitorTopParams as VisitorTopParams,
364
625
  };
365
626
 
366
- export { Events as Events, type EventRecentParams as EventRecentParams };
627
+ export {
628
+ Events as Events,
629
+ type EventFilterOptionsParams as EventFilterOptionsParams,
630
+ type EventRecentParams as EventRecentParams,
631
+ };
632
+
633
+ export {
634
+ Revenue as Revenue,
635
+ type RevenueByUtmParams as RevenueByUtmParams,
636
+ type RevenueTimelineParams as RevenueTimelineParams,
637
+ };
367
638
 
368
639
  export {
369
640
  Sessions as Sessions,
@@ -7,7 +7,26 @@ import { RequestOptions } from '../../../internal/request-options';
7
7
 
8
8
  export class Events extends APIResource {
9
9
  /**
10
- * Get a list of the most recent events (default: 15 events)
10
+ * Get unique traffic origins and page paths to populate filter dropdowns
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const eventFilterOptionsResponse =
15
+ * await client.v1.analytics.events.filterOptions({
16
+ * project_id: 'project_id',
17
+ * });
18
+ * ```
19
+ */
20
+ filterOptions(
21
+ query: EventFilterOptionsParams,
22
+ options?: RequestOptions,
23
+ ): APIPromise<AnalyticsAPI.EventFilterOptionsResponse> {
24
+ return this._client.get('/api/v1/analytics/events/filter-options', { query, ...options });
25
+ }
26
+
27
+ /**
28
+ * Get a list of recent events with optional filters (visitor_id, user_id,
29
+ * external_id, traffic_origin, page_path)
11
30
  *
12
31
  * @example
13
32
  * ```ts
@@ -22,18 +41,63 @@ export class Events extends APIResource {
22
41
  }
23
42
  }
24
43
 
44
+ export interface EventFilterOptionsParams {
45
+ /**
46
+ * Project ID
47
+ */
48
+ project_id: string;
49
+
50
+ /**
51
+ * Time range
52
+ */
53
+ time_range?: 'last_hour' | 'today' | 'last_7_days' | 'last_30_days' | 'last_90_days';
54
+ }
55
+
25
56
  export interface EventRecentParams {
26
57
  /**
27
58
  * Project ID
28
59
  */
29
60
  project_id: string;
30
61
 
62
+ /**
63
+ * Filter by external ID
64
+ */
65
+ external_id?: string;
66
+
31
67
  /**
32
68
  * Maximum number of events to return (default: 15)
33
69
  */
34
70
  limit?: number;
71
+
72
+ /**
73
+ * Offset for pagination (default: 0)
74
+ */
75
+ offset?: number;
76
+
77
+ /**
78
+ * Filter by page path
79
+ */
80
+ page_path?: string;
81
+
82
+ /**
83
+ * Filter by traffic origin (referrer domain)
84
+ */
85
+ traffic_origin?: string;
86
+
87
+ /**
88
+ * Filter by user ID
89
+ */
90
+ user_id?: string;
91
+
92
+ /**
93
+ * Filter by visitor ID
94
+ */
95
+ visitor_id?: string;
35
96
  }
36
97
 
37
98
  export declare namespace Events {
38
- export { type EventRecentParams as EventRecentParams };
99
+ export {
100
+ type EventFilterOptionsParams as EventFilterOptionsParams,
101
+ type EventRecentParams as EventRecentParams,
102
+ };
39
103
  }
@@ -10,31 +10,40 @@ export {
10
10
  type CohortData,
11
11
  type CountryDataPoint,
12
12
  type DashboardMetricsResponse,
13
+ type EventFilterOptionsResponse,
13
14
  type EventsOverTimeDataPoint,
15
+ type ManualIdentifyRequest,
16
+ type ManualIdentifyResponse,
14
17
  type OriginDataPoint,
15
18
  type RecentEvent,
16
19
  type RecentEventsResponse,
17
20
  type ReturnRateResponse,
21
+ type RevenueByUtmResponse,
22
+ type RevenueTimelineDataPoint,
23
+ type RevenueTimelineResponse,
18
24
  type SessionMetricsResponse,
19
25
  type TopVisitor,
20
26
  type TopVisitorsResponse,
21
27
  type UniqueVisitorsDataPoint,
22
28
  type UniqueVisitorsTimelineResponse,
29
+ type UtmRevenueDataPoint,
23
30
  type VisitorDataPoint,
24
31
  type VisitorEvent,
32
+ type VisitorPayment,
25
33
  type VisitorProfileResponse,
26
34
  type VisitorsByCountryResponse,
27
35
  type VisitorsByDeviceResponse,
28
36
  type VisitorsByOriginResponse,
29
37
  type AnalyticsDashboardParams,
30
38
  } from './analytics';
31
- export { Events, type EventRecentParams } from './events';
39
+ export { Events, type EventFilterOptionsParams, type EventRecentParams } from './events';
32
40
  export {
33
41
  Retention,
34
42
  type RetentionChurnRateParams,
35
43
  type RetentionCohortsParams,
36
44
  type RetentionReturnRateParams,
37
45
  } from './retention';
46
+ export { Revenue, type RevenueByUtmParams, type RevenueTimelineParams } from './revenue';
38
47
  export { Sessions, type SessionBounceRateParams, type SessionMetricsParams } from './sessions';
39
48
  export { Users, type UserActiveParams } from './users';
40
49
  export {
@@ -42,6 +51,7 @@ export {
42
51
  type VisitorByCountryParams,
43
52
  type VisitorByDeviceParams,
44
53
  type VisitorByOriginParams,
54
+ type VisitorIdentifyParams,
45
55
  type VisitorProfileParams,
46
56
  type VisitorTimelineParams,
47
57
  type VisitorTopParams,
@@ -0,0 +1,79 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../core/resource';
4
+ import * as AnalyticsAPI from './analytics';
5
+ import { APIPromise } from '../../../core/api-promise';
6
+ import { RequestOptions } from '../../../internal/request-options';
7
+
8
+ export class Revenue extends APIResource {
9
+ /**
10
+ * Get revenue metrics grouped by UTM source, medium, or campaign
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const revenueByUtmResponse =
15
+ * await client.v1.analytics.revenue.byUtm({
16
+ * project_id: 'project_id',
17
+ * time_range: 'last_hour',
18
+ * });
19
+ * ```
20
+ */
21
+ byUtm(query: RevenueByUtmParams, options?: RequestOptions): APIPromise<AnalyticsAPI.RevenueByUtmResponse> {
22
+ return this._client.get('/api/v1/analytics/revenue/by-utm', { query, ...options });
23
+ }
24
+
25
+ /**
26
+ * Get revenue metrics over time for chart visualization
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const revenueTimelineResponse =
31
+ * await client.v1.analytics.revenue.timeline({
32
+ * project_id: 'project_id',
33
+ * time_range: 'last_hour',
34
+ * });
35
+ * ```
36
+ */
37
+ timeline(
38
+ query: RevenueTimelineParams,
39
+ options?: RequestOptions,
40
+ ): APIPromise<AnalyticsAPI.RevenueTimelineResponse> {
41
+ return this._client.get('/api/v1/analytics/revenue/timeline', { query, ...options });
42
+ }
43
+ }
44
+
45
+ export interface RevenueByUtmParams {
46
+ /**
47
+ * Project ID
48
+ */
49
+ project_id: string;
50
+
51
+ /**
52
+ * Time range
53
+ */
54
+ time_range: 'last_hour' | 'today' | 'last_7_days' | 'last_30_days' | 'last_90_days';
55
+
56
+ /**
57
+ * UTM type: source, medium, or campaign (default: source)
58
+ */
59
+ utm_type?: string;
60
+ }
61
+
62
+ export interface RevenueTimelineParams {
63
+ /**
64
+ * Project ID
65
+ */
66
+ project_id: string;
67
+
68
+ /**
69
+ * Time range
70
+ */
71
+ time_range: 'last_hour' | 'today' | 'last_7_days' | 'last_30_days' | 'last_90_days';
72
+ }
73
+
74
+ export declare namespace Revenue {
75
+ export {
76
+ type RevenueByUtmParams as RevenueByUtmParams,
77
+ type RevenueTimelineParams as RevenueTimelineParams,
78
+ };
79
+ }