Skip to content

Commit df7acf1

Browse files
authored
Merge pull request #8 from ZoriHQ/release-please--branches--main--changes--next--components--zorihq
release: 0.5.0
2 parents 95d6c8c + db2812d commit df7acf1

18 files changed

Lines changed: 707 additions & 9 deletions

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.4.1"
2+
".": "0.5.0"
33
}

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 18
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/zorihq%2Fzoriapi-acf4918b01172ffe3ae4c34dc69084ee67c81d3081611f6407d8bf55eead07e3.yml
3-
openapi_spec_hash: 5ccb0a3eca0814d90f29b55aa7a6addf
4-
config_hash: ff14aa5e5e62c91fbfaee8e082fad64a
1+
configured_endpoints: 25
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/zorihq%2Fzoriapi-614269322c5443aca33a07bfd9ba7817cc242f536719afd38cb81528b7865384.yml
3+
openapi_spec_hash: 9fb4ade7613dac0da0fe4067bead34ee
4+
config_hash: 0a7775334a55b407a216827fcf1b136b

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 0.5.0 (2025-10-20)
4+
5+
Full Changelog: [v0.4.1...v0.5.0](https://github.com/ZoriHQ/typescript-api-sdk/compare/v0.4.1...v0.5.0)
6+
7+
### Features
8+
9+
* **api/analytics:** added bounce,churn,etc. ([9dffd54](https://github.com/ZoriHQ/typescript-api-sdk/commit/9dffd54ca1fef42615b7d69da3050c65f387883c))
10+
311
## 0.4.1 (2025-10-19)
412

513
Full Changelog: [v0.4.0...v0.4.1](https://github.com/ZoriHQ/typescript-api-sdk/compare/v0.4.0...v0.4.1)

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ or products provided by Zoriapi, please follow the respective company's security
2020

2121
### Zoriapi Terms and Policies
2222

23-
Please contact supportsdk@zorihq.com for any questions or concerns regarding the security of our services.
23+
Please contact support@zorihq.com for any questions or concerns regarding the security of our services.
2424

2525
---
2626

api.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,20 @@
44

55
Types:
66

7+
- <code><a href="./src/resources/v1/analytics/analytics.ts">ActiveUsersResponse</a></code>
8+
- <code><a href="./src/resources/v1/analytics/analytics.ts">BounceRateByPageMetric</a></code>
9+
- <code><a href="./src/resources/v1/analytics/analytics.ts">BounceRateResponse</a></code>
10+
- <code><a href="./src/resources/v1/analytics/analytics.ts">ChurnRateResponse</a></code>
11+
- <code><a href="./src/resources/v1/analytics/analytics.ts">CohortAnalysisResponse</a></code>
12+
- <code><a href="./src/resources/v1/analytics/analytics.ts">CohortData</a></code>
713
- <code><a href="./src/resources/v1/analytics/analytics.ts">CountryDataPoint</a></code>
14+
- <code><a href="./src/resources/v1/analytics/analytics.ts">DashboardMetricsResponse</a></code>
815
- <code><a href="./src/resources/v1/analytics/analytics.ts">EventsOverTimeDataPoint</a></code>
916
- <code><a href="./src/resources/v1/analytics/analytics.ts">OriginDataPoint</a></code>
1017
- <code><a href="./src/resources/v1/analytics/analytics.ts">RecentEvent</a></code>
1118
- <code><a href="./src/resources/v1/analytics/analytics.ts">RecentEventsResponse</a></code>
19+
- <code><a href="./src/resources/v1/analytics/analytics.ts">ReturnRateResponse</a></code>
20+
- <code><a href="./src/resources/v1/analytics/analytics.ts">SessionMetricsResponse</a></code>
1221
- <code><a href="./src/resources/v1/analytics/analytics.ts">TopVisitor</a></code>
1322
- <code><a href="./src/resources/v1/analytics/analytics.ts">TopVisitorsResponse</a></code>
1423
- <code><a href="./src/resources/v1/analytics/analytics.ts">UniqueVisitorsDataPoint</a></code>
@@ -20,6 +29,10 @@ Types:
2029
- <code><a href="./src/resources/v1/analytics/analytics.ts">VisitorsByDeviceResponse</a></code>
2130
- <code><a href="./src/resources/v1/analytics/analytics.ts">VisitorsByOriginResponse</a></code>
2231

32+
Methods:
33+
34+
- <code title="get /api/v1/analytics/dashboard">client.v1.analytics.<a href="./src/resources/v1/analytics/analytics.ts">dashboard</a>({ ...params }) -> DashboardMetricsResponse</code>
35+
2336
### Visitors
2437

2538
Methods:
@@ -37,6 +50,27 @@ Methods:
3750

3851
- <code title="get /api/v1/analytics/events/recent">client.v1.analytics.events.<a href="./src/resources/v1/analytics/events.ts">recent</a>({ ...params }) -> RecentEventsResponse</code>
3952

53+
### Sessions
54+
55+
Methods:
56+
57+
- <code title="get /api/v1/analytics/sessions/bounce-rate">client.v1.analytics.sessions.<a href="./src/resources/v1/analytics/sessions.ts">bounceRate</a>({ ...params }) -> BounceRateResponse</code>
58+
- <code title="get /api/v1/analytics/sessions/metrics">client.v1.analytics.sessions.<a href="./src/resources/v1/analytics/sessions.ts">metrics</a>({ ...params }) -> SessionMetricsResponse</code>
59+
60+
### Users
61+
62+
Methods:
63+
64+
- <code title="get /api/v1/analytics/users/active">client.v1.analytics.users.<a href="./src/resources/v1/analytics/users.ts">active</a>({ ...params }) -> ActiveUsersResponse</code>
65+
66+
### Retention
67+
68+
Methods:
69+
70+
- <code title="get /api/v1/analytics/retention/churn-rate">client.v1.analytics.retention.<a href="./src/resources/v1/analytics/retention.ts">churnRate</a>({ ...params }) -> ChurnRateResponse</code>
71+
- <code title="get /api/v1/analytics/retention/cohorts">client.v1.analytics.retention.<a href="./src/resources/v1/analytics/retention.ts">cohorts</a>({ ...params }) -> CohortAnalysisResponse</code>
72+
- <code title="get /api/v1/analytics/retention/return-rate">client.v1.analytics.retention.<a href="./src/resources/v1/analytics/retention.ts">returnRate</a>({ ...params }) -> ReturnRateResponse</code>
73+
4074
## Projects
4175

4276
Types:

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "zorihq",
3-
"version": "0.4.1",
3+
"version": "0.5.0",
44
"description": "The official TypeScript library for the Zoriapi API",
5-
"author": "Zoriapi <supportsdk@zorihq.com>",
5+
"author": "Zoriapi <support@zorihq.com>",
66
"types": "dist/index.d.ts",
77
"main": "dist/index.js",
88
"type": "commonjs",

src/resources/v1/analytics/analytics.ts

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
import { APIResource } from '../../../core/resource';
44
import * as EventsAPI from './events';
55
import { EventRecentParams, Events } from './events';
6+
import * as RetentionAPI from './retention';
7+
import {
8+
Retention,
9+
RetentionChurnRateParams,
10+
RetentionCohortsParams,
11+
RetentionReturnRateParams,
12+
} from './retention';
13+
import * as SessionsAPI from './sessions';
14+
import { SessionBounceRateParams, SessionMetricsParams, Sessions } from './sessions';
15+
import * as UsersAPI from './users';
16+
import { UserActiveParams, Users } from './users';
617
import * as VisitorsAPI from './visitors';
718
import {
819
VisitorByCountryParams,
@@ -13,10 +24,86 @@ import {
1324
VisitorTopParams,
1425
Visitors,
1526
} from './visitors';
27+
import { APIPromise } from '../../../core/api-promise';
28+
import { RequestOptions } from '../../../internal/request-options';
1629

1730
export class Analytics extends APIResource {
1831
visitors: VisitorsAPI.Visitors = new VisitorsAPI.Visitors(this._client);
1932
events: EventsAPI.Events = new EventsAPI.Events(this._client);
33+
sessions: SessionsAPI.Sessions = new SessionsAPI.Sessions(this._client);
34+
users: UsersAPI.Users = new UsersAPI.Users(this._client);
35+
retention: RetentionAPI.Retention = new RetentionAPI.Retention(this._client);
36+
37+
/**
38+
* Get combined key metrics including sessions, active users, bounce rate, and
39+
* retention for dashboard display
40+
*
41+
* @example
42+
* ```ts
43+
* const dashboardMetricsResponse =
44+
* await client.v1.analytics.dashboard({
45+
* project_id: 'project_id',
46+
* time_range: 'last_hour',
47+
* });
48+
* ```
49+
*/
50+
dashboard(query: AnalyticsDashboardParams, options?: RequestOptions): APIPromise<DashboardMetricsResponse> {
51+
return this._client.get('/api/v1/analytics/dashboard', { query, ...options });
52+
}
53+
}
54+
55+
export interface ActiveUsersResponse {
56+
dau?: number;
57+
58+
mau?: number;
59+
60+
wau?: number;
61+
}
62+
63+
export interface BounceRateByPageMetric {
64+
bounce_rate?: number;
65+
66+
page?: string;
67+
68+
sessions?: number;
69+
}
70+
71+
export interface BounceRateResponse {
72+
by_page?: Array<BounceRateByPageMetric>;
73+
74+
overall_bounce_rate?: number;
75+
}
76+
77+
export interface ChurnRateResponse {
78+
churn_rate_percent?: number;
79+
80+
churn_threshold_days?: number;
81+
82+
churned_users?: number;
83+
84+
total_users?: number;
85+
}
86+
87+
export interface CohortAnalysisResponse {
88+
cohorts?: Array<CohortData>;
89+
}
90+
91+
export interface CohortData {
92+
cohort_period?: string;
93+
94+
cohort_size?: number;
95+
96+
month_1_retention?: number;
97+
98+
month_2_retention?: number;
99+
100+
month_3_retention?: number;
101+
102+
week_1_retention?: number;
103+
104+
week_2_retention?: number;
105+
106+
week_4_retention?: number;
20107
}
21108

22109
export interface CountryDataPoint {
@@ -27,6 +114,42 @@ export interface CountryDataPoint {
27114
unique_visitors?: number;
28115
}
29116

117+
export interface DashboardMetricsResponse {
118+
avg_pages_per_session?: number;
119+
120+
avg_session_duration_seconds?: number;
121+
122+
/**
123+
* Engagement metrics
124+
*/
125+
bounce_rate?: number;
126+
127+
/**
128+
* Active users
129+
*/
130+
dau?: number;
131+
132+
mau?: number;
133+
134+
return_rate?: number;
135+
136+
/**
137+
* Sessions
138+
*/
139+
sessions_today?: number;
140+
141+
/**
142+
* Total metrics
143+
*/
144+
total_events?: number;
145+
146+
total_sessions_in_period?: number;
147+
148+
unique_visitors?: number;
149+
150+
wau?: number;
151+
}
152+
30153
export interface EventsOverTimeDataPoint {
31154
event_count?: number;
32155

@@ -69,6 +192,24 @@ export interface RecentEventsResponse {
69192
total?: number;
70193
}
71194

195+
export interface ReturnRateResponse {
196+
avg_time_between_sessions_hours?: number;
197+
198+
return_rate_percent?: number;
199+
200+
returning_users?: number;
201+
202+
total_users?: number;
203+
}
204+
205+
export interface SessionMetricsResponse {
206+
average_pages_per_session?: number;
207+
208+
average_session_duration_seconds?: number;
209+
210+
total_sessions?: number;
211+
}
212+
72213
export interface TopVisitor {
73214
browser_name?: string;
74215

@@ -165,16 +306,40 @@ export interface VisitorsByOriginResponse {
165306
data?: Array<OriginDataPoint>;
166307
}
167308

309+
export interface AnalyticsDashboardParams {
310+
/**
311+
* Project ID
312+
*/
313+
project_id: string;
314+
315+
/**
316+
* Time range
317+
*/
318+
time_range: 'last_hour' | 'today' | 'last_7_days' | 'last_30_days' | 'last_90_days';
319+
}
320+
168321
Analytics.Visitors = Visitors;
169322
Analytics.Events = Events;
323+
Analytics.Sessions = Sessions;
324+
Analytics.Users = Users;
325+
Analytics.Retention = Retention;
170326

171327
export declare namespace Analytics {
172328
export {
329+
type ActiveUsersResponse as ActiveUsersResponse,
330+
type BounceRateByPageMetric as BounceRateByPageMetric,
331+
type BounceRateResponse as BounceRateResponse,
332+
type ChurnRateResponse as ChurnRateResponse,
333+
type CohortAnalysisResponse as CohortAnalysisResponse,
334+
type CohortData as CohortData,
173335
type CountryDataPoint as CountryDataPoint,
336+
type DashboardMetricsResponse as DashboardMetricsResponse,
174337
type EventsOverTimeDataPoint as EventsOverTimeDataPoint,
175338
type OriginDataPoint as OriginDataPoint,
176339
type RecentEvent as RecentEvent,
177340
type RecentEventsResponse as RecentEventsResponse,
341+
type ReturnRateResponse as ReturnRateResponse,
342+
type SessionMetricsResponse as SessionMetricsResponse,
178343
type TopVisitor as TopVisitor,
179344
type TopVisitorsResponse as TopVisitorsResponse,
180345
type UniqueVisitorsDataPoint as UniqueVisitorsDataPoint,
@@ -185,6 +350,7 @@ export declare namespace Analytics {
185350
type VisitorsByCountryResponse as VisitorsByCountryResponse,
186351
type VisitorsByDeviceResponse as VisitorsByDeviceResponse,
187352
type VisitorsByOriginResponse as VisitorsByOriginResponse,
353+
type AnalyticsDashboardParams as AnalyticsDashboardParams,
188354
};
189355

190356
export {
@@ -198,4 +364,19 @@ export declare namespace Analytics {
198364
};
199365

200366
export { Events as Events, type EventRecentParams as EventRecentParams };
367+
368+
export {
369+
Sessions as Sessions,
370+
type SessionBounceRateParams as SessionBounceRateParams,
371+
type SessionMetricsParams as SessionMetricsParams,
372+
};
373+
374+
export { Users as Users, type UserActiveParams as UserActiveParams };
375+
376+
export {
377+
Retention as Retention,
378+
type RetentionChurnRateParams as RetentionChurnRateParams,
379+
type RetentionCohortsParams as RetentionCohortsParams,
380+
type RetentionReturnRateParams as RetentionReturnRateParams,
381+
};
201382
}

src/resources/v1/analytics/index.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,20 @@
22

33
export {
44
Analytics,
5+
type ActiveUsersResponse,
6+
type BounceRateByPageMetric,
7+
type BounceRateResponse,
8+
type ChurnRateResponse,
9+
type CohortAnalysisResponse,
10+
type CohortData,
511
type CountryDataPoint,
12+
type DashboardMetricsResponse,
613
type EventsOverTimeDataPoint,
714
type OriginDataPoint,
815
type RecentEvent,
916
type RecentEventsResponse,
17+
type ReturnRateResponse,
18+
type SessionMetricsResponse,
1019
type TopVisitor,
1120
type TopVisitorsResponse,
1221
type UniqueVisitorsDataPoint,
@@ -17,8 +26,17 @@ export {
1726
type VisitorsByCountryResponse,
1827
type VisitorsByDeviceResponse,
1928
type VisitorsByOriginResponse,
29+
type AnalyticsDashboardParams,
2030
} from './analytics';
2131
export { Events, type EventRecentParams } from './events';
32+
export {
33+
Retention,
34+
type RetentionChurnRateParams,
35+
type RetentionCohortsParams,
36+
type RetentionReturnRateParams,
37+
} from './retention';
38+
export { Sessions, type SessionBounceRateParams, type SessionMetricsParams } from './sessions';
39+
export { Users, type UserActiveParams } from './users';
2240
export {
2341
Visitors,
2442
type VisitorByCountryParams,

0 commit comments

Comments
 (0)