Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

feat(api): publish feature contracts and migrate SDK and MCP

Mike Cao7c4406bad0be
diff --git a/packages/api-client/src/client.test.ts b/packages/api-client/src/client.test.ts
index 14355b1aa..276de990e 100644
--- a/packages/api-client/src/client.test.ts
+++ b/packages/api-client/src/client.test.ts
@@ -80,6 +80,27 @@ describe('UmamiClient', () => {
expect(JSON.parse(calls[0].body as string)).toMatchObject({ websiteId: 'w1', type: 'funnel' });
});
+ test('sends structured funnel criteria through the GET stats API', async () => {
+ const { client, calls } = createClient([]);
+ const steps = [
+ { type: 'path', value: '/a?x=1&y=日本語' },
+ { type: 'event', value: 'signup' },
+ ];
+ await client.getWebsiteFunnelStats({
+ websiteId: 'w1',
+ startAt: 1,
+ endAt: 2,
+ window: 60,
+ steps: JSON.stringify(steps),
+ browser1: 'eq.Chrome',
+ });
+ expect(calls[0].method).toBe('GET');
+ expect(calls[0].body).toBeUndefined();
+ expect(calls[0].url.pathname).toBe('/api/websites/w1/funnels/stats');
+ expect(JSON.parse(calls[0].url.searchParams.get('steps')!)).toEqual(steps);
+ expect(calls[0].url.searchParams.get('browser1')).toBe('eq.Chrome');
+ });
+
test('uses the Cloud base URL and API key header by default', async () => {
const calls: Captured[] = [];
const client = new UmamiClient({
diff --git a/packages/api-client/src/generated/operations.ts b/packages/api-client/src/generated/operations.ts
index 26c82615d..56a991a96 100644
--- a/packages/api-client/src/generated/operations.ts
+++ b/packages/api-client/src/generated/operations.ts
@@ -162,6 +162,22 @@ export const operations = {
queryParams: [],
hasBody: true,
},
+ createWebsiteFunnel: {
+ operationId: 'createWebsiteFunnel',
+ method: 'post',
+ path: '/api/websites/{websiteId}/funnels',
+ pathParams: ['websiteId'],
+ queryParams: [],
+ hasBody: true,
+ },
+ createWebsiteGoal: {
+ operationId: 'createWebsiteGoal',
+ method: 'post',
+ path: '/api/websites/{websiteId}/goals',
+ pathParams: ['websiteId'],
+ queryParams: [],
+ hasBody: true,
+ },
createWebsiteSegment: {
operationId: 'createWebsiteSegment',
method: 'post',
@@ -266,6 +282,22 @@ export const operations = {
queryParams: [],
hasBody: false,
},
+ deleteWebsiteFunnel: {
+ operationId: 'deleteWebsiteFunnel',
+ method: 'delete',
+ path: '/api/websites/{websiteId}/funnels/{funnelId}',
+ pathParams: ['websiteId', 'funnelId'],
+ queryParams: [],
+ hasBody: false,
+ },
+ deleteWebsiteGoal: {
+ operationId: 'deleteWebsiteGoal',
+ method: 'delete',
+ path: '/api/websites/{websiteId}/goals/{goalId}',
+ pathParams: ['websiteId', 'goalId'],
+ queryParams: [],
+ hasBody: false,
+ },
deleteWebsiteSegment: {
operationId: 'deleteWebsiteSegment',
method: 'delete',
@@ -1549,6 +1581,87 @@ export const operations = {
queryParams: ['startAt', 'endAt', 'search', 'page', 'pageSize', 'maxResults'],
hasBody: false,
},
+ getWebsiteAttribution: {
+ operationId: 'getWebsiteAttribution',
+ method: 'get',
+ path: '/api/websites/{websiteId}/attribution',
+ pathParams: ['websiteId'],
+ queryParams: [
+ 'path',
+ 'referrer',
+ 'title',
+ 'query',
+ 'os',
+ 'browser',
+ 'device',
+ 'country',
+ 'region',
+ 'city',
+ 'tag',
+ 'hostname',
+ 'distinctId',
+ 'language',
+ 'event',
+ 'utmSource',
+ 'utmMedium',
+ 'utmCampaign',
+ 'utmContent',
+ 'utmTerm',
+ 'segment',
+ 'cohort',
+ 'eventType',
+ 'excludeBounce',
+ 'match',
+ 'startAt',
+ 'endAt',
+ 'timezone',
+ 'unit',
+ 'model',
+ 'type',
+ 'step',
+ 'currency',
+ ],
+ hasBody: false,
+ },
+ getWebsiteBreakdown: {
+ operationId: 'getWebsiteBreakdown',
+ method: 'get',
+ path: '/api/websites/{websiteId}/breakdown',
+ pathParams: ['websiteId'],
+ queryParams: [
+ 'path',
+ 'referrer',
+ 'title',
+ 'query',
+ 'os',
+ 'browser',
+ 'device',
+ 'country',
+ 'region',
+ 'city',
+ 'tag',
+ 'hostname',
+ 'distinctId',
+ 'language',
+ 'event',
+ 'utmSource',
+ 'utmMedium',
+ 'utmCampaign',
+ 'utmContent',
+ 'utmTerm',
+ 'segment',
+ 'cohort',
+ 'eventType',
+ 'excludeBounce',
+ 'match',
+ 'startAt',
+ 'endAt',
+ 'timezone',
+ 'unit',
+ 'fields',
+ ],
+ hasBody: false,
+ },
getWebsiteDateRange: {
operationId: 'getWebsiteDateRange',
method: 'get',
@@ -1727,6 +1840,199 @@ export const operations = {
],
hasBody: false,
},
+ getWebsiteFunnel: {
+ operationId: 'getWebsiteFunnel',
+ method: 'get',
+ path: '/api/websites/{websiteId}/funnels/{funnelId}',
+ pathParams: ['websiteId', 'funnelId'],
+ queryParams: [],
+ hasBody: false,
+ },
+ getWebsiteFunnels: {
+ operationId: 'getWebsiteFunnels',
+ method: 'get',
+ path: '/api/websites/{websiteId}/funnels',
+ pathParams: ['websiteId'],
+ queryParams: ['page', 'pageSize', 'maxResults', 'search'],
+ hasBody: false,
+ },
+ getWebsiteFunnelStats: {
+ operationId: 'getWebsiteFunnelStats',
+ method: 'get',
+ path: '/api/websites/{websiteId}/funnels/stats',
+ pathParams: ['websiteId'],
+ queryParams: [
+ 'path',
+ 'referrer',
+ 'title',
+ 'query',
+ 'os',
+ 'browser',
+ 'device',
+ 'country',
+ 'region',
+ 'city',
+ 'tag',
+ 'hostname',
+ 'distinctId',
+ 'language',
+ 'event',
+ 'utmSource',
+ 'utmMedium',
+ 'utmCampaign',
+ 'utmContent',
+ 'utmTerm',
+ 'segment',
+ 'cohort',
+ 'eventType',
+ 'excludeBounce',
+ 'match',
+ 'startAt',
+ 'endAt',
+ 'timezone',
+ 'unit',
+ 'window',
+ 'steps',
+ ],
+ hasBody: false,
+ },
+ getWebsiteGoal: {
+ operationId: 'getWebsiteGoal',
+ method: 'get',
+ path: '/api/websites/{websiteId}/goals/{goalId}',
+ pathParams: ['websiteId', 'goalId'],
+ queryParams: [],
+ hasBody: false,
+ },
+ getWebsiteGoals: {
+ operationId: 'getWebsiteGoals',
+ method: 'get',
+ path: '/api/websites/{websiteId}/goals',
+ pathParams: ['websiteId'],
+ queryParams: ['page', 'pageSize', 'maxResults', 'search'],
+ hasBody: false,
+ },
+ getWebsiteGoalStats: {
+ operationId: 'getWebsiteGoalStats',
+ method: 'get',
+ path: '/api/websites/{websiteId}/goals/stats',
+ pathParams: ['websiteId'],
+ queryParams: [
+ 'path',
+ 'referrer',
+ 'title',
+ 'query',
+ 'os',
+ 'browser',
+ 'device',
+ 'country',
+ 'region',
+ 'city',
+ 'tag',
+ 'hostname',
+ 'distinctId',
+ 'language',
+ 'event',
+ 'utmSource',
+ 'utmMedium',
+ 'utmCampaign',
+ 'utmContent',
+ 'utmTerm',
+ 'segment',
+ 'cohort',
+ 'eventType',
+ 'excludeBounce',
+ 'match',
+ 'startAt',
+ 'endAt',
+ 'timezone',
+ 'unit',
+ 'type',
+ 'value',
+ ],
+ hasBody: false,
+ },
+ getWebsiteHeatmaps: {
+ operationId: 'getWebsiteHeatmaps',
+ method: 'get',
+ path: '/api/websites/{websiteId}/heatmaps',
+ pathParams: ['websiteId'],
+ queryParams: [
+ 'path',
+ 'referrer',
+ 'title',
+ 'query',
+ 'os',
+ 'browser',
+ 'device',
+ 'country',
+ 'region',
+ 'city',
+ 'tag',
+ 'hostname',
+ 'distinctId',
+ 'language',
+ 'event',
+ 'utmSource',
+ 'utmMedium',
+ 'utmCampaign',
+ 'utmContent',
+ 'utmTerm',
+ 'segment',
+ 'cohort',
+ 'eventType',
+ 'excludeBounce',
+ 'match',
+ 'startAt',
+ 'endAt',
+ 'timezone',
+ 'unit',
+ 'urlPath',
+ 'mode',
+ ],
+ hasBody: false,
+ },
+ getWebsiteJourneys: {
+ operationId: 'getWebsiteJourneys',
+ method: 'get',
+ path: '/api/websites/{websiteId}/journeys',
+ pathParams: ['websiteId'],
+ queryParams: [
+ 'path',
+ 'referrer',
+ 'title',
+ 'query',
+ 'os',
+ 'browser',
+ 'device',
+ 'country',
+ 'region',
+ 'city',
+ 'tag',
+ 'hostname',
+ 'distinctId',
+ 'language',
+ 'event',
+ 'utmSource',
+ 'utmMedium',
+ 'utmCampaign',
+ 'utmContent',
+ 'utmTerm',
+ 'segment',
+ 'cohort',
+ 'eventType',
+ 'excludeBounce',
+ 'match',
+ 'startAt',
+ 'endAt',
+ 'timezone',
+ 'unit',
+ 'steps',
+ 'startStep',
+ 'endStep',
+ ],
+ hasBody: false,
+ },
getWebsiteMetrics: {
operationId: 'getWebsiteMetrics',
method: 'get',
@@ -1813,6 +2119,124 @@ export const operations = {
],
hasBody: false,
},
+ getWebsitePerformanceChart: {
+ operationId: 'getWebsitePerformanceChart',
+ method: 'get',
+ path: '/api/websites/{websiteId}/performance/chart',
+ pathParams: ['websiteId'],
+ queryParams: [
+ 'path',
+ 'referrer',
+ 'title',
+ 'query',
+ 'os',
+ 'browser',
+ 'device',
+ 'country',
+ 'region',
+ 'city',
+ 'tag',
+ 'hostname',
+ 'distinctId',
+ 'language',
+ 'event',
+ 'utmSource',
+ 'utmMedium',
+ 'utmCampaign',
+ 'utmContent',
+ 'utmTerm',
+ 'segment',
+ 'cohort',
+ 'eventType',
+ 'excludeBounce',
+ 'match',
+ 'startAt',
+ 'endAt',
+ 'timezone',
+ 'unit',
+ 'metric',
+ ],
+ hasBody: false,
+ },
+ getWebsitePerformanceMetrics: {
+ operationId: 'getWebsitePerformanceMetrics',
+ method: 'get',
+ path: '/api/websites/{websiteId}/performance/metrics',
+ pathParams: ['websiteId'],
+ queryParams: [
+ 'path',
+ 'referrer',
+ 'title',
+ 'query',
+ 'os',
+ 'browser',
+ 'device',
+ 'country',
+ 'region',
+ 'city',
+ 'tag',
+ 'hostname',
+ 'distinctId',
+ 'language',
+ 'event',
+ 'utmSource',
+ 'utmMedium',
+ 'utmCampaign',
+ 'utmContent',
+ 'utmTerm',
+ 'segment',
+ 'cohort',
+ 'eventType',
+ 'excludeBounce',
+ 'match',
+ 'startAt',
+ 'endAt',
+ 'timezone',
+ 'unit',
+ 'metric',
+ 'type',
+ 'limit',
+ ],
+ hasBody: false,
+ },
+ getWebsitePerformanceStats: {
+ operationId: 'getWebsitePerformanceStats',
+ method: 'get',
+ path: '/api/websites/{websiteId}/performance/stats',
+ pathParams: ['websiteId'],
+ queryParams: [
+ 'path',
+ 'referrer',
+ 'title',
+ 'query',
+ 'os',
+ 'browser',
+ 'device',
+ 'country',
+ 'region',
+ 'city',
+ 'tag',
+ 'hostname',
+ 'distinctId',
+ 'language',
+ 'event',
+ 'utmSource',
+ 'utmMedium',
+ 'utmCampaign',
+ 'utmContent',
+ 'utmTerm',
+ 'segment',
+ 'cohort',
+ 'eventType',
+ 'excludeBounce',
+ 'match',
+ 'startAt',
+ 'endAt',
+ 'timezone',
+ 'unit',
+ ],
+ hasBody: false,
+ },
getWebsiteRecorderConfig: {
operationId: 'getWebsiteRecorderConfig',
method: 'get',
@@ -1862,35 +2286,73 @@ export const operations = {
'utmCampaign',
'utmContent',
'utmTerm',
- 'excludeBounce',
+ 'excludeBounce',
+ 'segment',
+ 'cohort',
+ 'eventType',
+ 'match',
+ 'minDuration',
+ 'page',
+ 'pageSize',
+ 'maxResults',
+ 'search',
+ ],
+ hasBody: false,
+ },
+ getWebsiteReplaySaved: {
+ operationId: 'getWebsiteReplaySaved',
+ method: 'get',
+ path: '/api/websites/{websiteId}/replays/saved/{replayId}',
+ pathParams: ['websiteId', 'replayId'],
+ queryParams: [],
+ hasBody: false,
+ },
+ getWebsiteReports: {
+ operationId: 'getWebsiteReports',
+ method: 'get',
+ path: '/api/websites/{websiteId}/reports',
+ pathParams: ['websiteId'],
+ queryParams: ['type', 'page', 'pageSize', 'maxResults'],
+ hasBody: false,
+ },
+ getWebsiteRetention: {
+ operationId: 'getWebsiteRetention',
+ method: 'get',
+ path: '/api/websites/{websiteId}/retention',
+ pathParams: ['websiteId'],
+ queryParams: [
+ 'path',
+ 'referrer',
+ 'title',
+ 'query',
+ 'os',
+ 'browser',
+ 'device',
+ 'country',
+ 'region',
+ 'city',
+ 'tag',
+ 'hostname',
+ 'distinctId',
+ 'language',
+ 'event',
+ 'utmSource',
+ 'utmMedium',
+ 'utmCampaign',
+ 'utmContent',
+ 'utmTerm',
'segment',
'cohort',
'eventType',
+ 'excludeBounce',
'match',
- 'minDuration',
- 'page',
- 'pageSize',
- 'maxResults',
- 'search',
+ 'startAt',
+ 'endAt',
+ 'timezone',
+ 'unit',
],
hasBody: false,
},
- getWebsiteReplaySaved: {
- operationId: 'getWebsiteReplaySaved',
- method: 'get',
- path: '/api/websites/{websiteId}/replays/saved/{replayId}',
- pathParams: ['websiteId', 'replayId'],
- queryParams: [],
- hasBody: false,
- },
- getWebsiteReports: {
- operationId: 'getWebsiteReports',
- method: 'get',
- path: '/api/websites/{websiteId}/reports',
- pathParams: ['websiteId'],
- queryParams: ['type', 'page', 'pageSize', 'maxResults'],
- hasBody: false,
- },
getWebsiteRevenueChart: {
operationId: 'getWebsiteRevenueChart',
method: 'get',
@@ -2064,6 +2526,82 @@ export const operations = {
],
hasBody: false,
},
+ getWebsiteSavedFunnelStats: {
+ operationId: 'getWebsiteSavedFunnelStats',
+ method: 'get',
+ path: '/api/websites/{websiteId}/funnels/{funnelId}/stats',
+ pathParams: ['websiteId', 'funnelId'],
+ queryParams: [
+ 'path',
+ 'referrer',
+ 'title',
+ 'query',
+ 'os',
+ 'browser',
+ 'device',
+ 'country',
+ 'region',
+ 'city',
+ 'tag',
+ 'hostname',
+ 'distinctId',
+ 'language',
+ 'event',
+ 'utmSource',
+ 'utmMedium',
+ 'utmCampaign',
+ 'utmContent',
+ 'utmTerm',
+ 'segment',
+ 'cohort',
+ 'eventType',
+ 'excludeBounce',
+ 'match',
+ 'startAt',
+ 'endAt',
+ 'timezone',
+ 'unit',
+ ],
+ hasBody: false,
+ },
+ getWebsiteSavedGoalStats: {
+ operationId: 'getWebsiteSavedGoalStats',
+ method: 'get',
+ path: '/api/websites/{websiteId}/goals/{goalId}/stats',
+ pathParams: ['websiteId', 'goalId'],
+ queryParams: [
+ 'path',
+ 'referrer',
+ 'title',
+ 'query',
+ 'os',
+ 'browser',
+ 'device',
+ 'country',
+ 'region',
+ 'city',
+ 'tag',
+ 'hostname',
+ 'distinctId',
+ 'language',
+ 'event',
+ 'utmSource',
+ 'utmMedium',
+ 'utmCampaign',
+ 'utmContent',
+ 'utmTerm',
+ 'segment',
+ 'cohort',
+ 'eventType',
+ 'excludeBounce',
+ 'match',
+ 'startAt',
+ 'endAt',
+ 'timezone',
+ 'unit',
+ ],
+ hasBody: false,
+ },
getWebsiteSavedReplays: {
operationId: 'getWebsiteSavedReplays',
method: 'get',
@@ -2336,6 +2874,45 @@ export const operations = {
],
hasBody: false,
},
+ getWebsiteUtmMetrics: {
+ operationId: 'getWebsiteUtmMetrics',
+ method: 'get',
+ path: '/api/websites/{websiteId}/utm/metrics',
+ pathParams: ['websiteId'],
+ queryParams: [
+ 'path',
+ 'referrer',
+ 'title',
+ 'query',
+ 'os',
+ 'browser',
+ 'device',
+ 'country',
+ 'region',
+ 'city',
+ 'tag',
+ 'hostname',
+ 'distinctId',
+ 'language',
+ 'event',
+ 'utmSource',
+ 'utmMedium',
+ 'utmCampaign',
+ 'utmContent',
+ 'utmTerm',
+ 'segment',
+ 'cohort',
+ 'eventType',
+ 'excludeBounce',
+ 'match',
+ 'startAt',
+ 'endAt',
+ 'timezone',
+ 'unit',
+ 'type',
+ ],
+ hasBody: false,
+ },
getWebsiteValues: {
operationId: 'getWebsiteValues',
method: 'get',
@@ -2618,6 +3195,22 @@ export const operations = {
queryParams: [],
hasBody: true,
},
+ updateWebsiteFunnel: {
+ operationId: 'updateWebsiteFunnel',
+ method: 'post',
+ path: '/api/websites/{websiteId}/funnels/{funnelId}',
+ pathParams: ['websiteId', 'funnelId'],
+ queryParams: [],
+ hasBody: true,
+ },
+ updateWebsiteGoal: {
+ operationId: 'updateWebsiteGoal',
+ method: 'post',
+ path: '/api/websites/{websiteId}/goals/{goalId}',
+ pathParams: ['websiteId', 'goalId'],
+ queryParams: [],
+ hasBody: true,
+ },
updateWebsiteSegment: {
operationId: 'updateWebsiteSegment',
method: 'post',
@@ -2900,6 +3493,28 @@ export abstract class GeneratedUmamiClient {
return this.execute('createWebsiteAnnotation', input, options);
}
+ /**
+ * Create website funnel
+ * `POST /api/websites/{websiteId}/funnels`
+ */
+ createWebsiteFunnel(
+ input: OperationInput<'createWebsiteFunnel'>,
+ options?: RequestOptions,
+ ): Promise<OperationOutput<'createWebsiteFunnel'>> {
+ return this.execute('createWebsiteFunnel', input, options);
+ }
+
+ /**
+ * Create website goal
+ * `POST /api/websites/{websiteId}/goals`
+ */
+ createWebsiteGoal(
+ input: OperationInput<'createWebsiteGoal'>,
+ options?: RequestOptions,
+ ): Promise<OperationOutput<'createWebsiteGoal'>> {
+ return this.execute('createWebsiteGoal', input, options);
+ }
+
/**
* Create a website segment or cohort
* Saves a named segment or cohort with its type and filter parameters for the website.
@@ -3056,6 +3671,28 @@ export abstract class GeneratedUmamiClient {
return this.execute('deleteWebsiteAnnotation', input, options);
}
+ /**
+ * Delete website funnel
+ * `DELETE /api/websites/{websiteId}/funnels/{funnelId}`
+ */
+ deleteWebsiteFunnel(
+ input: OperationInput<'deleteWebsiteFunnel'>,
+ options?: RequestOptions,
+ ): Promise<OperationOutput<'deleteWebsiteFunnel'>> {
+ return this.execute('deleteWebsiteFunnel', input, options);
+ }
+
+ /**
+ * Delete website goal
+ * `DELETE /api/websites/{websiteId}/goals/{goalId}`
+ */
+ deleteWebsiteGoal(
+ input: OperationInput<'deleteWebsiteGoal'>,
+ options?: RequestOptions,
+ ): Promise<OperationOutput<'deleteWebsiteGoal'>> {
+ return this.execute('deleteWebsiteGoal', input, options);
+ }
+
/**
* Delete a website segment or cohort
* Deletes the specified saved segment or cohort from the website.
@@ -3812,6 +4449,28 @@ export abstract class GeneratedUmamiClient {
return this.execute('getWebsiteAnnotations', input, options);
}
+ /**
+ * Get website attribution
+ * `GET /api/websites/{websiteId}/attribution`
+ */
+ getWebsiteAttribution(
+ input: OperationInput<'getWebsiteAttribution'>,
+ options?: RequestOptions,
+ ): Promise<OperationOutput<'getWebsiteAttribution'>> {
+ return this.execute('getWebsiteAttribution', input, options);
+ }
+
+ /**
+ * Get website breakdown
+ * `GET /api/websites/{websiteId}/breakdown`
+ */
+ getWebsiteBreakdown(
+ input: OperationInput<'getWebsiteBreakdown'>,
+ options?: RequestOptions,
+ ): Promise<OperationOutput<'getWebsiteBreakdown'>> {
+ return this.execute('getWebsiteBreakdown', input, options);
+ }
+
/**
* Get the website's available date range
* Returns the earliest and latest recorded event dates for the website.
@@ -3872,6 +4531,94 @@ export abstract class GeneratedUmamiClient {
return this.execute('getWebsiteExpandedMetrics', input, options);
}
+ /**
+ * Get website funnel
+ * `GET /api/websites/{websiteId}/funnels/{funnelId}`
+ */
+ getWebsiteFunnel(
+ input: OperationInput<'getWebsiteFunnel'>,
+ options?: RequestOptions,
+ ): Promise<OperationOutput<'getWebsiteFunnel'>> {
+ return this.execute('getWebsiteFunnel', input, options);
+ }
+
+ /**
+ * Get website funnels
+ * `GET /api/websites/{websiteId}/funnels`
+ */
+ getWebsiteFunnels(
+ input: OperationInput<'getWebsiteFunnels'>,
+ options?: RequestOptions,
+ ): Promise<OperationOutput<'getWebsiteFunnels'>> {
+ return this.execute('getWebsiteFunnels', input, options);
+ }
+
+ /**
+ * Get website funnel stats
+ * `GET /api/websites/{websiteId}/funnels/stats`
+ */
+ getWebsiteFunnelStats(
+ input: OperationInput<'getWebsiteFunnelStats'>,
+ options?: RequestOptions,
+ ): Promise<OperationOutput<'getWebsiteFunnelStats'>> {
+ return this.execute('getWebsiteFunnelStats', input, options);
+ }
+
+ /**
+ * Get website goal
+ * `GET /api/websites/{websiteId}/goals/{goalId}`
+ */
+ getWebsiteGoal(
+ input: OperationInput<'getWebsiteGoal'>,
+ options?: RequestOptions,
+ ): Promise<OperationOutput<'getWebsiteGoal'>> {
+ return this.execute('getWebsiteGoal', input, options);
+ }
+
+ /**
+ * Get website goals
+ * `GET /api/websites/{websiteId}/goals`
+ */
+ getWebsiteGoals(
+ input: OperationInput<'getWebsiteGoals'>,
+ options?: RequestOptions,
+ ): Promise<OperationOutput<'getWebsiteGoals'>> {
+ return this.execute('getWebsiteGoals', input, options);
+ }
+
+ /**
+ * Get website goal stats
+ * `GET /api/websites/{websiteId}/goals/stats`
+ */
+ getWebsiteGoalStats(
+ input: OperationInput<'getWebsiteGoalStats'>,
+ options?: RequestOptions,
+ ): Promise<OperationOutput<'getWebsiteGoalStats'>> {
+ return this.execute('getWebsiteGoalStats', input, options);
+ }
+
+ /**
+ * Get website heatmaps
+ * `GET /api/websites/{websiteId}/heatmaps`
+ */
+ getWebsiteHeatmaps(
+ input: OperationInput<'getWebsiteHeatmaps'>,
+ options?: RequestOptions,
+ ): Promise<OperationOutput<'getWebsiteHeatmaps'>> {
+ return this.execute('getWebsiteHeatmaps', input, options);
+ }
+
+ /**
+ * Get website journeys
+ * `GET /api/websites/{websiteId}/journeys`
+ */
+ getWebsiteJourneys(
+ input: OperationInput<'getWebsiteJourneys'>,
+ options?: RequestOptions,
+ ): Promise<OperationOutput<'getWebsiteJourneys'>> {
+ return this.execute('getWebsiteJourneys', input, options);
+ }
+
/**
* Get ranked website metrics
* Returns the most frequent values for a dimension such as pages, referrers, countries, browsers, campaigns, or events. Counts pageviews or events for activity dimensions and unique visitors for visitor dimensions.
@@ -3896,6 +4643,39 @@ export abstract class GeneratedUmamiClient {
return this.execute('getWebsitePageviews', input, options);
}
+ /**
+ * Get website performance chart
+ * `GET /api/websites/{websiteId}/performance/chart`
+ */
+ getWebsitePerformanceChart(
+ input: OperationInput<'getWebsitePerformanceChart'>,
+ options?: RequestOptions,
+ ): Promise<OperationOutput<'getWebsitePerformanceChart'>> {
+ return this.execute('getWebsitePerformanceChart', input, options);
+ }
+
+ /**
+ * Get website performance metrics
+ * `GET /api/websites/{websiteId}/performance/metrics`
+ */
+ getWebsitePerformanceMetrics(
+ input: OperationInput<'getWebsitePerformanceMetrics'>,
+ options?: RequestOptions,
+ ): Promise<OperationOutput<'getWebsitePerformanceMetrics'>> {
+ return this.execute('getWebsitePerformanceMetrics', input, options);
+ }
+
+ /**
+ * Get website performance stats
+ * `GET /api/websites/{websiteId}/performance/stats`
+ */
+ getWebsitePerformanceStats(
+ input: OperationInput<'getWebsitePerformanceStats'>,
+ options?: RequestOptions,
+ ): Promise<OperationOutput<'getWebsitePerformanceStats'>> {
+ return this.execute('getWebsitePerformanceStats', input, options);
+ }
+
/**
* Get website recording settings
* Returns public replay and heatmap settings, including sampling, masking, and duration limits. Returns disabled status when recording is unavailable.
@@ -3956,6 +4736,17 @@ export abstract class GeneratedUmamiClient {
return this.execute('getWebsiteReports', input, options);
}
+ /**
+ * Get website retention
+ * `GET /api/websites/{websiteId}/retention`
+ */
+ getWebsiteRetention(
+ input: OperationInput<'getWebsiteRetention'>,
+ options?: RequestOptions,
+ ): Promise<OperationOutput<'getWebsiteRetention'>> {
+ return this.execute('getWebsiteRetention', input, options);
+ }
+
/**
* Get website revenue over time
* Returns revenue chart data for the selected currency, date range, and website filters.
@@ -4004,6 +4795,28 @@ export abstract class GeneratedUmamiClient {
return this.execute('getWebsiteRevenueStats', input, options);
}
+ /**
+ * Get website saved funnel stats
+ * `GET /api/websites/{websiteId}/funnels/{funnelId}/stats`
+ */
+ getWebsiteSavedFunnelStats(
+ input: OperationInput<'getWebsiteSavedFunnelStats'>,
+ options?: RequestOptions,
+ ): Promise<OperationOutput<'getWebsiteSavedFunnelStats'>> {
+ return this.execute('getWebsiteSavedFunnelStats', input, options);
+ }
+
+ /**
+ * Get website saved goal stats
+ * `GET /api/websites/{websiteId}/goals/{goalId}/stats`
+ */
+ getWebsiteSavedGoalStats(
+ input: OperationInput<'getWebsiteSavedGoalStats'>,
+ options?: RequestOptions,
+ ): Promise<OperationOutput<'getWebsiteSavedGoalStats'>> {
+ return this.execute('getWebsiteSavedGoalStats', input, options);
+ }
+
/**
* List saved session replays
* Returns a paginated, searchable list of replays saved for the website.
@@ -4160,6 +4973,17 @@ export abstract class GeneratedUmamiClient {
return this.execute('getWebsiteStats', input, options);
}
+ /**
+ * Get website utm metrics
+ * `GET /api/websites/{websiteId}/utm/metrics`
+ */
+ getWebsiteUtmMetrics(
+ input: OperationInput<'getWebsiteUtmMetrics'>,
+ options?: RequestOptions,
+ ): Promise<OperationOutput<'getWebsiteUtmMetrics'>> {
+ return this.execute('getWebsiteUtmMetrics', input, options);
+ }
+
/**
* List website filter values
* Returns available values for a website filter, including saved segments or cohorts when requested, to populate filter choices.
@@ -4550,6 +5374,28 @@ export abstract class GeneratedUmamiClient {
return this.execute('updateWebsiteAnnotation', input, options);
}
+ /**
+ * Update website funnel
+ * `POST /api/websites/{websiteId}/funnels/{funnelId}`
+ */
+ updateWebsiteFunnel(
+ input: OperationInput<'updateWebsiteFunnel'>,
+ options?: RequestOptions,
+ ): Promise<OperationOutput<'updateWebsiteFunnel'>> {
+ return this.execute('updateWebsiteFunnel', input, options);
+ }
+
+ /**
+ * Update website goal
+ * `POST /api/websites/{websiteId}/goals/{goalId}`
+ */
+ updateWebsiteGoal(
+ input: OperationInput<'updateWebsiteGoal'>,
+ options?: RequestOptions,
+ ): Promise<OperationOutput<'updateWebsiteGoal'>> {
+ return this.execute('updateWebsiteGoal', input, options);
+ }
+
/**
* Update a website segment or cohort
* Updates a saved segment or cohort's type, name, and filter parameters.
diff --git a/packages/api-client/src/generated/types.ts b/packages/api-client/src/generated/types.ts
index 61ed1616f..60d8a537f 100644
--- a/packages/api-client/src/generated/types.ts
+++ b/packages/api-client/src/generated/types.ts
@@ -1662,6 +1662,40 @@ export interface paths {
patch?: never;
trace?: never;
};
+ '/api/websites/{websiteId}/attribution': {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** Get website attribution */
+ get: operations['getWebsiteAttribution'];
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ '/api/websites/{websiteId}/breakdown': {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** Get website breakdown */
+ get: operations['getWebsiteBreakdown'];
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
'/api/websites/{websiteId}/daterange': {
parameters: {
query?: never;
@@ -2022,6 +2056,182 @@ export interface paths {
patch?: never;
trace?: never;
};
+ '/api/websites/{websiteId}/funnels': {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** Get website funnels */
+ get: operations['getWebsiteFunnels'];
+ put?: never;
+ /** Create website funnel */
+ post: operations['createWebsiteFunnel'];
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ '/api/websites/{websiteId}/funnels/{funnelId}': {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** Get website funnel */
+ get: operations['getWebsiteFunnel'];
+ put?: never;
+ /** Update website funnel */
+ post: operations['updateWebsiteFunnel'];
+ /** Delete website funnel */
+ delete: operations['deleteWebsiteFunnel'];
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ '/api/websites/{websiteId}/funnels/{funnelId}/stats': {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** Get website saved funnel stats */
+ get: operations['getWebsiteSavedFunnelStats'];
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ '/api/websites/{websiteId}/funnels/stats': {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** Get website funnel stats */
+ get: operations['getWebsiteFunnelStats'];
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ '/api/websites/{websiteId}/goals': {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** Get website goals */
+ get: operations['getWebsiteGoals'];
+ put?: never;
+ /** Create website goal */
+ post: operations['createWebsiteGoal'];
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ '/api/websites/{websiteId}/goals/{goalId}': {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** Get website goal */
+ get: operations['getWebsiteGoal'];
+ put?: never;
+ /** Update website goal */
+ post: operations['updateWebsiteGoal'];
+ /** Delete website goal */
+ delete: operations['deleteWebsiteGoal'];
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ '/api/websites/{websiteId}/goals/{goalId}/stats': {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** Get website saved goal stats */
+ get: operations['getWebsiteSavedGoalStats'];
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ '/api/websites/{websiteId}/goals/stats': {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** Get website goal stats */
+ get: operations['getWebsiteGoalStats'];
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ '/api/websites/{websiteId}/heatmaps': {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** Get website heatmaps */
+ get: operations['getWebsiteHeatmaps'];
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ '/api/websites/{websiteId}/journeys': {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** Get website journeys */
+ get: operations['getWebsiteJourneys'];
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
'/api/websites/{websiteId}/metrics': {
parameters: {
query?: never;
@@ -2082,6 +2292,57 @@ export interface paths {
patch?: never;
trace?: never;
};
+ '/api/websites/{websiteId}/performance/chart': {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** Get website performance chart */
+ get: operations['getWebsitePerformanceChart'];
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ '/api/websites/{websiteId}/performance/metrics': {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** Get website performance metrics */
+ get: operations['getWebsitePerformanceMetrics'];
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ '/api/websites/{websiteId}/performance/stats': {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** Get website performance stats */
+ get: operations['getWebsitePerformanceStats'];
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
'/api/websites/{websiteId}/recorder': {
parameters: {
query?: never;
@@ -2226,6 +2487,23 @@ export interface paths {
patch?: never;
trace?: never;
};
+ '/api/websites/{websiteId}/retention': {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** Get website retention */
+ get: operations['getWebsiteRetention'];
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
'/api/websites/{websiteId}/revenue/chart': {
parameters: {
query?: never;
@@ -2746,6 +3024,23 @@ export interface paths {
patch?: never;
trace?: never;
};
+ '/api/websites/{websiteId}/utm/metrics': {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** Get website utm metrics */
+ get: operations['getWebsiteUtmMetrics'];
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
'/api/websites/{websiteId}/values': {
parameters: {
query?: never;
@@ -14309,59 +14604,7 @@ export interface operations {
};
};
};
- getWebsiteDateRange: {
- parameters: {
- query?: never;
- header?: never;
- path: {
- /** @description ID of the website. */
- websiteId: string;
- };
- cookie?: never;
- };
- requestBody?: never;
- responses: {
- /** @description The operation completed successfully. */
- 200: {
- headers: {
- [name: string]: unknown;
- };
- content: {
- 'application/json': {
- /**
- * Format: date-time
- * @description End of the date range as an ISO 8601 date or date-time.
- */
- endDate: string;
- /**
- * Format: date-time
- * @description Start of the date range as an ISO 8601 date or date-time.
- */
- startDate: string;
- };
- };
- };
- /** @description Unauthorized. */
- 401: {
- headers: {
- [name: string]: unknown;
- };
- content: {
- /**
- * @example {
- * "error": {
- * "code": "unauthorized",
- * "message": "Unauthorized.",
- * "status": 401
- * }
- * }
- */
- 'application/json': components['schemas']['ApiError'];
- };
- };
- };
- };
- getEventData: {
+ getWebsiteAttribution: {
parameters: {
query: {
/** @description Browser used by the visitor. */
@@ -14372,6 +14615,8 @@ export interface operations {
cohort?: string;
/** @description Country code of the visitor. */
country?: string;
+ /** @description Currency code used for revenue values. */
+ currency?: string;
/** @description Device category used by the visitor. */
device?: string;
/** @description Custom identifier assigned to the visitor. */
@@ -14390,14 +14635,9 @@ export interface operations {
language?: string;
/** @description Whether records must match all filters or any filter. */
match?: 'all' | 'any';
- /** @description Maximum number of results to include. */
- maxResults?: number;
+ model: 'first-click' | 'last-click';
/** @description Operating system used by the visitor. */
os?: string;
- /** @description Page number, starting at 1. */
- page?: number;
- /** @description Number of results per page. */
- pageSize?: number;
/** @description Filter by page URL path. */
path?: string;
/** @description Filter by page URL query string. */
@@ -14410,10 +14650,17 @@ export interface operations {
segment?: string;
/** @description Start of the date range as a Unix timestamp in milliseconds. */
startAt: number;
+ step: string;
/** @description Tag attached to the tracked activity. */
tag?: string;
+ /** @description IANA time zone used to interpret dates and group results, for example America/New_York. */
+ timezone?: string;
/** @description Filter by page title. */
title?: string;
+ /** @description Type of resource or analytics dimension to return. */
+ type: 'path' | 'event';
+ /** @description Time interval used to group results: minute, hour, day, month, or year. */
+ unit?: string;
/** @description UTM campaign name. */
utmCampaign?: string;
/** @description UTM campaign content. */
@@ -14441,36 +14688,50 @@ export interface operations {
};
content: {
'application/json': {
- /** @description Number of matching records. */
- count: number;
- /** @description Data returned by the operation. */
- data: {
- /** @description ID of the event. */
- eventId: string;
- /** @description Name of the custom event. */
- eventName: string;
- /** @description Custom properties recorded with the event. */
- eventProperties: {
- /** @description Date and time the record was created. */
- createdAt: string;
- /** @description Name of the custom property. */
- dataKey: string;
- /** @description Data type of the custom property. */
- dataType: number;
- /** @description Custom property value stored as a date-time. */
- dateValue: string;
- /** @description Custom property value stored as a number. */
- numberValue: number;
- /** @description Custom property value stored as a string. */
- stringValue: string;
- }[];
- /** @description ID of the website. */
- websiteId: string;
+ paidAds: {
+ /** @description Display name of the resource. */
+ name: string;
+ value: number;
+ }[];
+ /** @description URL of the referring page. */
+ referrer: {
+ /** @description Display name of the resource. */
+ name: string;
+ value: number;
+ }[];
+ total: {
+ /** @description Pageview counts for the selected period. */
+ pageviews: number;
+ /** @description Unique visitor counts for the selected period. */
+ visitors: number;
+ /** @description Visit counts for the selected period. */
+ visits: number;
+ };
+ utm_campaign: {
+ /** @description Display name of the resource. */
+ name: string;
+ value: number;
+ }[];
+ utm_content: {
+ /** @description Display name of the resource. */
+ name: string;
+ value: number;
+ }[];
+ utm_medium: {
+ /** @description Display name of the resource. */
+ name: string;
+ value: number;
+ }[];
+ utm_source: {
+ /** @description Display name of the resource. */
+ name: string;
+ value: number;
+ }[];
+ utm_term: {
+ /** @description Display name of the resource. */
+ name: string;
+ value: number;
}[];
- /** @description Page number, starting at 1. */
- page: number;
- /** @description Number of results per page. */
- pageSize: number;
};
};
};
@@ -14510,9 +14771,27 @@ export interface operations {
'application/json': components['schemas']['ApiError'];
};
};
+ /** @description Not found. */
+ 404: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "not-found",
+ * "message": "Not found.",
+ * "status": 404
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
};
};
- getEventDataPivot: {
+ getWebsiteBreakdown: {
parameters: {
query: {
/** @description Browser used by the visitor. */
@@ -14531,26 +14810,19 @@ export interface operations {
endAt: number;
/** @description Filter by custom event name. */
event?: string;
- /** @description Name of the custom event. */
- eventName: string;
/** @description Event type: 1 for a pageview or 2 for a custom event. */
eventType?: number;
/** @description Set a non-empty value to exclude visits with only one pageview. */
excludeBounce?: string;
+ fields: string;
/** @description Hostname on which the activity occurred. */
hostname?: string;
/** @description Preferred language reported by the visitor browser. */
language?: string;
/** @description Whether records must match all filters or any filter. */
match?: 'all' | 'any';
- /** @description Maximum number of results to include. */
- maxResults?: number;
/** @description Operating system used by the visitor. */
os?: string;
- /** @description Page number, starting at 1. */
- page?: number;
- /** @description Number of results per page. */
- pageSize?: number;
/** @description Filter by page URL path. */
path?: string;
/** @description Filter by page URL query string. */
@@ -14597,39 +14869,20 @@ export interface operations {
[name: string]: unknown;
};
content: {
- 'application/json': {
- /** @description Number of matching records. */
- count: number;
- /** @description Data returned by the operation. */
- data: {
- /** @description Date and time the record was created. */
- createdAt: string;
- /** @description ID of the event. */
- eventId: string;
- /** @description Name of the custom event. */
- eventName: string;
- /** @description Names of the custom properties. */
- propertyKeys: string[];
- /** @description Values of the custom properties. */
- propertyValues: string[];
- /** @description ID of the visitor session. */
- sessionId: string;
- /** @description Path portion of the page URL. */
- urlPath: string;
- }[];
- /** @description Whether the results were truncated by the maximum result limit. */
- isCapped?: boolean;
- /** @description Field to sort the results by. */
- orderBy?: string;
- /** @description Page number, starting at 1. */
- page: number;
- /** @description Number of results per page. */
- pageSize: number;
- /** @description Search text used to filter results. */
- search?: string;
- /** @description Whether to sort results in descending order. */
- sortDescending?: boolean;
- };
+ 'application/json': ({
+ /** @description Number of visits with only one pageview. */
+ bounces: number;
+ /** @description Total visit duration in seconds. */
+ totaltime: number;
+ /** @description Pageview counts for the selected period. */
+ views: number;
+ /** @description Unique visitor counts for the selected period. */
+ visitors: number;
+ /** @description Visit counts for the selected period. */
+ visits: number;
+ } & {
+ [key: string]: string | number;
+ })[];
};
};
/** @description Bad request. */
@@ -14668,74 +14921,29 @@ export interface operations {
'application/json': components['schemas']['ApiError'];
};
};
+ /** @description Not found. */
+ 404: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "not-found",
+ * "message": "Not found.",
+ * "status": 404
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
};
};
- getEventDataArraySeries: {
+ getWebsiteDateRange: {
parameters: {
- query: {
- /** @description Browser used by the visitor. */
- browser?: string;
- /** @description City of the visitor. */
- city?: string;
- /** @description ID of a saved cohort used to filter visitors. */
- cohort?: string;
- /** @description Country code of the visitor. */
- country?: string;
- /** @description Device category used by the visitor. */
- device?: string;
- /** @description Custom identifier assigned to the visitor. */
- distinctId?: string;
- /** @description End of the date range as a Unix timestamp in milliseconds. */
- endAt: number;
- /** @description Filter by custom event name. */
- event?: string;
- /** @description Name of the custom event. */
- eventName: string;
- /** @description Event type: 1 for a pageview or 2 for a custom event. */
- eventType?: number;
- /** @description Set a non-empty value to exclude visits with only one pageview. */
- excludeBounce?: string;
- /** @description Hostname on which the activity occurred. */
- hostname?: string;
- /** @description Preferred language reported by the visitor browser. */
- language?: string;
- /** @description Whether records must match all filters or any filter. */
- match?: 'all' | 'any';
- /** @description Operating system used by the visitor. */
- os?: string;
- /** @description Filter by page URL path. */
- path?: string;
- /** @description Name of the custom event or session property. */
- propertyName: string;
- /** @description Filter by page URL query string. */
- query?: string;
- /** @description Filter by referring URL. */
- referrer?: string;
- /** @description Region or subdivision of the visitor. */
- region?: string;
- /** @description ID of a saved segment used to filter results. */
- segment?: string;
- /** @description Start of the date range as a Unix timestamp in milliseconds. */
- startAt: number;
- /** @description Tag attached to the tracked activity. */
- tag?: string;
- /** @description IANA time zone used to interpret dates and group results, for example America/New_York. */
- timezone?: string;
- /** @description Filter by page title. */
- title?: string;
- /** @description Time interval used to group results: minute, hour, day, month, or year. */
- unit?: string;
- /** @description UTM campaign name. */
- utmCampaign?: string;
- /** @description UTM campaign content. */
- utmContent?: string;
- /** @description UTM campaign medium. */
- utmMedium?: string;
- /** @description UTM campaign source. */
- utmSource?: string;
- /** @description UTM campaign search term. */
- utmTerm?: string;
- };
+ query?: never;
header?: never;
path: {
/** @description ID of the website. */
@@ -14752,28 +14960,17 @@ export interface operations {
};
content: {
'application/json': {
- t: string;
- x: string;
- y: number;
- }[];
- };
- };
- /** @description Bad request. */
- 400: {
- headers: {
- [name: string]: unknown;
- };
- content: {
- /**
- * @example {
- * "error": {
- * "code": "bad-request",
- * "message": "Bad request.",
- * "status": 400
- * }
- * }
- */
- 'application/json': components['schemas']['ApiError'];
+ /**
+ * Format: date-time
+ * @description End of the date range as an ISO 8601 date or date-time.
+ */
+ endDate: string;
+ /**
+ * Format: date-time
+ * @description Start of the date range as an ISO 8601 date or date-time.
+ */
+ startDate: string;
+ };
};
};
/** @description Unauthorized. */
@@ -14796,7 +14993,7 @@ export interface operations {
};
};
};
- getEventDataDateSeries: {
+ getEventData: {
parameters: {
query: {
/** @description Browser used by the visitor. */
@@ -14815,8 +15012,6 @@ export interface operations {
endAt: number;
/** @description Filter by custom event name. */
event?: string;
- /** @description Name of the custom event. */
- eventName: string;
/** @description Event type: 1 for a pageview or 2 for a custom event. */
eventType?: number;
/** @description Set a non-empty value to exclude visits with only one pageview. */
@@ -14827,12 +15022,16 @@ export interface operations {
language?: string;
/** @description Whether records must match all filters or any filter. */
match?: 'all' | 'any';
+ /** @description Maximum number of results to include. */
+ maxResults?: number;
/** @description Operating system used by the visitor. */
os?: string;
+ /** @description Page number, starting at 1. */
+ page?: number;
+ /** @description Number of results per page. */
+ pageSize?: number;
/** @description Filter by page URL path. */
path?: string;
- /** @description Name of the custom event or session property. */
- propertyName: string;
/** @description Filter by page URL query string. */
query?: string;
/** @description Filter by referring URL. */
@@ -14845,8 +15044,6 @@ export interface operations {
startAt: number;
/** @description Tag attached to the tracked activity. */
tag?: string;
- /** @description IANA time zone used to interpret dates and group results, for example America/New_York. */
- timezone?: string;
/** @description Filter by page title. */
title?: string;
/** @description UTM campaign name. */
@@ -14876,9 +15073,37 @@ export interface operations {
};
content: {
'application/json': {
- t: string;
- y: number;
- }[];
+ /** @description Number of matching records. */
+ count: number;
+ /** @description Data returned by the operation. */
+ data: {
+ /** @description ID of the event. */
+ eventId: string;
+ /** @description Name of the custom event. */
+ eventName: string;
+ /** @description Custom properties recorded with the event. */
+ eventProperties: {
+ /** @description Date and time the record was created. */
+ createdAt: string;
+ /** @description Name of the custom property. */
+ dataKey: string;
+ /** @description Data type of the custom property. */
+ dataType: number;
+ /** @description Custom property value stored as a date-time. */
+ dateValue: string;
+ /** @description Custom property value stored as a number. */
+ numberValue: number;
+ /** @description Custom property value stored as a string. */
+ stringValue: string;
+ }[];
+ /** @description ID of the website. */
+ websiteId: string;
+ }[];
+ /** @description Page number, starting at 1. */
+ page: number;
+ /** @description Number of results per page. */
+ pageSize: number;
+ };
};
};
/** @description Bad request. */
@@ -14919,7 +15144,7 @@ export interface operations {
};
};
};
- getEventDataNumericSeries: {
+ getEventDataPivot: {
parameters: {
query: {
/** @description Browser used by the visitor. */
@@ -14950,14 +15175,16 @@ export interface operations {
language?: string;
/** @description Whether records must match all filters or any filter. */
match?: 'all' | 'any';
- /** @description Numeric aggregation to calculate for the selected property. */
- metric?: 'sum' | 'avg' | 'count';
+ /** @description Maximum number of results to include. */
+ maxResults?: number;
/** @description Operating system used by the visitor. */
os?: string;
+ /** @description Page number, starting at 1. */
+ page?: number;
+ /** @description Number of results per page. */
+ pageSize?: number;
/** @description Filter by page URL path. */
path?: string;
- /** @description Name of the custom event or session property. */
- propertyName: string;
/** @description Filter by page URL query string. */
query?: string;
/** @description Filter by referring URL. */
@@ -15003,9 +15230,38 @@ export interface operations {
};
content: {
'application/json': {
- t: string;
- y: number;
- }[];
+ /** @description Number of matching records. */
+ count: number;
+ /** @description Data returned by the operation. */
+ data: {
+ /** @description Date and time the record was created. */
+ createdAt: string;
+ /** @description ID of the event. */
+ eventId: string;
+ /** @description Name of the custom event. */
+ eventName: string;
+ /** @description Names of the custom properties. */
+ propertyKeys: string[];
+ /** @description Values of the custom properties. */
+ propertyValues: string[];
+ /** @description ID of the visitor session. */
+ sessionId: string;
+ /** @description Path portion of the page URL. */
+ urlPath: string;
+ }[];
+ /** @description Whether the results were truncated by the maximum result limit. */
+ isCapped?: boolean;
+ /** @description Field to sort the results by. */
+ orderBy?: string;
+ /** @description Page number, starting at 1. */
+ page: number;
+ /** @description Number of results per page. */
+ pageSize: number;
+ /** @description Search text used to filter results. */
+ search?: string;
+ /** @description Whether to sort results in descending order. */
+ sortDescending?: boolean;
+ };
};
};
/** @description Bad request. */
@@ -15046,7 +15302,7 @@ export interface operations {
};
};
};
- getEventDataNumericStats: {
+ getEventDataArraySeries: {
parameters: {
query: {
/** @description Browser used by the visitor. */
@@ -15095,8 +15351,12 @@ export interface operations {
startAt: number;
/** @description Tag attached to the tracked activity. */
tag?: string;
+ /** @description IANA time zone used to interpret dates and group results, for example America/New_York. */
+ timezone?: string;
/** @description Filter by page title. */
title?: string;
+ /** @description Time interval used to group results: minute, hour, day, month, or year. */
+ unit?: string;
/** @description UTM campaign name. */
utmCampaign?: string;
/** @description UTM campaign content. */
@@ -15124,16 +15384,10 @@ export interface operations {
};
content: {
'application/json': {
- /** @description Arithmetic mean of the numeric property values. */
- average: number;
- /** @description Maximum numeric property value. */
- max: number;
- /** @description Median of the numeric property values. */
- median: number;
- /** @description Minimum numeric property value. */
- min: number;
- total: number;
- };
+ t: string;
+ x: string;
+ y: number;
+ }[];
};
};
/** @description Bad request. */
@@ -15174,7 +15428,7 @@ export interface operations {
};
};
};
- getEventDataPropertySeries: {
+ getEventDataDateSeries: {
parameters: {
query: {
/** @description Browser used by the visitor. */
@@ -15227,8 +15481,6 @@ export interface operations {
timezone?: string;
/** @description Filter by page title. */
title?: string;
- /** @description Time interval used to group results: minute, hour, day, month, or year. */
- unit?: string;
/** @description UTM campaign name. */
utmCampaign?: string;
/** @description UTM campaign content. */
@@ -15257,7 +15509,6 @@ export interface operations {
content: {
'application/json': {
t: string;
- x: string;
y: number;
}[];
};
@@ -15300,79 +15551,7 @@ export interface operations {
};
};
};
- getEventDataById: {
- parameters: {
- query?: never;
- header?: never;
- path: {
- /** @description ID of the event. */
- eventId: string;
- /** @description ID of the website. */
- websiteId: string;
- };
- cookie?: never;
- };
- requestBody?: never;
- responses: {
- /** @description The operation completed successfully. */
- 200: {
- headers: {
- [name: string]: unknown;
- };
- content: {
- 'application/json': {
- /**
- * Format: date-time
- * @description Date and time the record was created.
- */
- createdAt: string;
- /** @description Name of the custom property. */
- dataKey: string;
- /** @description Data type of the custom property. */
- dataType: number;
- /**
- * Format: date-time
- * @description Custom property value stored as a date-time.
- */
- dateValue: string;
- /** @description Unique identifier of the resource. */
- id: string;
- /** @description Custom property value stored as a number. */
- numberValue: {
- d: number[];
- e: number;
- s: number;
- };
- /** @description Custom property value stored as a string. */
- stringValue: string;
- /** @description ID of the website event. */
- websiteEventId: string;
- /** @description ID of the website. */
- websiteId: string;
- }[];
- };
- };
- /** @description Unauthorized. */
- 401: {
- headers: {
- [name: string]: unknown;
- };
- content: {
- /**
- * @example {
- * "error": {
- * "code": "unauthorized",
- * "message": "Unauthorized.",
- * "status": 401
- * }
- * }
- */
- 'application/json': components['schemas']['ApiError'];
- };
- };
- };
- };
- getEventDataEvents: {
+ getEventDataNumericSeries: {
parameters: {
query: {
/** @description Browser used by the visitor. */
@@ -15391,6 +15570,8 @@ export interface operations {
endAt: number;
/** @description Filter by custom event name. */
event?: string;
+ /** @description Name of the custom event. */
+ eventName: string;
/** @description Event type: 1 for a pageview or 2 for a custom event. */
eventType?: number;
/** @description Set a non-empty value to exclude visits with only one pageview. */
@@ -15401,10 +15582,14 @@ export interface operations {
language?: string;
/** @description Whether records must match all filters or any filter. */
match?: 'all' | 'any';
+ /** @description Numeric aggregation to calculate for the selected property. */
+ metric?: 'sum' | 'avg' | 'count';
/** @description Operating system used by the visitor. */
os?: string;
/** @description Filter by page URL path. */
path?: string;
+ /** @description Name of the custom event or session property. */
+ propertyName: string;
/** @description Filter by page URL query string. */
query?: string;
/** @description Filter by referring URL. */
@@ -15417,8 +15602,12 @@ export interface operations {
startAt: number;
/** @description Tag attached to the tracked activity. */
tag?: string;
+ /** @description IANA time zone used to interpret dates and group results, for example America/New_York. */
+ timezone?: string;
/** @description Filter by page title. */
title?: string;
+ /** @description Time interval used to group results: minute, hour, day, month, or year. */
+ unit?: string;
/** @description UTM campaign name. */
utmCampaign?: string;
/** @description UTM campaign content. */
@@ -15446,15 +15635,8 @@ export interface operations {
};
content: {
'application/json': {
- /** @description Data type of the custom property. */
- dataType: number;
- /** @description Name of the custom event. */
- eventName?: string;
- /** @description Name of the custom event or session property. */
- propertyName: string;
- /** @description Value of the custom property. */
- propertyValue?: string;
- total: number;
+ t: string;
+ y: number;
}[];
};
};
@@ -15496,7 +15678,7 @@ export interface operations {
};
};
};
- getEventDataFields: {
+ getEventDataNumericStats: {
parameters: {
query: {
/** @description Browser used by the visitor. */
@@ -15516,7 +15698,135 @@ export interface operations {
/** @description Filter by custom event name. */
event?: string;
/** @description Name of the custom event. */
- eventName?: string;
+ eventName: string;
+ /** @description Event type: 1 for a pageview or 2 for a custom event. */
+ eventType?: number;
+ /** @description Set a non-empty value to exclude visits with only one pageview. */
+ excludeBounce?: string;
+ /** @description Hostname on which the activity occurred. */
+ hostname?: string;
+ /** @description Preferred language reported by the visitor browser. */
+ language?: string;
+ /** @description Whether records must match all filters or any filter. */
+ match?: 'all' | 'any';
+ /** @description Operating system used by the visitor. */
+ os?: string;
+ /** @description Filter by page URL path. */
+ path?: string;
+ /** @description Name of the custom event or session property. */
+ propertyName: string;
+ /** @description Filter by page URL query string. */
+ query?: string;
+ /** @description Filter by referring URL. */
+ referrer?: string;
+ /** @description Region or subdivision of the visitor. */
+ region?: string;
+ /** @description ID of a saved segment used to filter results. */
+ segment?: string;
+ /** @description Start of the date range as a Unix timestamp in milliseconds. */
+ startAt: number;
+ /** @description Tag attached to the tracked activity. */
+ tag?: string;
+ /** @description Filter by page title. */
+ title?: string;
+ /** @description UTM campaign name. */
+ utmCampaign?: string;
+ /** @description UTM campaign content. */
+ utmContent?: string;
+ /** @description UTM campaign medium. */
+ utmMedium?: string;
+ /** @description UTM campaign source. */
+ utmSource?: string;
+ /** @description UTM campaign search term. */
+ utmTerm?: string;
+ };
+ header?: never;
+ path: {
+ /** @description ID of the website. */
+ websiteId: string;
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The operation completed successfully. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ 'application/json': {
+ /** @description Arithmetic mean of the numeric property values. */
+ average: number;
+ /** @description Maximum numeric property value. */
+ max: number;
+ /** @description Median of the numeric property values. */
+ median: number;
+ /** @description Minimum numeric property value. */
+ min: number;
+ total: number;
+ };
+ };
+ };
+ /** @description Bad request. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "bad-request",
+ * "message": "Bad request.",
+ * "status": 400
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Unauthorized. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "unauthorized",
+ * "message": "Unauthorized.",
+ * "status": 401
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ };
+ };
+ getEventDataPropertySeries: {
+ parameters: {
+ query: {
+ /** @description Browser used by the visitor. */
+ browser?: string;
+ /** @description City of the visitor. */
+ city?: string;
+ /** @description ID of a saved cohort used to filter visitors. */
+ cohort?: string;
+ /** @description Country code of the visitor. */
+ country?: string;
+ /** @description Device category used by the visitor. */
+ device?: string;
+ /** @description Custom identifier assigned to the visitor. */
+ distinctId?: string;
+ /** @description End of the date range as a Unix timestamp in milliseconds. */
+ endAt: number;
+ /** @description Filter by custom event name. */
+ event?: string;
+ /** @description Name of the custom event. */
+ eventName: string;
/** @description Event type: 1 for a pageview or 2 for a custom event. */
eventType?: number;
/** @description Set a non-empty value to exclude visits with only one pageview. */
@@ -15531,6 +15841,8 @@ export interface operations {
os?: string;
/** @description Filter by page URL path. */
path?: string;
+ /** @description Name of the custom event or session property. */
+ propertyName: string;
/** @description Filter by page URL query string. */
query?: string;
/** @description Filter by referring URL. */
@@ -15543,8 +15855,12 @@ export interface operations {
startAt: number;
/** @description Tag attached to the tracked activity. */
tag?: string;
+ /** @description IANA time zone used to interpret dates and group results, for example America/New_York. */
+ timezone?: string;
/** @description Filter by page title. */
title?: string;
+ /** @description Time interval used to group results: minute, hour, day, month, or year. */
+ unit?: string;
/** @description UTM campaign name. */
utmCampaign?: string;
/** @description UTM campaign content. */
@@ -15565,19 +15881,2511 @@ export interface operations {
};
requestBody?: never;
responses: {
- /** @description The operation completed successfully. */
+ /** @description The operation completed successfully. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ 'application/json': {
+ t: string;
+ x: string;
+ y: number;
+ }[];
+ };
+ };
+ /** @description Bad request. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "bad-request",
+ * "message": "Bad request.",
+ * "status": 400
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Unauthorized. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "unauthorized",
+ * "message": "Unauthorized.",
+ * "status": 401
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ };
+ };
+ getEventDataById: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ /** @description ID of the event. */
+ eventId: string;
+ /** @description ID of the website. */
+ websiteId: string;
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The operation completed successfully. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ 'application/json': {
+ /**
+ * Format: date-time
+ * @description Date and time the record was created.
+ */
+ createdAt: string;
+ /** @description Name of the custom property. */
+ dataKey: string;
+ /** @description Data type of the custom property. */
+ dataType: number;
+ /**
+ * Format: date-time
+ * @description Custom property value stored as a date-time.
+ */
+ dateValue: string;
+ /** @description Unique identifier of the resource. */
+ id: string;
+ /** @description Custom property value stored as a number. */
+ numberValue: {
+ d: number[];
+ e: number;
+ s: number;
+ };
+ /** @description Custom property value stored as a string. */
+ stringValue: string;
+ /** @description ID of the website event. */
+ websiteEventId: string;
+ /** @description ID of the website. */
+ websiteId: string;
+ }[];
+ };
+ };
+ /** @description Unauthorized. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "unauthorized",
+ * "message": "Unauthorized.",
+ * "status": 401
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ };
+ };
+ getEventDataEvents: {
+ parameters: {
+ query: {
+ /** @description Browser used by the visitor. */
+ browser?: string;
+ /** @description City of the visitor. */
+ city?: string;
+ /** @description ID of a saved cohort used to filter visitors. */
+ cohort?: string;
+ /** @description Country code of the visitor. */
+ country?: string;
+ /** @description Device category used by the visitor. */
+ device?: string;
+ /** @description Custom identifier assigned to the visitor. */
+ distinctId?: string;
+ /** @description End of the date range as a Unix timestamp in milliseconds. */
+ endAt: number;
+ /** @description Filter by custom event name. */
+ event?: string;
+ /** @description Event type: 1 for a pageview or 2 for a custom event. */
+ eventType?: number;
+ /** @description Set a non-empty value to exclude visits with only one pageview. */
+ excludeBounce?: string;
+ /** @description Hostname on which the activity occurred. */
+ hostname?: string;
+ /** @description Preferred language reported by the visitor browser. */
+ language?: string;
+ /** @description Whether records must match all filters or any filter. */
+ match?: 'all' | 'any';
+ /** @description Operating system used by the visitor. */
+ os?: string;
+ /** @description Filter by page URL path. */
+ path?: string;
+ /** @description Filter by page URL query string. */
+ query?: string;
+ /** @description Filter by referring URL. */
+ referrer?: string;
+ /** @description Region or subdivision of the visitor. */
+ region?: string;
+ /** @description ID of a saved segment used to filter results. */
+ segment?: string;
+ /** @description Start of the date range as a Unix timestamp in milliseconds. */
+ startAt: number;
+ /** @description Tag attached to the tracked activity. */
+ tag?: string;
+ /** @description Filter by page title. */
+ title?: string;
+ /** @description UTM campaign name. */
+ utmCampaign?: string;
+ /** @description UTM campaign content. */
+ utmContent?: string;
+ /** @description UTM campaign medium. */
+ utmMedium?: string;
+ /** @description UTM campaign source. */
+ utmSource?: string;
+ /** @description UTM campaign search term. */
+ utmTerm?: string;
+ };
+ header?: never;
+ path: {
+ /** @description ID of the website. */
+ websiteId: string;
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The operation completed successfully. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ 'application/json': {
+ /** @description Data type of the custom property. */
+ dataType: number;
+ /** @description Name of the custom event. */
+ eventName?: string;
+ /** @description Name of the custom event or session property. */
+ propertyName: string;
+ /** @description Value of the custom property. */
+ propertyValue?: string;
+ total: number;
+ }[];
+ };
+ };
+ /** @description Bad request. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "bad-request",
+ * "message": "Bad request.",
+ * "status": 400
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Unauthorized. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "unauthorized",
+ * "message": "Unauthorized.",
+ * "status": 401
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ };
+ };
+ getEventDataFields: {
+ parameters: {
+ query: {
+ /** @description Browser used by the visitor. */
+ browser?: string;
+ /** @description City of the visitor. */
+ city?: string;
+ /** @description ID of a saved cohort used to filter visitors. */
+ cohort?: string;
+ /** @description Country code of the visitor. */
+ country?: string;
+ /** @description Device category used by the visitor. */
+ device?: string;
+ /** @description Custom identifier assigned to the visitor. */
+ distinctId?: string;
+ /** @description End of the date range as a Unix timestamp in milliseconds. */
+ endAt: number;
+ /** @description Filter by custom event name. */
+ event?: string;
+ /** @description Name of the custom event. */
+ eventName?: string;
+ /** @description Event type: 1 for a pageview or 2 for a custom event. */
+ eventType?: number;
+ /** @description Set a non-empty value to exclude visits with only one pageview. */
+ excludeBounce?: string;
+ /** @description Hostname on which the activity occurred. */
+ hostname?: string;
+ /** @description Preferred language reported by the visitor browser. */
+ language?: string;
+ /** @description Whether records must match all filters or any filter. */
+ match?: 'all' | 'any';
+ /** @description Operating system used by the visitor. */
+ os?: string;
+ /** @description Filter by page URL path. */
+ path?: string;
+ /** @description Filter by page URL query string. */
+ query?: string;
+ /** @description Filter by referring URL. */
+ referrer?: string;
+ /** @description Region or subdivision of the visitor. */
+ region?: string;
+ /** @description ID of a saved segment used to filter results. */
+ segment?: string;
+ /** @description Start of the date range as a Unix timestamp in milliseconds. */
+ startAt: number;
+ /** @description Tag attached to the tracked activity. */
+ tag?: string;
+ /** @description Filter by page title. */
+ title?: string;
+ /** @description UTM campaign name. */
+ utmCampaign?: string;
+ /** @description UTM campaign content. */
+ utmContent?: string;
+ /** @description UTM campaign medium. */
+ utmMedium?: string;
+ /** @description UTM campaign source. */
+ utmSource?: string;
+ /** @description UTM campaign search term. */
+ utmTerm?: string;
+ };
+ header?: never;
+ path: {
+ /** @description ID of the website. */
+ websiteId: string;
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The operation completed successfully. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ 'application/json': {
+ /** @description Data type of the custom property. */
+ dataType: number;
+ /** @description Name of the custom event or session property. */
+ propertyName: string;
+ total: number;
+ }[];
+ };
+ };
+ /** @description Bad request. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "bad-request",
+ * "message": "Bad request.",
+ * "status": 400
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Unauthorized. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "unauthorized",
+ * "message": "Unauthorized.",
+ * "status": 401
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ };
+ };
+ getEventDataProperties: {
+ parameters: {
+ query: {
+ /** @description Browser used by the visitor. */
+ browser?: string;
+ /** @description City of the visitor. */
+ city?: string;
+ /** @description ID of a saved cohort used to filter visitors. */
+ cohort?: string;
+ /** @description Country code of the visitor. */
+ country?: string;
+ /** @description Device category used by the visitor. */
+ device?: string;
+ /** @description Custom identifier assigned to the visitor. */
+ distinctId?: string;
+ /** @description End of the date range as a Unix timestamp in milliseconds. */
+ endAt: number;
+ /** @description Filter by custom event name. */
+ event?: string;
+ /** @description Event type: 1 for a pageview or 2 for a custom event. */
+ eventType?: number;
+ /** @description Set a non-empty value to exclude visits with only one pageview. */
+ excludeBounce?: string;
+ /** @description Hostname on which the activity occurred. */
+ hostname?: string;
+ /** @description Preferred language reported by the visitor browser. */
+ language?: string;
+ /** @description Whether records must match all filters or any filter. */
+ match?: 'all' | 'any';
+ /** @description Operating system used by the visitor. */
+ os?: string;
+ /** @description Filter by page URL path. */
+ path?: string;
+ /** @description Filter by page URL query string. */
+ query?: string;
+ /** @description Filter by referring URL. */
+ referrer?: string;
+ /** @description Region or subdivision of the visitor. */
+ region?: string;
+ /** @description ID of a saved segment used to filter results. */
+ segment?: string;
+ /** @description Start of the date range as a Unix timestamp in milliseconds. */
+ startAt: number;
+ /** @description Tag attached to the tracked activity. */
+ tag?: string;
+ /** @description Filter by page title. */
+ title?: string;
+ /** @description UTM campaign name. */
+ utmCampaign?: string;
+ /** @description UTM campaign content. */
+ utmContent?: string;
+ /** @description UTM campaign medium. */
+ utmMedium?: string;
+ /** @description UTM campaign source. */
+ utmSource?: string;
+ /** @description UTM campaign search term. */
+ utmTerm?: string;
+ };
+ header?: never;
+ path: {
+ /** @description ID of the website. */
+ websiteId: string;
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The operation completed successfully. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ 'application/json': {
+ /** @description Data type of the custom property. */
+ dataType: number;
+ /** @description Name of the custom event. */
+ eventName: string;
+ /** @description Name of the custom event or session property. */
+ propertyName: string;
+ total: number;
+ }[];
+ };
+ };
+ /** @description Bad request. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "bad-request",
+ * "message": "Bad request.",
+ * "status": 400
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Unauthorized. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "unauthorized",
+ * "message": "Unauthorized.",
+ * "status": 401
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ };
+ };
+ getEventDataStats: {
+ parameters: {
+ query: {
+ /** @description Browser used by the visitor. */
+ browser?: string;
+ /** @description City of the visitor. */
+ city?: string;
+ /** @description ID of a saved cohort used to filter visitors. */
+ cohort?: string;
+ /** @description Country code of the visitor. */
+ country?: string;
+ /** @description Device category used by the visitor. */
+ device?: string;
+ /** @description Custom identifier assigned to the visitor. */
+ distinctId?: string;
+ /** @description End of the date range as a Unix timestamp in milliseconds. */
+ endAt: number;
+ /** @description Filter by custom event name. */
+ event?: string;
+ /** @description Event type: 1 for a pageview or 2 for a custom event. */
+ eventType?: number;
+ /** @description Set a non-empty value to exclude visits with only one pageview. */
+ excludeBounce?: string;
+ /** @description Hostname on which the activity occurred. */
+ hostname?: string;
+ /** @description Preferred language reported by the visitor browser. */
+ language?: string;
+ /** @description Whether records must match all filters or any filter. */
+ match?: 'all' | 'any';
+ /** @description Operating system used by the visitor. */
+ os?: string;
+ /** @description Filter by page URL path. */
+ path?: string;
+ /** @description Filter by page URL query string. */
+ query?: string;
+ /** @description Filter by referring URL. */
+ referrer?: string;
+ /** @description Region or subdivision of the visitor. */
+ region?: string;
+ /** @description ID of a saved segment used to filter results. */
+ segment?: string;
+ /** @description Start of the date range as a Unix timestamp in milliseconds. */
+ startAt: number;
+ /** @description Tag attached to the tracked activity. */
+ tag?: string;
+ /** @description Filter by page title. */
+ title?: string;
+ /** @description UTM campaign name. */
+ utmCampaign?: string;
+ /** @description UTM campaign content. */
+ utmContent?: string;
+ /** @description UTM campaign medium. */
+ utmMedium?: string;
+ /** @description UTM campaign source. */
+ utmSource?: string;
+ /** @description UTM campaign search term. */
+ utmTerm?: string;
+ };
+ header?: never;
+ path: {
+ /** @description ID of the website. */
+ websiteId: string;
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The operation completed successfully. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ 'application/json': {
+ events: number;
+ properties: number;
+ records: number;
+ };
+ };
+ };
+ /** @description Bad request. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "bad-request",
+ * "message": "Bad request.",
+ * "status": 400
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Unauthorized. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "unauthorized",
+ * "message": "Unauthorized.",
+ * "status": 401
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ };
+ };
+ getEventDataValues: {
+ parameters: {
+ query: {
+ /** @description Browser used by the visitor. */
+ browser?: string;
+ /** @description City of the visitor. */
+ city?: string;
+ /** @description ID of a saved cohort used to filter visitors. */
+ cohort?: string;
+ /** @description Country code of the visitor. */
+ country?: string;
+ /** @description Data type of the custom property. */
+ dataType?: number;
+ /** @description Device category used by the visitor. */
+ device?: string;
+ /** @description Custom identifier assigned to the visitor. */
+ distinctId?: string;
+ /** @description End of the date range as a Unix timestamp in milliseconds. */
+ endAt: number;
+ /** @description Filter by custom event name. */
+ event?: string;
+ /** @description Name of the custom event. */
+ eventName?: string;
+ /** @description Event type: 1 for a pageview or 2 for a custom event. */
+ eventType?: number;
+ /** @description Set a non-empty value to exclude visits with only one pageview. */
+ excludeBounce?: string;
+ /** @description Hostname on which the activity occurred. */
+ hostname?: string;
+ /** @description Preferred language reported by the visitor browser. */
+ language?: string;
+ /** @description Whether records must match all filters or any filter. */
+ match?: 'all' | 'any';
+ /** @description Operating system used by the visitor. */
+ os?: string;
+ /** @description Filter by page URL path. */
+ path?: string;
+ /** @description Name of the custom event or session property. */
+ propertyName: string;
+ /** @description Filter by page URL query string. */
+ query?: string;
+ /** @description Filter by referring URL. */
+ referrer?: string;
+ /** @description Region or subdivision of the visitor. */
+ region?: string;
+ /** @description ID of a saved segment used to filter results. */
+ segment?: string;
+ /** @description Start of the date range as a Unix timestamp in milliseconds. */
+ startAt: number;
+ /** @description Tag attached to the tracked activity. */
+ tag?: string;
+ /** @description Filter by page title. */
+ title?: string;
+ /** @description UTM campaign name. */
+ utmCampaign?: string;
+ /** @description UTM campaign content. */
+ utmContent?: string;
+ /** @description UTM campaign medium. */
+ utmMedium?: string;
+ /** @description UTM campaign source. */
+ utmSource?: string;
+ /** @description UTM campaign search term. */
+ utmTerm?: string;
+ };
+ header?: never;
+ path: {
+ /** @description ID of the website. */
+ websiteId: string;
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The operation completed successfully. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ 'application/json': {
+ total: number;
+ value: string;
+ }[];
+ };
+ };
+ /** @description Bad request. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "bad-request",
+ * "message": "Bad request.",
+ * "status": 400
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Unauthorized. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "unauthorized",
+ * "message": "Unauthorized.",
+ * "status": 401
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ };
+ };
+ getWebsiteEvents: {
+ parameters: {
+ query?: {
+ /** @description Browser used by the visitor. */
+ browser?: string;
+ /** @description City of the visitor. */
+ city?: string;
+ /** @description ID of a saved cohort used to filter visitors. */
+ cohort?: string;
+ /** @description Comparison period: prev for the previous period or yoy for the same period last year. */
+ compare?: 'prev' | 'yoy';
+ /** @description Country code of the visitor. */
+ country?: string;
+ /** @description Device category used by the visitor. */
+ device?: string;
+ /** @description Custom identifier assigned to the visitor. */
+ distinctId?: string;
+ /** @description End of the date range as a Unix timestamp in milliseconds. */
+ endAt?: number;
+ /** @description End of the date range as an ISO 8601 date or date-time. */
+ endDate?: string;
+ /** @description Filter by custom event name. */
+ event?: string;
+ /** @description Event type: 1 for a pageview or 2 for a custom event. */
+ eventType?: number;
+ /** @description Set a non-empty value to exclude visits with only one pageview. */
+ excludeBounce?: string;
+ /** @description Hostname on which the activity occurred. */
+ hostname?: string;
+ /** @description Preferred language reported by the visitor browser. */
+ language?: string;
+ /** @description Whether records must match all filters or any filter. */
+ match?: 'all' | 'any';
+ /** @description Maximum number of results to include. */
+ maxResults?: number;
+ /** @description Operating system used by the visitor. */
+ os?: string;
+ /** @description Page number, starting at 1. */
+ page?: number;
+ /** @description Number of results per page. */
+ pageSize?: number;
+ /** @description Filter by page URL path. */
+ path?: string;
+ /** @description Filter by page URL query string. */
+ query?: string;
+ /** @description Filter by referring URL. */
+ referrer?: string;
+ /** @description Region or subdivision of the visitor. */
+ region?: string;
+ /** @description Search text used to filter results. */
+ search?: string;
+ /** @description ID of a saved segment used to filter results. */
+ segment?: string;
+ /** @description Start of the date range as a Unix timestamp in milliseconds. */
+ startAt?: number;
+ /** @description Start of the date range as an ISO 8601 date or date-time. */
+ startDate?: string;
+ /** @description Tag attached to the tracked activity. */
+ tag?: string;
+ /** @description IANA time zone used to interpret dates and group results, for example America/New_York. */
+ timezone?: string;
+ /** @description Filter by page title. */
+ title?: string;
+ /** @description Time interval used to group results: minute, hour, day, month, or year. */
+ unit?: string;
+ /** @description UTM campaign name. */
+ utmCampaign?: string;
+ /** @description UTM campaign content. */
+ utmContent?: string;
+ /** @description UTM campaign medium. */
+ utmMedium?: string;
+ /** @description UTM campaign source. */
+ utmSource?: string;
+ /** @description UTM campaign search term. */
+ utmTerm?: string;
+ };
+ header?: never;
+ path: {
+ /** @description Website ID. */
+ websiteId: string;
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description A page of events. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ 'application/json': components['schemas']['WebsiteEventPage'];
+ };
+ };
+ /** @description Bad request. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "bad-request",
+ * "message": "Bad request.",
+ * "status": 400
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Unauthorized. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "unauthorized",
+ * "message": "Unauthorized.",
+ * "status": 401
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ };
+ };
+ getWebsiteEventSeries: {
+ parameters: {
+ query: {
+ /** @description Browser used by the visitor. */
+ browser?: string;
+ /** @description City of the visitor. */
+ city?: string;
+ /** @description ID of a saved cohort used to filter visitors. */
+ cohort?: string;
+ /** @description Country code of the visitor. */
+ country?: string;
+ /** @description Device category used by the visitor. */
+ device?: string;
+ /** @description Custom identifier assigned to the visitor. */
+ distinctId?: string;
+ /** @description End of the date range as a Unix timestamp in milliseconds. */
+ endAt: number;
+ /** @description Filter by custom event name. */
+ event?: string;
+ /** @description Event type: 1 for a pageview or 2 for a custom event. */
+ eventType?: number;
+ /** @description Set a non-empty value to exclude visits with only one pageview. */
+ excludeBounce?: string;
+ /** @description Hostname on which the activity occurred. */
+ hostname?: string;
+ /** @description Preferred language reported by the visitor browser. */
+ language?: string;
+ /** @description Maximum number of rows to return. */
+ limit?: number;
+ /** @description Whether records must match all filters or any filter. */
+ match?: 'all' | 'any';
+ /** @description Operating system used by the visitor. */
+ os?: string;
+ /** @description Filter by page URL path. */
+ path?: string;
+ /** @description Filter by page URL query string. */
+ query?: string;
+ /** @description Filter by referring URL. */
+ referrer?: string;
+ /** @description Region or subdivision of the visitor. */
+ region?: string;
+ /** @description ID of a saved segment used to filter results. */
+ segment?: string;
+ /** @description Start of the date range as a Unix timestamp in milliseconds. */
+ startAt: number;
+ /** @description Tag attached to the tracked activity. */
+ tag?: string;
+ /** @description IANA time zone used to interpret dates and group results, for example America/New_York. */
+ timezone: string;
+ /** @description Filter by page title. */
+ title?: string;
+ /** @description Time interval used to group results: minute, hour, day, month, or year. */
+ unit?: string;
+ /** @description UTM campaign name. */
+ utmCampaign?: string;
+ /** @description UTM campaign content. */
+ utmContent?: string;
+ /** @description UTM campaign medium. */
+ utmMedium?: string;
+ /** @description UTM campaign source. */
+ utmSource?: string;
+ /** @description UTM campaign search term. */
+ utmTerm?: string;
+ };
+ header?: never;
+ path: {
+ /** @description ID of the website. */
+ websiteId: string;
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The operation completed successfully. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ 'application/json': {
+ t: string;
+ x: string;
+ y: number;
+ }[];
+ };
+ };
+ /** @description Bad request. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "bad-request",
+ * "message": "Bad request.",
+ * "status": 400
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Unauthorized. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "unauthorized",
+ * "message": "Unauthorized.",
+ * "status": 401
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ };
+ };
+ getWebsiteEventStats: {
+ parameters: {
+ query?: {
+ /** @description Browser used by the visitor. */
+ browser?: string;
+ /** @description City of the visitor. */
+ city?: string;
+ /** @description ID of a saved cohort used to filter visitors. */
+ cohort?: string;
+ /** @description Comparison period: prev for the previous period or yoy for the same period last year. */
+ compare?: 'prev' | 'yoy';
+ /** @description Country code of the visitor. */
+ country?: string;
+ /** @description Device category used by the visitor. */
+ device?: string;
+ /** @description Custom identifier assigned to the visitor. */
+ distinctId?: string;
+ /** @description End of the date range as a Unix timestamp in milliseconds. */
+ endAt?: number;
+ /** @description End of the date range as an ISO 8601 date or date-time. */
+ endDate?: string;
+ /** @description Filter by custom event name. */
+ event?: string;
+ /** @description Event type: 1 for a pageview or 2 for a custom event. */
+ eventType?: number;
+ /** @description Set a non-empty value to exclude visits with only one pageview. */
+ excludeBounce?: string;
+ /** @description Hostname on which the activity occurred. */
+ hostname?: string;
+ /** @description Preferred language reported by the visitor browser. */
+ language?: string;
+ /** @description Whether records must match all filters or any filter. */
+ match?: 'all' | 'any';
+ /** @description Operating system used by the visitor. */
+ os?: string;
+ /** @description Filter by page URL path. */
+ path?: string;
+ /** @description Filter by page URL query string. */
+ query?: string;
+ /** @description Filter by referring URL. */
+ referrer?: string;
+ /** @description Region or subdivision of the visitor. */
+ region?: string;
+ /** @description ID of a saved segment used to filter results. */
+ segment?: string;
+ /** @description Start of the date range as a Unix timestamp in milliseconds. */
+ startAt?: number;
+ /** @description Start of the date range as an ISO 8601 date or date-time. */
+ startDate?: string;
+ /** @description Tag attached to the tracked activity. */
+ tag?: string;
+ /** @description IANA time zone used to interpret dates and group results, for example America/New_York. */
+ timezone?: string;
+ /** @description Filter by page title. */
+ title?: string;
+ /** @description Time interval used to group results: minute, hour, day, month, or year. */
+ unit?: string;
+ /** @description UTM campaign name. */
+ utmCampaign?: string;
+ /** @description UTM campaign content. */
+ utmContent?: string;
+ /** @description UTM campaign medium. */
+ utmMedium?: string;
+ /** @description UTM campaign source. */
+ utmSource?: string;
+ /** @description UTM campaign search term. */
+ utmTerm?: string;
+ };
+ header?: never;
+ path: {
+ /** @description ID of the website. */
+ websiteId: string;
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The operation completed successfully. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ 'application/json': {
+ /** @description Data returned by the operation. */
+ data: {
+ /** @description Analytics for the comparison period. */
+ comparison: {
+ events: number;
+ /** @description Number of unique events. */
+ uniqueEvents: number;
+ /** @description Unique visitor counts for the selected period. */
+ visitors: number;
+ /** @description Visit counts for the selected period. */
+ visits: number;
+ }[];
+ length: number;
+ };
+ };
+ };
+ };
+ /** @description Bad request. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "bad-request",
+ * "message": "Bad request.",
+ * "status": 400
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Unauthorized. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "unauthorized",
+ * "message": "Unauthorized.",
+ * "status": 401
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ };
+ };
+ exportWebsite: {
+ parameters: {
+ query?: {
+ /** @description Comparison period: prev for the previous period or yoy for the same period last year. */
+ compare?: 'prev' | 'yoy';
+ /** @description End of the date range as a Unix timestamp in milliseconds. */
+ endAt?: number;
+ /** @description End of the date range as an ISO 8601 date or date-time. */
+ endDate?: string;
+ /** @description Maximum number of results to include. */
+ maxResults?: number;
+ /** @description Page number, starting at 1. */
+ page?: number;
+ /** @description Number of results per page. */
+ pageSize?: number;
+ /** @description Start of the date range as a Unix timestamp in milliseconds. */
+ startAt?: number;
+ /** @description Start of the date range as an ISO 8601 date or date-time. */
+ startDate?: string;
+ /** @description IANA time zone used to interpret dates and group results, for example America/New_York. */
+ timezone?: string;
+ /** @description Time interval used to group results: minute, hour, day, month, or year. */
+ unit?: string;
+ };
+ header?: never;
+ path: {
+ /** @description ID of the website. */
+ websiteId: string;
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The operation completed successfully. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ 'application/json': {
+ zip: string;
+ };
+ };
+ };
+ /** @description Bad request. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "bad-request",
+ * "message": "Bad request.",
+ * "status": 400
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Unauthorized. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "unauthorized",
+ * "message": "Unauthorized.",
+ * "status": 401
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Successful response. The response shape is inferred as free-form because the handler does not expose a reusable response schema. */
+ 'function toString() { [native code] }': {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ 'application/json': unknown;
+ };
+ };
+ };
+ };
+ getWebsiteFunnels: {
+ parameters: {
+ query?: {
+ /** @description Maximum number of results to include. */
+ maxResults?: number;
+ /** @description Page number, starting at 1. */
+ page?: number;
+ /** @description Number of results per page. */
+ pageSize?: number;
+ /** @description Search text used to filter results. */
+ search?: string;
+ };
+ header?: never;
+ path: {
+ /** @description ID of the website. */
+ websiteId: string;
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The operation completed successfully. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ 'application/json': {
+ /** @description Number of matching records. */
+ count: number;
+ /** @description Data returned by the operation. */
+ data: ({
+ /**
+ * Format: date-time
+ * @description Date and time the record was created.
+ */
+ createdAt: string;
+ /** @description Description of the resource. */
+ description: string;
+ /** @description Unique identifier of the resource. */
+ id: string;
+ /** @description Display name of the resource. */
+ name: string;
+ /** @description Configuration parameters for the resource. */
+ parameters:
+ | string
+ | number
+ | false
+ | true
+ | {
+ [key: string]:
+ | string
+ | number
+ | false
+ | true
+ | unknown
+ | {
+ length: number;
+ };
+ }
+ | {
+ length: number;
+ };
+ type: string;
+ /**
+ * Format: date-time
+ * @description Date and time the record was last updated.
+ */
+ updatedAt: string;
+ /** @description ID of the associated user. */
+ userId: string;
+ /** @description ID of the website. */
+ websiteId: string;
+ } & {
+ website?: {
+ /** @description Domain name associated with the resource. */
+ domain: string;
+ /** @description ID of the associated user. */
+ userId: string;
+ };
+ })[];
+ /** @description Whether the results were truncated by the maximum result limit. */
+ isCapped?: boolean;
+ /** @description Field to sort the results by. */
+ orderBy?: string;
+ /** @description Page number, starting at 1. */
+ page: number;
+ /** @description Number of results per page. */
+ pageSize: number;
+ /** @description Search text used to filter results. */
+ search?: string;
+ /** @description Whether to sort results in descending order. */
+ sortDescending?: boolean;
+ };
+ };
+ };
+ /** @description Bad request. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "bad-request",
+ * "message": "Bad request.",
+ * "status": 400
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Unauthorized. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "unauthorized",
+ * "message": "Unauthorized.",
+ * "status": 401
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Not found. */
+ 404: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "not-found",
+ * "message": "Not found.",
+ * "status": 404
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ };
+ };
+ createWebsiteFunnel: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ /** @description ID of the website. */
+ websiteId: string;
+ };
+ cookie?: never;
+ };
+ requestBody: {
+ content: {
+ 'application/json': {
+ /** @description Description of the resource. */
+ description?: string;
+ /** @description Display name of the resource. */
+ name: string;
+ /** @description Configuration parameters for the resource. */
+ parameters: {
+ steps: {
+ /** @description Filters applied to the analytics data. */
+ filters?: {
+ /** @enum {string} */
+ operator: 'eq' | 'neq' | 'c' | 'dnc';
+ property: string;
+ value: string;
+ }[];
+ /** @enum {string} */
+ type: 'path' | 'event';
+ value: string;
+ }[];
+ window: number;
+ };
+ };
+ };
+ };
+ responses: {
+ /** @description The operation completed successfully. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ 'application/json': {
+ /**
+ * @description Whether the operation succeeded.
+ * @constant
+ */
+ ok: true;
+ };
+ };
+ };
+ /** @description Bad request. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "bad-request",
+ * "message": "Bad request.",
+ * "status": 400
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Unauthorized. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "unauthorized",
+ * "message": "Unauthorized.",
+ * "status": 401
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Not found. */
+ 404: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "not-found",
+ * "message": "Not found.",
+ * "status": 404
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ };
+ };
+ getWebsiteFunnel: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ funnelId: string;
+ /** @description ID of the website. */
+ websiteId: string;
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The operation completed successfully. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ 'application/json': {
+ /**
+ * @description Whether the operation succeeded.
+ * @constant
+ */
+ ok: true;
+ };
+ };
+ };
+ /** @description Bad request. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "bad-request",
+ * "message": "Bad request.",
+ * "status": 400
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Unauthorized. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "unauthorized",
+ * "message": "Unauthorized.",
+ * "status": 401
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Not found. */
+ 404: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "not-found",
+ * "message": "Not found.",
+ * "status": 404
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ };
+ };
+ updateWebsiteFunnel: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ funnelId: string;
+ /** @description ID of the website. */
+ websiteId: string;
+ };
+ cookie?: never;
+ };
+ requestBody: {
+ content: {
+ 'application/json': {
+ /** @description Description of the resource. */
+ description?: string;
+ /** @description Display name of the resource. */
+ name: string;
+ /** @description Configuration parameters for the resource. */
+ parameters: {
+ steps: {
+ /** @description Filters applied to the analytics data. */
+ filters?: {
+ /** @enum {string} */
+ operator: 'eq' | 'neq' | 'c' | 'dnc';
+ property: string;
+ value: string;
+ }[];
+ /** @enum {string} */
+ type: 'path' | 'event';
+ value: string;
+ }[];
+ window: number;
+ };
+ };
+ };
+ };
+ responses: {
+ /** @description The operation completed successfully. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ 'application/json': {
+ /**
+ * @description Whether the operation succeeded.
+ * @constant
+ */
+ ok: true;
+ };
+ };
+ };
+ /** @description Bad request. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "bad-request",
+ * "message": "Bad request.",
+ * "status": 400
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Unauthorized. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "unauthorized",
+ * "message": "Unauthorized.",
+ * "status": 401
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Not found. */
+ 404: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "not-found",
+ * "message": "Not found.",
+ * "status": 404
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ };
+ };
+ deleteWebsiteFunnel: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ funnelId: string;
+ /** @description ID of the website. */
+ websiteId: string;
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description Deleted successfully. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ 'application/json': components['schemas']['Ok'];
+ };
+ };
+ /** @description Bad request. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "bad-request",
+ * "message": "Bad request.",
+ * "status": 400
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Unauthorized. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "unauthorized",
+ * "message": "Unauthorized.",
+ * "status": 401
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Not found. */
+ 404: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "not-found",
+ * "message": "Not found.",
+ * "status": 404
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ };
+ };
+ getWebsiteSavedFunnelStats: {
+ parameters: {
+ query: {
+ /** @description Browser used by the visitor. */
+ browser?: string;
+ /** @description City of the visitor. */
+ city?: string;
+ /** @description ID of a saved cohort used to filter visitors. */
+ cohort?: string;
+ /** @description Country code of the visitor. */
+ country?: string;
+ /** @description Device category used by the visitor. */
+ device?: string;
+ /** @description Custom identifier assigned to the visitor. */
+ distinctId?: string;
+ /** @description End of the date range as a Unix timestamp in milliseconds. */
+ endAt: number;
+ /** @description Filter by custom event name. */
+ event?: string;
+ /** @description Event type: 1 for a pageview or 2 for a custom event. */
+ eventType?: number;
+ /** @description Set a non-empty value to exclude visits with only one pageview. */
+ excludeBounce?: string;
+ /** @description Hostname on which the activity occurred. */
+ hostname?: string;
+ /** @description Preferred language reported by the visitor browser. */
+ language?: string;
+ /** @description Whether records must match all filters or any filter. */
+ match?: 'all' | 'any';
+ /** @description Operating system used by the visitor. */
+ os?: string;
+ /** @description Filter by page URL path. */
+ path?: string;
+ /** @description Filter by page URL query string. */
+ query?: string;
+ /** @description Filter by referring URL. */
+ referrer?: string;
+ /** @description Region or subdivision of the visitor. */
+ region?: string;
+ /** @description ID of a saved segment used to filter results. */
+ segment?: string;
+ /** @description Start of the date range as a Unix timestamp in milliseconds. */
+ startAt: number;
+ /** @description Tag attached to the tracked activity. */
+ tag?: string;
+ /** @description IANA time zone used to interpret dates and group results, for example America/New_York. */
+ timezone?: string;
+ /** @description Filter by page title. */
+ title?: string;
+ /** @description Time interval used to group results: minute, hour, day, month, or year. */
+ unit?: string;
+ /** @description UTM campaign name. */
+ utmCampaign?: string;
+ /** @description UTM campaign content. */
+ utmContent?: string;
+ /** @description UTM campaign medium. */
+ utmMedium?: string;
+ /** @description UTM campaign source. */
+ utmSource?: string;
+ /** @description UTM campaign search term. */
+ utmTerm?: string;
+ };
+ header?: never;
+ path: {
+ funnelId: string;
+ /** @description ID of the website. */
+ websiteId: string;
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The operation completed successfully. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ 'application/json': {
+ dropoff: number;
+ dropped: number;
+ /** @description Filters applied to the analytics data. */
+ filters?: {
+ operator: string;
+ property: string;
+ value: string;
+ }[];
+ previous: number;
+ remaining: number;
+ type: string;
+ value: string;
+ /** @description Unique visitor counts for the selected period. */
+ visitors: number;
+ }[];
+ };
+ };
+ /** @description Bad request. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "bad-request",
+ * "message": "Bad request.",
+ * "status": 400
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Unauthorized. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "unauthorized",
+ * "message": "Unauthorized.",
+ * "status": 401
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Not found. */
+ 404: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "not-found",
+ * "message": "Not found.",
+ * "status": 404
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ };
+ };
+ getWebsiteFunnelStats: {
+ parameters: {
+ query: {
+ /** @description Browser used by the visitor. */
+ browser?: string;
+ /** @description City of the visitor. */
+ city?: string;
+ /** @description ID of a saved cohort used to filter visitors. */
+ cohort?: string;
+ /** @description Country code of the visitor. */
+ country?: string;
+ /** @description Device category used by the visitor. */
+ device?: string;
+ /** @description Custom identifier assigned to the visitor. */
+ distinctId?: string;
+ /** @description End of the date range as a Unix timestamp in milliseconds. */
+ endAt: number;
+ /** @description Filter by custom event name. */
+ event?: string;
+ /** @description Event type: 1 for a pageview or 2 for a custom event. */
+ eventType?: number;
+ /** @description Set a non-empty value to exclude visits with only one pageview. */
+ excludeBounce?: string;
+ /** @description Hostname on which the activity occurred. */
+ hostname?: string;
+ /** @description Preferred language reported by the visitor browser. */
+ language?: string;
+ /** @description Whether records must match all filters or any filter. */
+ match?: 'all' | 'any';
+ /** @description Operating system used by the visitor. */
+ os?: string;
+ /** @description Filter by page URL path. */
+ path?: string;
+ /** @description Filter by page URL query string. */
+ query?: string;
+ /** @description Filter by referring URL. */
+ referrer?: string;
+ /** @description Region or subdivision of the visitor. */
+ region?: string;
+ /** @description ID of a saved segment used to filter results. */
+ segment?: string;
+ /** @description Start of the date range as a Unix timestamp in milliseconds. */
+ startAt: number;
+ steps: string;
+ /** @description Tag attached to the tracked activity. */
+ tag?: string;
+ /** @description IANA time zone used to interpret dates and group results, for example America/New_York. */
+ timezone?: string;
+ /** @description Filter by page title. */
+ title?: string;
+ /** @description Time interval used to group results: minute, hour, day, month, or year. */
+ unit?: string;
+ /** @description UTM campaign name. */
+ utmCampaign?: string;
+ /** @description UTM campaign content. */
+ utmContent?: string;
+ /** @description UTM campaign medium. */
+ utmMedium?: string;
+ /** @description UTM campaign source. */
+ utmSource?: string;
+ /** @description UTM campaign search term. */
+ utmTerm?: string;
+ window: number;
+ };
+ header?: never;
+ path: {
+ /** @description ID of the website. */
+ websiteId: string;
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The operation completed successfully. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ 'application/json': {
+ dropoff: number;
+ dropped: number;
+ /** @description Filters applied to the analytics data. */
+ filters?: {
+ operator: string;
+ property: string;
+ value: string;
+ }[];
+ previous: number;
+ remaining: number;
+ type: string;
+ value: string;
+ /** @description Unique visitor counts for the selected period. */
+ visitors: number;
+ }[];
+ };
+ };
+ /** @description Bad request. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "bad-request",
+ * "message": "Bad request.",
+ * "status": 400
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Unauthorized. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "unauthorized",
+ * "message": "Unauthorized.",
+ * "status": 401
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Not found. */
+ 404: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "not-found",
+ * "message": "Not found.",
+ * "status": 404
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ };
+ };
+ getWebsiteGoals: {
+ parameters: {
+ query?: {
+ /** @description Maximum number of results to include. */
+ maxResults?: number;
+ /** @description Page number, starting at 1. */
+ page?: number;
+ /** @description Number of results per page. */
+ pageSize?: number;
+ /** @description Search text used to filter results. */
+ search?: string;
+ };
+ header?: never;
+ path: {
+ /** @description ID of the website. */
+ websiteId: string;
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The operation completed successfully. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ 'application/json': {
+ /** @description Number of matching records. */
+ count: number;
+ /** @description Data returned by the operation. */
+ data: ({
+ /**
+ * Format: date-time
+ * @description Date and time the record was created.
+ */
+ createdAt: string;
+ /** @description Description of the resource. */
+ description: string;
+ /** @description Unique identifier of the resource. */
+ id: string;
+ /** @description Display name of the resource. */
+ name: string;
+ /** @description Configuration parameters for the resource. */
+ parameters:
+ | string
+ | number
+ | false
+ | true
+ | {
+ [key: string]:
+ | string
+ | number
+ | false
+ | true
+ | unknown
+ | {
+ length: number;
+ };
+ }
+ | {
+ length: number;
+ };
+ type: string;
+ /**
+ * Format: date-time
+ * @description Date and time the record was last updated.
+ */
+ updatedAt: string;
+ /** @description ID of the associated user. */
+ userId: string;
+ /** @description ID of the website. */
+ websiteId: string;
+ } & {
+ website?: {
+ /** @description Domain name associated with the resource. */
+ domain: string;
+ /** @description ID of the associated user. */
+ userId: string;
+ };
+ })[];
+ /** @description Whether the results were truncated by the maximum result limit. */
+ isCapped?: boolean;
+ /** @description Field to sort the results by. */
+ orderBy?: string;
+ /** @description Page number, starting at 1. */
+ page: number;
+ /** @description Number of results per page. */
+ pageSize: number;
+ /** @description Search text used to filter results. */
+ search?: string;
+ /** @description Whether to sort results in descending order. */
+ sortDescending?: boolean;
+ };
+ };
+ };
+ /** @description Bad request. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "bad-request",
+ * "message": "Bad request.",
+ * "status": 400
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Unauthorized. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "unauthorized",
+ * "message": "Unauthorized.",
+ * "status": 401
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Not found. */
+ 404: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "not-found",
+ * "message": "Not found.",
+ * "status": 404
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ };
+ };
+ createWebsiteGoal: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ /** @description ID of the website. */
+ websiteId: string;
+ };
+ cookie?: never;
+ };
+ requestBody: {
+ content: {
+ 'application/json': {
+ /** @description Description of the resource. */
+ description?: string;
+ /** @description Display name of the resource. */
+ name: string;
+ /** @description Configuration parameters for the resource. */
+ parameters: {
+ type: string;
+ value: string;
+ };
+ };
+ };
+ };
+ responses: {
+ /** @description The operation completed successfully. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ 'application/json': {
+ /**
+ * @description Whether the operation succeeded.
+ * @constant
+ */
+ ok: true;
+ };
+ };
+ };
+ /** @description Bad request. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "bad-request",
+ * "message": "Bad request.",
+ * "status": 400
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Unauthorized. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "unauthorized",
+ * "message": "Unauthorized.",
+ * "status": 401
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Not found. */
+ 404: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "not-found",
+ * "message": "Not found.",
+ * "status": 404
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ };
+ };
+ getWebsiteGoal: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ goalId: string;
+ /** @description ID of the website. */
+ websiteId: string;
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The operation completed successfully. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ 'application/json': {
+ /**
+ * @description Whether the operation succeeded.
+ * @constant
+ */
+ ok: true;
+ };
+ };
+ };
+ /** @description Bad request. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "bad-request",
+ * "message": "Bad request.",
+ * "status": 400
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Unauthorized. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "unauthorized",
+ * "message": "Unauthorized.",
+ * "status": 401
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Not found. */
+ 404: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "not-found",
+ * "message": "Not found.",
+ * "status": 404
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ };
+ };
+ updateWebsiteGoal: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ goalId: string;
+ /** @description ID of the website. */
+ websiteId: string;
+ };
+ cookie?: never;
+ };
+ requestBody: {
+ content: {
+ 'application/json': {
+ /** @description Description of the resource. */
+ description?: string;
+ /** @description Display name of the resource. */
+ name: string;
+ /** @description Configuration parameters for the resource. */
+ parameters: {
+ type: string;
+ value: string;
+ };
+ };
+ };
+ };
+ responses: {
+ /** @description The operation completed successfully. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ 'application/json': {
+ /**
+ * @description Whether the operation succeeded.
+ * @constant
+ */
+ ok: true;
+ };
+ };
+ };
+ /** @description Bad request. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "bad-request",
+ * "message": "Bad request.",
+ * "status": 400
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Unauthorized. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "unauthorized",
+ * "message": "Unauthorized.",
+ * "status": 401
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Not found. */
+ 404: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "not-found",
+ * "message": "Not found.",
+ * "status": 404
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ };
+ };
+ deleteWebsiteGoal: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ goalId: string;
+ /** @description ID of the website. */
+ websiteId: string;
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description Deleted successfully. */
200: {
headers: {
[name: string]: unknown;
};
content: {
- 'application/json': {
- /** @description Data type of the custom property. */
- dataType: number;
- /** @description Name of the custom event or session property. */
- propertyName: string;
- total: number;
- }[];
+ 'application/json': components['schemas']['Ok'];
};
};
/** @description Bad request. */
@@ -15616,9 +18424,27 @@ export interface operations {
'application/json': components['schemas']['ApiError'];
};
};
+ /** @description Not found. */
+ 404: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "not-found",
+ * "message": "Not found.",
+ * "status": 404
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
};
};
- getEventDataProperties: {
+ getWebsiteSavedGoalStats: {
parameters: {
query: {
/** @description Browser used by the visitor. */
@@ -15663,8 +18489,12 @@ export interface operations {
startAt: number;
/** @description Tag attached to the tracked activity. */
tag?: string;
+ /** @description IANA time zone used to interpret dates and group results, for example America/New_York. */
+ timezone?: string;
/** @description Filter by page title. */
title?: string;
+ /** @description Time interval used to group results: minute, hour, day, month, or year. */
+ unit?: string;
/** @description UTM campaign name. */
utmCampaign?: string;
/** @description UTM campaign content. */
@@ -15678,6 +18508,7 @@ export interface operations {
};
header?: never;
path: {
+ goalId: string;
/** @description ID of the website. */
websiteId: string;
};
@@ -15692,14 +18523,9 @@ export interface operations {
};
content: {
'application/json': {
- /** @description Data type of the custom property. */
- dataType: number;
- /** @description Name of the custom event. */
- eventName: string;
- /** @description Name of the custom event or session property. */
- propertyName: string;
+ num: number;
total: number;
- }[];
+ };
};
};
/** @description Bad request. */
@@ -15738,9 +18564,27 @@ export interface operations {
'application/json': components['schemas']['ApiError'];
};
};
+ /** @description Not found. */
+ 404: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "not-found",
+ * "message": "Not found.",
+ * "status": 404
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
};
};
- getEventDataStats: {
+ getWebsiteGoalStats: {
parameters: {
query: {
/** @description Browser used by the visitor. */
@@ -15785,8 +18629,14 @@ export interface operations {
startAt: number;
/** @description Tag attached to the tracked activity. */
tag?: string;
+ /** @description IANA time zone used to interpret dates and group results, for example America/New_York. */
+ timezone?: string;
/** @description Filter by page title. */
title?: string;
+ /** @description Type of resource or analytics dimension to return. */
+ type: string;
+ /** @description Time interval used to group results: minute, hour, day, month, or year. */
+ unit?: string;
/** @description UTM campaign name. */
utmCampaign?: string;
/** @description UTM campaign content. */
@@ -15797,6 +18647,7 @@ export interface operations {
utmSource?: string;
/** @description UTM campaign search term. */
utmTerm?: string;
+ value: string;
};
header?: never;
path: {
@@ -15814,9 +18665,8 @@ export interface operations {
};
content: {
'application/json': {
- events: number;
- properties: number;
- records: number;
+ num: number;
+ total: number;
};
};
};
@@ -15856,9 +18706,27 @@ export interface operations {
'application/json': components['schemas']['ApiError'];
};
};
+ /** @description Not found. */
+ 404: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "not-found",
+ * "message": "Not found.",
+ * "status": 404
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
};
};
- getEventDataValues: {
+ getWebsiteHeatmaps: {
parameters: {
query: {
/** @description Browser used by the visitor. */
@@ -15869,8 +18737,6 @@ export interface operations {
cohort?: string;
/** @description Country code of the visitor. */
country?: string;
- /** @description Data type of the custom property. */
- dataType?: number;
/** @description Device category used by the visitor. */
device?: string;
/** @description Custom identifier assigned to the visitor. */
@@ -15879,8 +18745,6 @@ export interface operations {
endAt: number;
/** @description Filter by custom event name. */
event?: string;
- /** @description Name of the custom event. */
- eventName?: string;
/** @description Event type: 1 for a pageview or 2 for a custom event. */
eventType?: number;
/** @description Set a non-empty value to exclude visits with only one pageview. */
@@ -15891,12 +18755,11 @@ export interface operations {
language?: string;
/** @description Whether records must match all filters or any filter. */
match?: 'all' | 'any';
+ mode?: 'click' | 'scroll';
/** @description Operating system used by the visitor. */
os?: string;
/** @description Filter by page URL path. */
path?: string;
- /** @description Name of the custom event or session property. */
- propertyName: string;
/** @description Filter by page URL query string. */
query?: string;
/** @description Filter by referring URL. */
@@ -15909,8 +18772,14 @@ export interface operations {
startAt: number;
/** @description Tag attached to the tracked activity. */
tag?: string;
+ /** @description IANA time zone used to interpret dates and group results, for example America/New_York. */
+ timezone?: string;
/** @description Filter by page title. */
title?: string;
+ /** @description Time interval used to group results: minute, hour, day, month, or year. */
+ unit?: string;
+ /** @description Path portion of the page URL. */
+ urlPath?: string;
/** @description UTM campaign name. */
utmCampaign?: string;
/** @description UTM campaign content. */
@@ -15938,9 +18807,72 @@ export interface operations {
};
content: {
'application/json': {
- total: number;
- value: string;
- }[];
+ mode: 'click' | 'scroll';
+ pages: {
+ /** @description Number of matching records. */
+ count: number;
+ sessions: number;
+ /** @description Path portion of the page URL. */
+ urlPath: string;
+ }[];
+ points: {
+ /** @description Number of matching records. */
+ count: number;
+ /** @description Page height in pixels. */
+ pageH: number;
+ /** @description Page width in pixels. */
+ pageW: number;
+ /** @description Horizontal position on the page in pixels. */
+ pageX: number;
+ /** @description Vertical position on the page in pixels. */
+ pageY: number;
+ /** @description Viewport height in pixels. */
+ viewportH: number;
+ /** @description Viewport width in pixels. */
+ viewportW: number;
+ x: number;
+ y: number;
+ }[];
+ scroll: {
+ buckets: {
+ depth: number;
+ /** @description Page height in pixels. */
+ pageH: number;
+ /** @description Page width in pixels. */
+ pageW: number;
+ sessions: number;
+ /** @description Viewport height in pixels. */
+ viewportH: number;
+ /** @description Viewport width in pixels. */
+ viewportW: number;
+ }[];
+ /** @description Page height in pixels. */
+ pageH: number;
+ /** @description Page width in pixels. */
+ pageW: number;
+ totalSessions: number;
+ /** @description Viewport height in pixels. */
+ viewportH: number;
+ /** @description Viewport width in pixels. */
+ viewportW: number;
+ };
+ snapshot: {
+ /** @description Unique identifier of the resource. */
+ id: string;
+ /** @constant */
+ kind: 'iframe';
+ /** @description Page height in pixels. */
+ pageH: number;
+ /** @description Page width in pixels. */
+ pageW: number;
+ /** @description URL associated with the resource. */
+ url: string;
+ /** @description Viewport height in pixels. */
+ viewportH: number;
+ /** @description Viewport width in pixels. */
+ viewportW: number;
+ };
+ };
};
};
/** @description Bad request. */
@@ -15979,19 +18911,35 @@ export interface operations {
'application/json': components['schemas']['ApiError'];
};
};
+ /** @description Not found. */
+ 404: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "not-found",
+ * "message": "Not found.",
+ * "status": 404
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
};
};
- getWebsiteEvents: {
+ getWebsiteJourneys: {
parameters: {
- query?: {
+ query: {
/** @description Browser used by the visitor. */
browser?: string;
/** @description City of the visitor. */
city?: string;
/** @description ID of a saved cohort used to filter visitors. */
cohort?: string;
- /** @description Comparison period: prev for the previous period or yoy for the same period last year. */
- compare?: 'prev' | 'yoy';
/** @description Country code of the visitor. */
country?: string;
/** @description Device category used by the visitor. */
@@ -15999,9 +18947,8 @@ export interface operations {
/** @description Custom identifier assigned to the visitor. */
distinctId?: string;
/** @description End of the date range as a Unix timestamp in milliseconds. */
- endAt?: number;
- /** @description End of the date range as an ISO 8601 date or date-time. */
- endDate?: string;
+ endAt: number;
+ endStep?: string;
/** @description Filter by custom event name. */
event?: string;
/** @description Event type: 1 for a pageview or 2 for a custom event. */
@@ -16014,14 +18961,8 @@ export interface operations {
language?: string;
/** @description Whether records must match all filters or any filter. */
match?: 'all' | 'any';
- /** @description Maximum number of results to include. */
- maxResults?: number;
/** @description Operating system used by the visitor. */
os?: string;
- /** @description Page number, starting at 1. */
- page?: number;
- /** @description Number of results per page. */
- pageSize?: number;
/** @description Filter by page URL path. */
path?: string;
/** @description Filter by page URL query string. */
@@ -16030,14 +18971,12 @@ export interface operations {
referrer?: string;
/** @description Region or subdivision of the visitor. */
region?: string;
- /** @description Search text used to filter results. */
- search?: string;
/** @description ID of a saved segment used to filter results. */
segment?: string;
/** @description Start of the date range as a Unix timestamp in milliseconds. */
- startAt?: number;
- /** @description Start of the date range as an ISO 8601 date or date-time. */
- startDate?: string;
+ startAt: number;
+ startStep?: string;
+ steps: number;
/** @description Tag attached to the tracked activity. */
tag?: string;
/** @description IANA time zone used to interpret dates and group results, for example America/New_York. */
@@ -16059,20 +18998,24 @@ export interface operations {
};
header?: never;
path: {
- /** @description Website ID. */
+ /** @description ID of the website. */
websiteId: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
- /** @description A page of events. */
+ /** @description Analytics results. */
200: {
headers: {
[name: string]: unknown;
};
content: {
- 'application/json': components['schemas']['WebsiteEventPage'];
+ 'application/json': {
+ /** @description Number of matching records. */
+ count: number;
+ items: string[];
+ }[];
};
};
/** @description Bad request. */
@@ -16111,9 +19054,27 @@ export interface operations {
'application/json': components['schemas']['ApiError'];
};
};
+ /** @description Not found. */
+ 404: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "not-found",
+ * "message": "Not found.",
+ * "status": 404
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
};
};
- getWebsiteEventSeries: {
+ getWebsiteMetrics: {
parameters: {
query: {
/** @description Browser used by the visitor. */
@@ -16122,6 +19083,8 @@ export interface operations {
city?: string;
/** @description ID of a saved cohort used to filter visitors. */
cohort?: string;
+ /** @description Comparison period: prev for the previous period or yoy for the same period last year. */
+ compare?: 'prev' | 'yoy';
/** @description Country code of the visitor. */
country?: string;
/** @description Device category used by the visitor. */
@@ -16129,7 +19092,9 @@ export interface operations {
/** @description Custom identifier assigned to the visitor. */
distinctId?: string;
/** @description End of the date range as a Unix timestamp in milliseconds. */
- endAt: number;
+ endAt?: number;
+ /** @description End of the date range as an ISO 8601 date or date-time. */
+ endDate?: string;
/** @description Filter by custom event name. */
event?: string;
/** @description Event type: 1 for a pageview or 2 for a custom event. */
@@ -16144,6 +19109,8 @@ export interface operations {
limit?: number;
/** @description Whether records must match all filters or any filter. */
match?: 'all' | 'any';
+ /** @description Number of rows to skip before returning results. */
+ offset?: number;
/** @description Operating system used by the visitor. */
os?: string;
/** @description Filter by page URL path. */
@@ -16154,16 +19121,22 @@ export interface operations {
referrer?: string;
/** @description Region or subdivision of the visitor. */
region?: string;
+ /** @description Search text used to filter results. */
+ search?: string;
/** @description ID of a saved segment used to filter results. */
segment?: string;
/** @description Start of the date range as a Unix timestamp in milliseconds. */
- startAt: number;
+ startAt?: number;
+ /** @description Start of the date range as an ISO 8601 date or date-time. */
+ startDate?: string;
/** @description Tag attached to the tracked activity. */
tag?: string;
/** @description IANA time zone used to interpret dates and group results, for example America/New_York. */
- timezone: string;
+ timezone?: string;
/** @description Filter by page title. */
title?: string;
+ /** @description Dimension to rank: path, entry, exit, title, query, hostname, referrer, domain, channel, event, tag, browser, os, device, screen, language, country, region, city, distinctId, utmSource, utmMedium, utmCampaign, utmContent, utmTerm. */
+ type: string;
/** @description Time interval used to group results: minute, hour, day, month, or year. */
unit?: string;
/** @description UTM campaign name. */
@@ -16179,24 +19152,20 @@ export interface operations {
};
header?: never;
path: {
- /** @description ID of the website. */
+ /** @description Website ID. */
websiteId: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
- /** @description The operation completed successfully. */
+ /** @description Ranked rows. */
200: {
headers: {
[name: string]: unknown;
};
content: {
- 'application/json': {
- t: string;
- x: string;
- y: number;
- }[];
+ 'application/json': components['schemas']['MetricRows'];
};
};
/** @description Bad request. */
@@ -16237,9 +19206,9 @@ export interface operations {
};
};
};
- getWebsiteEventStats: {
+ getWebsiteExpandedMetrics: {
parameters: {
- query?: {
+ query: {
/** @description Browser used by the visitor. */
browser?: string;
/** @description City of the visitor. */
@@ -16268,8 +19237,12 @@ export interface operations {
hostname?: string;
/** @description Preferred language reported by the visitor browser. */
language?: string;
+ /** @description Maximum number of rows to return. */
+ limit?: number;
/** @description Whether records must match all filters or any filter. */
match?: 'all' | 'any';
+ /** @description Number of rows to skip before returning results. */
+ offset?: number;
/** @description Operating system used by the visitor. */
os?: string;
/** @description Filter by page URL path. */
@@ -16280,6 +19253,8 @@ export interface operations {
referrer?: string;
/** @description Region or subdivision of the visitor. */
region?: string;
+ /** @description Search text used to filter results. */
+ search?: string;
/** @description ID of a saved segment used to filter results. */
segment?: string;
/** @description Start of the date range as a Unix timestamp in milliseconds. */
@@ -16292,6 +19267,8 @@ export interface operations {
timezone?: string;
/** @description Filter by page title. */
title?: string;
+ /** @description Type of resource or analytics dimension to return. */
+ type: string;
/** @description Time interval used to group results: minute, hour, day, month, or year. */
unit?: string;
/** @description UTM campaign name. */
@@ -16321,21 +19298,19 @@ export interface operations {
};
content: {
'application/json': {
- /** @description Data returned by the operation. */
- data: {
- /** @description Analytics for the comparison period. */
- comparison: {
- events: number;
- /** @description Number of unique events. */
- uniqueEvents: number;
- /** @description Unique visitor counts for the selected period. */
- visitors: number;
- /** @description Visit counts for the selected period. */
- visits: number;
- }[];
- length: number;
- };
- };
+ /** @description Number of visits with only one pageview. */
+ bounces: number;
+ /** @description Display name of the resource. */
+ name: string;
+ /** @description Pageview counts for the selected period. */
+ pageviews: number;
+ /** @description Total visit duration in seconds. */
+ totaltime: number;
+ /** @description Unique visitor counts for the selected period. */
+ visitors: number;
+ /** @description Visit counts for the selected period. */
+ visits: number;
+ }[];
};
};
/** @description Bad request. */
@@ -16376,48 +19351,90 @@ export interface operations {
};
};
};
- exportWebsite: {
+ getWebsitePageviews: {
parameters: {
query?: {
+ /** @description Browser used by the visitor. */
+ browser?: string;
+ /** @description City of the visitor. */
+ city?: string;
+ /** @description ID of a saved cohort used to filter visitors. */
+ cohort?: string;
/** @description Comparison period: prev for the previous period or yoy for the same period last year. */
compare?: 'prev' | 'yoy';
+ /** @description Country code of the visitor. */
+ country?: string;
+ /** @description Device category used by the visitor. */
+ device?: string;
+ /** @description Custom identifier assigned to the visitor. */
+ distinctId?: string;
/** @description End of the date range as a Unix timestamp in milliseconds. */
endAt?: number;
/** @description End of the date range as an ISO 8601 date or date-time. */
endDate?: string;
- /** @description Maximum number of results to include. */
- maxResults?: number;
- /** @description Page number, starting at 1. */
- page?: number;
- /** @description Number of results per page. */
- pageSize?: number;
+ /** @description Filter by custom event name. */
+ event?: string;
+ /** @description Event type: 1 for a pageview or 2 for a custom event. */
+ eventType?: number;
+ /** @description Set a non-empty value to exclude visits with only one pageview. */
+ excludeBounce?: string;
+ /** @description Hostname on which the activity occurred. */
+ hostname?: string;
+ /** @description Preferred language reported by the visitor browser. */
+ language?: string;
+ /** @description Whether records must match all filters or any filter. */
+ match?: 'all' | 'any';
+ /** @description Operating system used by the visitor. */
+ os?: string;
+ /** @description Filter by page URL path. */
+ path?: string;
+ /** @description Filter by page URL query string. */
+ query?: string;
+ /** @description Filter by referring URL. */
+ referrer?: string;
+ /** @description Region or subdivision of the visitor. */
+ region?: string;
+ /** @description ID of a saved segment used to filter results. */
+ segment?: string;
/** @description Start of the date range as a Unix timestamp in milliseconds. */
startAt?: number;
/** @description Start of the date range as an ISO 8601 date or date-time. */
startDate?: string;
+ /** @description Tag attached to the tracked activity. */
+ tag?: string;
/** @description IANA time zone used to interpret dates and group results, for example America/New_York. */
timezone?: string;
+ /** @description Filter by page title. */
+ title?: string;
/** @description Time interval used to group results: minute, hour, day, month, or year. */
unit?: string;
+ /** @description UTM campaign name. */
+ utmCampaign?: string;
+ /** @description UTM campaign content. */
+ utmContent?: string;
+ /** @description UTM campaign medium. */
+ utmMedium?: string;
+ /** @description UTM campaign source. */
+ utmSource?: string;
+ /** @description UTM campaign search term. */
+ utmTerm?: string;
};
header?: never;
path: {
- /** @description ID of the website. */
+ /** @description Website ID. */
websiteId: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
- /** @description The operation completed successfully. */
+ /** @description Time series. */
200: {
headers: {
[name: string]: unknown;
};
content: {
- 'application/json': {
- zip: string;
- };
+ 'application/json': components['schemas']['WebsitePageviews'];
};
};
/** @description Bad request. */
@@ -16456,18 +19473,9 @@ export interface operations {
'application/json': components['schemas']['ApiError'];
};
};
- /** @description Successful response. The response shape is inferred as free-form because the handler does not expose a reusable response schema. */
- 'function toString() { [native code] }': {
- headers: {
- [name: string]: unknown;
- };
- content: {
- 'application/json': unknown;
- };
- };
};
};
- getWebsiteMetrics: {
+ getWebsitePerformanceChart: {
parameters: {
query: {
/** @description Browser used by the visitor. */
@@ -16476,8 +19484,6 @@ export interface operations {
city?: string;
/** @description ID of a saved cohort used to filter visitors. */
cohort?: string;
- /** @description Comparison period: prev for the previous period or yoy for the same period last year. */
- compare?: 'prev' | 'yoy';
/** @description Country code of the visitor. */
country?: string;
/** @description Device category used by the visitor. */
@@ -16485,9 +19491,7 @@ export interface operations {
/** @description Custom identifier assigned to the visitor. */
distinctId?: string;
/** @description End of the date range as a Unix timestamp in milliseconds. */
- endAt?: number;
- /** @description End of the date range as an ISO 8601 date or date-time. */
- endDate?: string;
+ endAt: number;
/** @description Filter by custom event name. */
event?: string;
/** @description Event type: 1 for a pageview or 2 for a custom event. */
@@ -16498,12 +19502,10 @@ export interface operations {
hostname?: string;
/** @description Preferred language reported by the visitor browser. */
language?: string;
- /** @description Maximum number of rows to return. */
- limit?: number;
/** @description Whether records must match all filters or any filter. */
match?: 'all' | 'any';
- /** @description Number of rows to skip before returning results. */
- offset?: number;
+ /** @description Numeric aggregation to calculate for the selected property. */
+ metric?: 'lcp' | 'inp' | 'cls' | 'fcp' | 'ttfb';
/** @description Operating system used by the visitor. */
os?: string;
/** @description Filter by page URL path. */
@@ -16514,22 +19516,16 @@ export interface operations {
referrer?: string;
/** @description Region or subdivision of the visitor. */
region?: string;
- /** @description Search text used to filter results. */
- search?: string;
/** @description ID of a saved segment used to filter results. */
segment?: string;
/** @description Start of the date range as a Unix timestamp in milliseconds. */
- startAt?: number;
- /** @description Start of the date range as an ISO 8601 date or date-time. */
- startDate?: string;
+ startAt: number;
/** @description Tag attached to the tracked activity. */
tag?: string;
/** @description IANA time zone used to interpret dates and group results, for example America/New_York. */
timezone?: string;
/** @description Filter by page title. */
title?: string;
- /** @description Dimension to rank: path, entry, exit, title, query, hostname, referrer, domain, channel, event, tag, browser, os, device, screen, language, country, region, city, distinctId, utmSource, utmMedium, utmCampaign, utmContent, utmTerm. */
- type: string;
/** @description Time interval used to group results: minute, hour, day, month, or year. */
unit?: string;
/** @description UTM campaign name. */
@@ -16545,20 +19541,27 @@ export interface operations {
};
header?: never;
path: {
- /** @description Website ID. */
+ /** @description ID of the website. */
websiteId: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
- /** @description Ranked rows. */
+ /** @description Analytics results. */
200: {
headers: {
[name: string]: unknown;
};
content: {
- 'application/json': components['schemas']['MetricRows'];
+ 'application/json': {
+ chart: {
+ p50: number;
+ p75: number;
+ p95: number;
+ t: string;
+ }[];
+ };
};
};
/** @description Bad request. */
@@ -16597,9 +19600,27 @@ export interface operations {
'application/json': components['schemas']['ApiError'];
};
};
+ /** @description Not found. */
+ 404: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "not-found",
+ * "message": "Not found.",
+ * "status": 404
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
};
};
- getWebsiteExpandedMetrics: {
+ getWebsitePerformanceMetrics: {
parameters: {
query: {
/** @description Browser used by the visitor. */
@@ -16608,8 +19629,6 @@ export interface operations {
city?: string;
/** @description ID of a saved cohort used to filter visitors. */
cohort?: string;
- /** @description Comparison period: prev for the previous period or yoy for the same period last year. */
- compare?: 'prev' | 'yoy';
/** @description Country code of the visitor. */
country?: string;
/** @description Device category used by the visitor. */
@@ -16617,9 +19636,7 @@ export interface operations {
/** @description Custom identifier assigned to the visitor. */
distinctId?: string;
/** @description End of the date range as a Unix timestamp in milliseconds. */
- endAt?: number;
- /** @description End of the date range as an ISO 8601 date or date-time. */
- endDate?: string;
+ endAt: number;
/** @description Filter by custom event name. */
event?: string;
/** @description Event type: 1 for a pageview or 2 for a custom event. */
@@ -16634,8 +19651,8 @@ export interface operations {
limit?: number;
/** @description Whether records must match all filters or any filter. */
match?: 'all' | 'any';
- /** @description Number of rows to skip before returning results. */
- offset?: number;
+ /** @description Numeric aggregation to calculate for the selected property. */
+ metric?: 'lcp' | 'inp' | 'cls' | 'fcp' | 'ttfb';
/** @description Operating system used by the visitor. */
os?: string;
/** @description Filter by page URL path. */
@@ -16646,14 +19663,10 @@ export interface operations {
referrer?: string;
/** @description Region or subdivision of the visitor. */
region?: string;
- /** @description Search text used to filter results. */
- search?: string;
/** @description ID of a saved segment used to filter results. */
segment?: string;
/** @description Start of the date range as a Unix timestamp in milliseconds. */
- startAt?: number;
- /** @description Start of the date range as an ISO 8601 date or date-time. */
- startDate?: string;
+ startAt: number;
/** @description Tag attached to the tracked activity. */
tag?: string;
/** @description IANA time zone used to interpret dates and group results, for example America/New_York. */
@@ -16661,7 +19674,7 @@ export interface operations {
/** @description Filter by page title. */
title?: string;
/** @description Type of resource or analytics dimension to return. */
- type: string;
+ type: 'path' | 'title' | 'device' | 'browser';
/** @description Time interval used to group results: minute, hour, day, month, or year. */
unit?: string;
/** @description UTM campaign name. */
@@ -16684,25 +19697,20 @@ export interface operations {
};
requestBody?: never;
responses: {
- /** @description The operation completed successfully. */
+ /** @description Analytics results. */
200: {
headers: {
[name: string]: unknown;
};
content: {
'application/json': {
- /** @description Number of visits with only one pageview. */
- bounces: number;
+ /** @description Number of matching records. */
+ count: number;
/** @description Display name of the resource. */
name: string;
- /** @description Pageview counts for the selected period. */
- pageviews: number;
- /** @description Total visit duration in seconds. */
- totaltime: number;
- /** @description Unique visitor counts for the selected period. */
- visitors: number;
- /** @description Visit counts for the selected period. */
- visits: number;
+ p50: number;
+ p75: number;
+ p95: number;
}[];
};
};
@@ -16742,19 +19750,35 @@ export interface operations {
'application/json': components['schemas']['ApiError'];
};
};
+ /** @description Not found. */
+ 404: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "not-found",
+ * "message": "Not found.",
+ * "status": 404
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
};
};
- getWebsitePageviews: {
+ getWebsitePerformanceStats: {
parameters: {
- query?: {
+ query: {
/** @description Browser used by the visitor. */
browser?: string;
/** @description City of the visitor. */
city?: string;
/** @description ID of a saved cohort used to filter visitors. */
cohort?: string;
- /** @description Comparison period: prev for the previous period or yoy for the same period last year. */
- compare?: 'prev' | 'yoy';
/** @description Country code of the visitor. */
country?: string;
/** @description Device category used by the visitor. */
@@ -16762,9 +19786,7 @@ export interface operations {
/** @description Custom identifier assigned to the visitor. */
distinctId?: string;
/** @description End of the date range as a Unix timestamp in milliseconds. */
- endAt?: number;
- /** @description End of the date range as an ISO 8601 date or date-time. */
- endDate?: string;
+ endAt: number;
/** @description Filter by custom event name. */
event?: string;
/** @description Event type: 1 for a pageview or 2 for a custom event. */
@@ -16790,9 +19812,7 @@ export interface operations {
/** @description ID of a saved segment used to filter results. */
segment?: string;
/** @description Start of the date range as a Unix timestamp in milliseconds. */
- startAt?: number;
- /** @description Start of the date range as an ISO 8601 date or date-time. */
- startDate?: string;
+ startAt: number;
/** @description Tag attached to the tracked activity. */
tag?: string;
/** @description IANA time zone used to interpret dates and group results, for example America/New_York. */
@@ -16814,20 +19834,48 @@ export interface operations {
};
header?: never;
path: {
- /** @description Website ID. */
+ /** @description ID of the website. */
websiteId: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
- /** @description Time series. */
+ /** @description Analytics results. */
200: {
headers: {
[name: string]: unknown;
};
content: {
- 'application/json': components['schemas']['WebsitePageviews'];
+ 'application/json': {
+ cls: {
+ p50: number;
+ p75: number;
+ p95: number;
+ };
+ /** @description Number of matching records. */
+ count: number;
+ fcp: {
+ p50: number;
+ p75: number;
+ p95: number;
+ };
+ inp: {
+ p50: number;
+ p75: number;
+ p95: number;
+ };
+ lcp: {
+ p50: number;
+ p75: number;
+ p95: number;
+ };
+ ttfb: {
+ p50: number;
+ p75: number;
+ p95: number;
+ };
+ };
};
};
/** @description Bad request. */
@@ -16866,6 +19914,24 @@ export interface operations {
'application/json': components['schemas']['ApiError'];
};
};
+ /** @description Not found. */
+ 404: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "not-found",
+ * "message": "Not found.",
+ * "status": 404
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
};
};
getWebsiteRecorderConfig: {
@@ -17402,72 +20468,244 @@ export interface operations {
};
content: {
'application/json': {
- /** @description Number of matching records. */
- count: number;
- /** @description Data returned by the operation. */
- data: ({
- /**
- * Format: date-time
- * @description Date and time the record was created.
- */
- createdAt: string;
- /** @description Description of the resource. */
- description: string;
- /** @description Unique identifier of the resource. */
- id: string;
- /** @description Display name of the resource. */
- name: string;
- /** @description Configuration parameters for the resource. */
- parameters:
- | string
- | number
- | false
- | true
- | {
- [key: string]:
- | string
- | number
- | false
- | true
- | unknown
- | {
- length: number;
- };
- }
- | {
- length: number;
- };
- type: string;
- /**
- * Format: date-time
- * @description Date and time the record was last updated.
- */
- updatedAt: string;
- /** @description ID of the associated user. */
- userId: string;
- /** @description ID of the website. */
- websiteId: string;
- } & {
- website?: {
- /** @description Domain name associated with the resource. */
- domain: string;
- /** @description ID of the associated user. */
- userId: string;
- };
- })[];
- /** @description Whether the results were truncated by the maximum result limit. */
- isCapped?: boolean;
- /** @description Field to sort the results by. */
- orderBy?: string;
- /** @description Page number, starting at 1. */
- page: number;
- /** @description Number of results per page. */
- pageSize: number;
- /** @description Search text used to filter results. */
- search?: string;
- /** @description Whether to sort results in descending order. */
- sortDescending?: boolean;
- };
+ /** @description Number of matching records. */
+ count: number;
+ /** @description Data returned by the operation. */
+ data: ({
+ /**
+ * Format: date-time
+ * @description Date and time the record was created.
+ */
+ createdAt: string;
+ /** @description Description of the resource. */
+ description: string;
+ /** @description Unique identifier of the resource. */
+ id: string;
+ /** @description Display name of the resource. */
+ name: string;
+ /** @description Configuration parameters for the resource. */
+ parameters:
+ | string
+ | number
+ | false
+ | true
+ | {
+ [key: string]:
+ | string
+ | number
+ | false
+ | true
+ | unknown
+ | {
+ length: number;
+ };
+ }
+ | {
+ length: number;
+ };
+ type: string;
+ /**
+ * Format: date-time
+ * @description Date and time the record was last updated.
+ */
+ updatedAt: string;
+ /** @description ID of the associated user. */
+ userId: string;
+ /** @description ID of the website. */
+ websiteId: string;
+ } & {
+ website?: {
+ /** @description Domain name associated with the resource. */
+ domain: string;
+ /** @description ID of the associated user. */
+ userId: string;
+ };
+ })[];
+ /** @description Whether the results were truncated by the maximum result limit. */
+ isCapped?: boolean;
+ /** @description Field to sort the results by. */
+ orderBy?: string;
+ /** @description Page number, starting at 1. */
+ page: number;
+ /** @description Number of results per page. */
+ pageSize: number;
+ /** @description Search text used to filter results. */
+ search?: string;
+ /** @description Whether to sort results in descending order. */
+ sortDescending?: boolean;
+ };
+ };
+ };
+ /** @description Bad request. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "bad-request",
+ * "message": "Bad request.",
+ * "status": 400
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Unauthorized. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "unauthorized",
+ * "message": "Unauthorized.",
+ * "status": 401
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ };
+ };
+ resetWebsite: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ /** @description ID of the website. */
+ websiteId: string;
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The operation completed successfully. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ 'application/json': {
+ /**
+ * @description Whether the operation succeeded.
+ * @constant
+ */
+ ok: true;
+ };
+ };
+ };
+ /** @description Unauthorized. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "unauthorized",
+ * "message": "Unauthorized.",
+ * "status": 401
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ };
+ };
+ getWebsiteRetention: {
+ parameters: {
+ query: {
+ /** @description Browser used by the visitor. */
+ browser?: string;
+ /** @description City of the visitor. */
+ city?: string;
+ /** @description ID of a saved cohort used to filter visitors. */
+ cohort?: string;
+ /** @description Country code of the visitor. */
+ country?: string;
+ /** @description Device category used by the visitor. */
+ device?: string;
+ /** @description Custom identifier assigned to the visitor. */
+ distinctId?: string;
+ /** @description End of the date range as a Unix timestamp in milliseconds. */
+ endAt: number;
+ /** @description Filter by custom event name. */
+ event?: string;
+ /** @description Event type: 1 for a pageview or 2 for a custom event. */
+ eventType?: number;
+ /** @description Set a non-empty value to exclude visits with only one pageview. */
+ excludeBounce?: string;
+ /** @description Hostname on which the activity occurred. */
+ hostname?: string;
+ /** @description Preferred language reported by the visitor browser. */
+ language?: string;
+ /** @description Whether records must match all filters or any filter. */
+ match?: 'all' | 'any';
+ /** @description Operating system used by the visitor. */
+ os?: string;
+ /** @description Filter by page URL path. */
+ path?: string;
+ /** @description Filter by page URL query string. */
+ query?: string;
+ /** @description Filter by referring URL. */
+ referrer?: string;
+ /** @description Region or subdivision of the visitor. */
+ region?: string;
+ /** @description ID of a saved segment used to filter results. */
+ segment?: string;
+ /** @description Start of the date range as a Unix timestamp in milliseconds. */
+ startAt: number;
+ /** @description Tag attached to the tracked activity. */
+ tag?: string;
+ /** @description IANA time zone used to interpret dates and group results, for example America/New_York. */
+ timezone?: string;
+ /** @description Filter by page title. */
+ title?: string;
+ /** @description Time interval used to group results: minute, hour, day, month, or year. */
+ unit?: string;
+ /** @description UTM campaign name. */
+ utmCampaign?: string;
+ /** @description UTM campaign content. */
+ utmContent?: string;
+ /** @description UTM campaign medium. */
+ utmMedium?: string;
+ /** @description UTM campaign source. */
+ utmSource?: string;
+ /** @description UTM campaign search term. */
+ utmTerm?: string;
+ };
+ header?: never;
+ path: {
+ /** @description ID of the website. */
+ websiteId: string;
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The operation completed successfully. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ 'application/json': {
+ date: string;
+ day: number;
+ percentage: number;
+ returnVisitors: number;
+ /** @description Unique visitor counts for the selected period. */
+ visitors: number;
+ }[];
};
};
/** @description Bad request. */
@@ -17506,37 +20744,8 @@ export interface operations {
'application/json': components['schemas']['ApiError'];
};
};
- };
- };
- resetWebsite: {
- parameters: {
- query?: never;
- header?: never;
- path: {
- /** @description ID of the website. */
- websiteId: string;
- };
- cookie?: never;
- };
- requestBody?: never;
- responses: {
- /** @description The operation completed successfully. */
- 200: {
- headers: {
- [name: string]: unknown;
- };
- content: {
- 'application/json': {
- /**
- * @description Whether the operation succeeded.
- * @constant
- */
- ok: true;
- };
- };
- };
- /** @description Unauthorized. */
- 401: {
+ /** @description Not found. */
+ 404: {
headers: {
[name: string]: unknown;
};
@@ -17544,9 +20753,9 @@ export interface operations {
/**
* @example {
* "error": {
- * "code": "unauthorized",
- * "message": "Unauthorized.",
- * "status": 401
+ * "code": "not-found",
+ * "message": "Not found.",
+ * "status": 404
* }
* }
*/
@@ -21156,6 +24365,148 @@ export interface operations {
};
};
};
+ getWebsiteUtmMetrics: {
+ parameters: {
+ query: {
+ /** @description Browser used by the visitor. */
+ browser?: string;
+ /** @description City of the visitor. */
+ city?: string;
+ /** @description ID of a saved cohort used to filter visitors. */
+ cohort?: string;
+ /** @description Country code of the visitor. */
+ country?: string;
+ /** @description Device category used by the visitor. */
+ device?: string;
+ /** @description Custom identifier assigned to the visitor. */
+ distinctId?: string;
+ /** @description End of the date range as a Unix timestamp in milliseconds. */
+ endAt: number;
+ /** @description Filter by custom event name. */
+ event?: string;
+ /** @description Event type: 1 for a pageview or 2 for a custom event. */
+ eventType?: number;
+ /** @description Set a non-empty value to exclude visits with only one pageview. */
+ excludeBounce?: string;
+ /** @description Hostname on which the activity occurred. */
+ hostname?: string;
+ /** @description Preferred language reported by the visitor browser. */
+ language?: string;
+ /** @description Whether records must match all filters or any filter. */
+ match?: 'all' | 'any';
+ /** @description Operating system used by the visitor. */
+ os?: string;
+ /** @description Filter by page URL path. */
+ path?: string;
+ /** @description Filter by page URL query string. */
+ query?: string;
+ /** @description Filter by referring URL. */
+ referrer?: string;
+ /** @description Region or subdivision of the visitor. */
+ region?: string;
+ /** @description ID of a saved segment used to filter results. */
+ segment?: string;
+ /** @description Start of the date range as a Unix timestamp in milliseconds. */
+ startAt: number;
+ /** @description Tag attached to the tracked activity. */
+ tag?: string;
+ /** @description IANA time zone used to interpret dates and group results, for example America/New_York. */
+ timezone?: string;
+ /** @description Filter by page title. */
+ title?: string;
+ /** @description Type of resource or analytics dimension to return. */
+ type: 'utm_source' | 'utm_medium' | 'utm_campaign' | 'utm_term' | 'utm_content';
+ /** @description Time interval used to group results: minute, hour, day, month, or year. */
+ unit?: string;
+ /** @description UTM campaign name. */
+ utmCampaign?: string;
+ /** @description UTM campaign content. */
+ utmContent?: string;
+ /** @description UTM campaign medium. */
+ utmMedium?: string;
+ /** @description UTM campaign source. */
+ utmSource?: string;
+ /** @description UTM campaign search term. */
+ utmTerm?: string;
+ };
+ header?: never;
+ path: {
+ /** @description ID of the website. */
+ websiteId: string;
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description Analytics results. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ 'application/json': {
+ utm: string;
+ /** @description Pageview counts for the selected period. */
+ views: number;
+ }[];
+ };
+ };
+ /** @description Bad request. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "bad-request",
+ * "message": "Bad request.",
+ * "status": 400
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Unauthorized. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "unauthorized",
+ * "message": "Unauthorized.",
+ * "status": 401
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ /** @description Not found. */
+ 404: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ /**
+ * @example {
+ * "error": {
+ * "code": "not-found",
+ * "message": "Not found.",
+ * "status": 404
+ * }
+ * }
+ */
+ 'application/json': components['schemas']['ApiError'];
+ };
+ };
+ };
+ };
getWebsiteValues: {
parameters: {
query: {
diff --git a/packages/mcp/src/server.test.ts b/packages/mcp/src/server.test.ts
index ce2d9f3d0..835764ad6 100644
--- a/packages/mcp/src/server.test.ts
+++ b/packages/mcp/src/server.test.ts
@@ -159,7 +159,7 @@ describe('createUmamiMcpServer', () => {
return { body: [{ dataKey: 'plan', stringValue: 'pro' }] };
}
- if (path === '/api/reports/funnel') {
+ if (path === `/api/websites/${WEBSITE_ID}/funnels/stats`) {
return {
body: [
{
@@ -184,6 +184,25 @@ describe('createUmamiMcpServer', () => {
};
}
+ if (path === `/api/websites/${WEBSITE_ID}/revenue/stats`) {
+ return {
+ body: {
+ sum: 100,
+ count: 2,
+ average: 50,
+ unique_count: 2,
+ arpu: 50,
+ comparison: { sum: 80 },
+ },
+ };
+ }
+ if (path === `/api/websites/${WEBSITE_ID}/revenue/chart`) {
+ return { body: { chart: [{ t: '2024-01-01', sum: 100 }] } };
+ }
+ if (path === `/api/websites/${WEBSITE_ID}/revenue/metrics`) {
+ return { body: [{ name: url.searchParams.get('type'), value: 100 }] };
+ }
+
if (path.startsWith('/api/websites/')) {
return {
status: 401,
@@ -379,7 +398,7 @@ describe('createUmamiMcpServer', () => {
});
});
- test('run_funnel posts a typed report body', async () => {
+ test('run_funnel sends structured criteria with GET', async () => {
const result = await harness.client.callTool({
name: 'run_funnel',
arguments: {
@@ -401,11 +420,43 @@ describe('createUmamiMcpServer', () => {
],
});
- const body = JSON.parse(harness.calls[0].init?.body as string);
+ const { url, init } = harness.calls[0];
+ expect(init?.method).toBe('GET');
+ expect(init?.body).toBeUndefined();
+ expect(url.pathname).toBe(`/api/websites/${WEBSITE_ID}/funnels/stats`);
+ expect(JSON.parse(url.searchParams.get('steps')!)).toHaveLength(2);
+ expect(url.searchParams.get('window')).toBe('60');
+ expect(Number(url.searchParams.get('startAt'))).toBeGreaterThan(0);
+ });
- expect(body).toMatchObject({ websiteId: WEBSITE_ID, type: 'funnel' });
- expect(body.parameters.steps).toHaveLength(2);
- expect(body.parameters.window).toBe(60);
+ test('get_revenue composes feature APIs without changing its tool output', async () => {
+ const result = await harness.client.callTool({
+ name: 'get_revenue',
+ arguments: {
+ websiteId: WEBSITE_ID,
+ startAt: '2024-01-01',
+ endAt: '2024-01-31',
+ currency: 'eur',
+ filters: { browser: 'Chrome' },
+ },
+ });
+ expect(result.isError).toBeFalsy();
+ expect(result.structuredContent).toMatchObject({
+ currency: 'EUR',
+ total: { sum: 100, comparison: { sum: 80 } },
+ chart: [{ sum: 100 }],
+ byCountry: [{ name: 'country', value: 100 }],
+ byRegion: [{ name: 'region' }],
+ byReferrer: [{ name: 'referrer' }],
+ byChannel: [{ name: 'channel' }],
+ });
+ expect(harness.calls).toHaveLength(6);
+ for (const { url, init } of harness.calls) {
+ expect(init?.method).toBe('GET');
+ expect(url.pathname).toContain(`/websites/${WEBSITE_ID}/revenue/`);
+ expect(url.searchParams.get('currency')).toBe('EUR');
+ expect(url.searchParams.get('startAt')).toBe(String(Date.parse('2024-01-01')));
+ }
});
test('maps unauthorized website access to a helpful error', async () => {
diff --git a/packages/mcp/src/tools/reports.ts b/packages/mcp/src/tools/reports.ts
index 1bba6bbbb..3d060d82f 100644
--- a/packages/mcp/src/tools/reports.ts
+++ b/packages/mcp/src/tools/reports.ts
@@ -1,17 +1,10 @@
import { z } from 'zod';
-import { dateRangeInput, parseDateRange, timeUnit, timezone, toReportDates } from '../lib/dates';
+import { dateRangeInput, parseDateRange, timeUnit, timezone } from '../lib/dates';
import { filtersSchema, toFilterParams } from '../lib/filters';
import { defineTool } from '../lib/tool';
const websiteId = z.string().uuid().describe('Website ID from list_websites.');
-function reportFilters(
- range: { startAt: number; endAt: number },
- filters?: z.infer<typeof filtersSchema>,
-) {
- return { startAt: range.startAt, endAt: range.endAt, ...toFilterParams(filters) };
-}
-
function isoRange(range: { startAt: number; endAt: number }) {
return {
startAt: new Date(range.startAt).toISOString(),
@@ -57,15 +50,12 @@ export const runFunnel = defineTool({
}),
async handler(input, { client }) {
const range = parseDateRange(input);
- const result = await client.runFunnelReport({
+ const result = await client.getWebsiteFunnelStats({
websiteId: input.websiteId,
- type: 'funnel',
- filters: reportFilters(range, input.filters),
- parameters: {
- ...toReportDates(range),
- window: input.windowMinutes ?? 60,
- steps: input.steps,
- },
+ ...range,
+ ...toFilterParams(input.filters),
+ window: input.windowMinutes ?? 60,
+ steps: JSON.stringify(input.steps),
});
return {
@@ -112,16 +102,13 @@ export const runJourney = defineTool({
}),
async handler(input, { client }) {
const range = parseDateRange(input);
- const result = await client.runJourneyReport({
+ const result = await client.getWebsiteJourneys({
websiteId: input.websiteId,
- type: 'journey',
- filters: reportFilters(range, input.filters),
- parameters: {
- ...toReportDates(range),
- steps: input.steps ?? 3,
- startStep: input.startStep,
- endStep: input.endStep,
- },
+ ...range,
+ ...toFilterParams(input.filters),
+ steps: input.steps ?? 3,
+ startStep: input.startStep,
+ endStep: input.endStep,
});
return {
@@ -153,11 +140,11 @@ export const runRetention = defineTool({
}),
async handler(input, { client }) {
const range = parseDateRange(input);
- const result = await client.runRetentionReport({
+ const result = await client.getWebsiteRetention({
websiteId: input.websiteId,
- type: 'retention',
- filters: reportFilters(range, input.filters),
- parameters: { ...toReportDates(range), timezone: input.timezone },
+ ...range,
+ ...toFilterParams(input.filters),
+ timezone: input.timezone,
});
return {
@@ -209,16 +196,13 @@ export const runAttribution = defineTool({
}),
async handler(input, { client }) {
const range = parseDateRange(input);
- const result = (await client.runAttributionReport({
+ const result = (await client.getWebsiteAttribution({
websiteId: input.websiteId,
- type: 'attribution',
- filters: reportFilters(range, input.filters),
- parameters: {
- ...toReportDates(range),
- model: input.model ?? 'last-click',
- type: input.conversionType,
- step: input.conversion,
- },
+ ...range,
+ ...toFilterParams(input.filters),
+ model: input.model ?? 'last-click',
+ type: input.conversionType,
+ step: input.conversion,
})) as Record<string, unknown>;
const list = (value: unknown) =>
@@ -262,17 +246,23 @@ export const getRevenue = defineTool({
}),
async handler(input, { client }) {
const range = parseDateRange(input);
- const result = (await client.runRevenueReport({
+ const params = {
websiteId: input.websiteId,
- type: 'revenue',
- filters: reportFilters(range, input.filters),
- parameters: {
- ...toReportDates(range),
- currency: (input.currency ?? 'USD').toUpperCase(),
- unit: input.unit,
- timezone: input.timezone,
- },
- })) as Record<string, unknown>;
+ ...range,
+ ...toFilterParams(input.filters),
+ currency: (input.currency ?? 'USD').toUpperCase(),
+ unit: input.unit,
+ timezone: input.timezone,
+ };
+ const [total, chart, country, region, referrer, channel] = await Promise.all([
+ client.getWebsiteRevenueStats(params),
+ client.getWebsiteRevenueChart(params),
+ client.getWebsiteRevenueMetrics({ ...params, type: 'country' }),
+ client.getWebsiteRevenueMetrics({ ...params, type: 'region' }),
+ client.getWebsiteRevenueMetrics({ ...params, type: 'referrer' }),
+ client.getWebsiteRevenueMetrics({ ...params, type: 'channel' }),
+ ]);
+ const result = { total, chart: chart.chart, country, region, referrer, channel };
return {
websiteId: input.websiteId,
diff --git a/src/app/api/websites/[websiteId]/attribution/contract.ts b/src/app/api/websites/[websiteId]/attribution/contract.ts
new file mode 100644
index 000000000..086d30061
--- /dev/null
+++ b/src/app/api/websites/[websiteId]/attribution/contract.ts
@@ -0,0 +1,166 @@
+import { z } from 'zod';
+import { defineOperation } from '@/openapi/operation';
+import { badRequestResponse, unauthorizedResponse, notFoundResponse } from '@/openapi/schemas';
+import { attributionQuerySchema } from '@/lib/analytics-schema';
+
+export const operations = [
+ defineOperation({
+ method: 'get',
+ path: '/api/websites/{websiteId}/attribution',
+ audience: 'public',
+ auth: 'bearer-or-share',
+ operation: {
+ operationId: 'getWebsiteAttribution',
+ summary: 'Get website attribution',
+ tags: ['Websites'],
+ requestParams: { path: z.object({ websiteId: z.uuid() }), query: attributionQuerySchema },
+ responses: {
+ '200': {
+ description: 'The operation completed successfully.',
+ content: {
+ 'application/json': {
+ schema: {
+ type: 'object',
+ properties: {
+ referrer: {
+ type: 'array',
+ items: {
+ type: 'object',
+ properties: {
+ name: {
+ type: 'string',
+ },
+ value: {
+ type: 'number',
+ },
+ },
+ required: ['name', 'value'],
+ },
+ },
+ paidAds: {
+ type: 'array',
+ items: {
+ type: 'object',
+ properties: {
+ name: {
+ type: 'string',
+ },
+ value: {
+ type: 'number',
+ },
+ },
+ required: ['name', 'value'],
+ },
+ },
+ utm_source: {
+ type: 'array',
+ items: {
+ type: 'object',
+ properties: {
+ name: {
+ type: 'string',
+ },
+ value: {
+ type: 'number',
+ },
+ },
+ required: ['name', 'value'],
+ },
+ },
+ utm_medium: {
+ type: 'array',
+ items: {
+ type: 'object',
+ properties: {
+ name: {
+ type: 'string',
+ },
+ value: {
+ type: 'number',
+ },
+ },
+ required: ['name', 'value'],
+ },
+ },
+ utm_campaign: {
+ type: 'array',
+ items: {
+ type: 'object',
+ properties: {
+ name: {
+ type: 'string',
+ },
+ value: {
+ type: 'number',
+ },
+ },
+ required: ['name', 'value'],
+ },
+ },
+ utm_content: {
+ type: 'array',
+ items: {
+ type: 'object',
+ properties: {
+ name: {
+ type: 'string',
+ },
+ value: {
+ type: 'number',
+ },
+ },
+ required: ['name', 'value'],
+ },
+ },
+ utm_term: {
+ type: 'array',
+ items: {
+ type: 'object',
+ properties: {
+ name: {
+ type: 'string',
+ },
+ value: {
+ type: 'number',
+ },
+ },
+ required: ['name', 'value'],
+ },
+ },
+ total: {
+ type: 'object',
+ properties: {
+ pageviews: {
+ type: 'number',
+ },
+ visitors: {
+ type: 'number',
+ },
+ visits: {
+ type: 'number',
+ },
+ },
+ required: ['pageviews', 'visitors', 'visits'],
+ },
+ },
+ required: [
+ 'referrer',
+ 'paidAds',
+ 'utm_source',
+ 'utm_medium',
+ 'utm_campaign',
+ 'utm_content',
+ 'utm_term',
+ 'total',
+ ],
+ },
+ },
+ },
+ },
+ '400': badRequestResponse,
+ '401': unauthorizedResponse,
+ '404': notFoundResponse,
+ },
+ },
+ }),
+] as const;
diff --git a/src/app/api/websites/[websiteId]/breakdown/contract.ts b/src/app/api/websites/[websiteId]/breakdown/contract.ts
new file mode 100644
index 000000000..7bd3aa5fa
--- /dev/null
+++ b/src/app/api/websites/[websiteId]/breakdown/contract.ts
@@ -0,0 +1,65 @@
+import { z } from 'zod';
+import { defineOperation } from '@/openapi/operation';
+import { badRequestResponse, unauthorizedResponse, notFoundResponse } from '@/openapi/schemas';
+import { breakdownQuerySchema } from '@/lib/analytics-schema';
+
+export const operations = [
+ defineOperation({
+ method: 'get',
+ path: '/api/websites/{websiteId}/breakdown',
+ audience: 'public',
+ auth: 'bearer-or-share',
+ operation: {
+ operationId: 'getWebsiteBreakdown',
+ summary: 'Get website breakdown',
+ tags: ['Websites'],
+ requestParams: { path: z.object({ websiteId: z.uuid() }), query: breakdownQuerySchema },
+ responses: {
+ '200': {
+ description: 'The operation completed successfully.',
+ content: {
+ 'application/json': {
+ schema: {
+ type: 'array',
+ items: {
+ type: 'object',
+ properties: {
+ views: {
+ type: 'number',
+ },
+ visitors: {
+ type: 'number',
+ },
+ visits: {
+ type: 'number',
+ },
+ bounces: {
+ type: 'number',
+ },
+ totaltime: {
+ type: 'number',
+ },
+ },
+ required: ['views', 'visitors', 'visits', 'bounces', 'totaltime'],
+ additionalProperties: {
+ anyOf: [
+ {
+ type: 'string',
+ },
+ {
+ type: 'number',
+ },
+ ],
+ },
+ },
+ },
+ },
+ },
+ },
+ '400': badRequestResponse,
+ '401': unauthorizedResponse,
+ '404': notFoundResponse,
+ },
+ },
+ }),
+] as const;
diff --git a/src/app/api/websites/[websiteId]/funnels/[funnelId]/contract.ts b/src/app/api/websites/[websiteId]/funnels/[funnelId]/contract.ts
new file mode 100644
index 000000000..f9781da1c
--- /dev/null
+++ b/src/app/api/websites/[websiteId]/funnels/[funnelId]/contract.ts
@@ -0,0 +1,101 @@
+import { z } from 'zod';
+import { defineOperation } from '@/openapi/operation';
+import {
+ badRequestResponse,
+ unauthorizedResponse,
+ notFoundResponse,
+ jsonResponse,
+ okSchema,
+} from '@/openapi/schemas';
+import { funnelDefinitionSchema } from '@/lib/analytics-schema';
+
+export const operations = [
+ defineOperation({
+ method: 'get',
+ path: '/api/websites/{websiteId}/funnels/{funnelId}',
+ audience: 'public',
+ auth: 'bearer-or-share',
+ operation: {
+ operationId: 'getWebsiteFunnel',
+ summary: 'Get website funnel',
+ tags: ['Websites'],
+ requestParams: { path: z.object({ websiteId: z.uuid(), funnelId: z.uuid() }) },
+ responses: {
+ '200': {
+ description: 'The operation completed successfully.',
+ content: {
+ 'application/json': {
+ schema: {
+ type: 'object',
+ properties: {
+ ok: {
+ const: true,
+ },
+ },
+ required: ['ok'],
+ },
+ },
+ },
+ },
+ '400': badRequestResponse,
+ '401': unauthorizedResponse,
+ '404': notFoundResponse,
+ },
+ },
+ }),
+ defineOperation({
+ method: 'post',
+ path: '/api/websites/{websiteId}/funnels/{funnelId}',
+ audience: 'public',
+ auth: 'bearer',
+ operation: {
+ operationId: 'updateWebsiteFunnel',
+ summary: 'Update website funnel',
+ tags: ['Websites'],
+ requestParams: { path: z.object({ websiteId: z.uuid(), funnelId: z.uuid() }) },
+ requestBody: {
+ required: true,
+ content: { 'application/json': { schema: funnelDefinitionSchema } },
+ },
+ responses: {
+ '200': {
+ description: 'The operation completed successfully.',
+ content: {
+ 'application/json': {
+ schema: {
+ type: 'object',
+ properties: {
+ ok: {
+ const: true,
+ },
+ },
+ required: ['ok'],
+ },
+ },
+ },
+ },
+ '400': badRequestResponse,
+ '401': unauthorizedResponse,
+ '404': notFoundResponse,
+ },
+ },
+ }),
+ defineOperation({
+ method: 'delete',
+ path: '/api/websites/{websiteId}/funnels/{funnelId}',
+ audience: 'public',
+ auth: 'bearer',
+ operation: {
+ operationId: 'deleteWebsiteFunnel',
+ summary: 'Delete website funnel',
+ tags: ['Websites'],
+ requestParams: { path: z.object({ websiteId: z.uuid(), funnelId: z.uuid() }) },
+ responses: {
+ '200': jsonResponse(okSchema, 'Deleted successfully.'),
+ '400': badRequestResponse,
+ '401': unauthorizedResponse,
+ '404': notFoundResponse,
+ },
+ },
+ }),
+] as const;
diff --git a/src/app/api/websites/[websiteId]/funnels/[funnelId]/stats/contract.ts b/src/app/api/websites/[websiteId]/funnels/[funnelId]/stats/contract.ts
new file mode 100644
index 000000000..7fd69f236
--- /dev/null
+++ b/src/app/api/websites/[websiteId]/funnels/[funnelId]/stats/contract.ts
@@ -0,0 +1,90 @@
+import { z } from 'zod';
+import { defineOperation } from '@/openapi/operation';
+import { badRequestResponse, unauthorizedResponse, notFoundResponse } from '@/openapi/schemas';
+import { savedStatsQuerySchema } from '@/lib/analytics-schema';
+
+export const operations = [
+ defineOperation({
+ method: 'get',
+ path: '/api/websites/{websiteId}/funnels/{funnelId}/stats',
+ audience: 'public',
+ auth: 'bearer-or-share',
+ operation: {
+ operationId: 'getWebsiteSavedFunnelStats',
+ summary: 'Get website saved funnel stats',
+ tags: ['Websites'],
+ requestParams: {
+ path: z.object({ websiteId: z.uuid(), funnelId: z.uuid() }),
+ query: savedStatsQuerySchema,
+ },
+ responses: {
+ '200': {
+ description: 'The operation completed successfully.',
+ content: {
+ 'application/json': {
+ schema: {
+ type: 'array',
+ items: {
+ type: 'object',
+ properties: {
+ visitors: {
+ type: 'number',
+ },
+ previous: {
+ type: 'number',
+ },
+ dropped: {
+ type: 'number',
+ },
+ dropoff: {
+ type: 'number',
+ },
+ remaining: {
+ type: 'number',
+ },
+ type: {
+ type: 'string',
+ },
+ value: {
+ type: 'string',
+ },
+ filters: {
+ type: 'array',
+ items: {
+ type: 'object',
+ properties: {
+ property: {
+ type: 'string',
+ },
+ operator: {
+ type: 'string',
+ },
+ value: {
+ type: 'string',
+ },
+ },
+ required: ['property', 'operator', 'value'],
+ },
+ },
+ },
+ required: [
+ 'visitors',
+ 'previous',
+ 'dropped',
+ 'dropoff',
+ 'remaining',
+ 'type',
+ 'value',
+ ],
+ },
+ },
+ },
+ },
+ },
+ '400': badRequestResponse,
+ '401': unauthorizedResponse,
+ '404': notFoundResponse,
+ },
+ },
+ }),
+] as const;
diff --git a/src/app/api/websites/[websiteId]/funnels/contract.ts b/src/app/api/websites/[websiteId]/funnels/contract.ts
new file mode 100644
index 000000000..a800b066b
--- /dev/null
+++ b/src/app/api/websites/[websiteId]/funnels/contract.ts
@@ -0,0 +1,216 @@
+import { z } from 'zod';
+import { defineOperation } from '@/openapi/operation';
+import { badRequestResponse, unauthorizedResponse, notFoundResponse } from '@/openapi/schemas';
+import { definitionListSchema, funnelDefinitionSchema } from '@/lib/analytics-schema';
+
+export const operations = [
+ defineOperation({
+ method: 'get',
+ path: '/api/websites/{websiteId}/funnels',
+ audience: 'public',
+ auth: 'bearer-or-share',
+ operation: {
+ operationId: 'getWebsiteFunnels',
+ summary: 'Get website funnels',
+ tags: ['Websites'],
+ requestParams: { path: z.object({ websiteId: z.uuid() }), query: definitionListSchema },
+ responses: {
+ '200': {
+ description: 'The operation completed successfully.',
+ content: {
+ 'application/json': {
+ schema: {
+ type: 'object',
+ properties: {
+ data: {
+ type: 'array',
+ items: {
+ allOf: [
+ {
+ type: 'object',
+ properties: {
+ id: {
+ type: 'string',
+ },
+ userId: {
+ type: 'string',
+ },
+ createdAt: {
+ type: 'string',
+ format: 'date-time',
+ },
+ updatedAt: {
+ type: 'string',
+ format: 'date-time',
+ },
+ name: {
+ type: 'string',
+ },
+ type: {
+ type: 'string',
+ },
+ description: {
+ type: 'string',
+ },
+ parameters: {
+ anyOf: [
+ {
+ type: 'string',
+ },
+ {
+ type: 'number',
+ },
+ {
+ const: false,
+ },
+ {
+ const: true,
+ },
+ {
+ type: 'object',
+ properties: {},
+ additionalProperties: {
+ anyOf: [
+ {
+ type: 'string',
+ },
+ {
+ type: 'number',
+ },
+ {
+ const: false,
+ },
+ {
+ const: true,
+ },
+ {},
+ {
+ type: 'object',
+ properties: {
+ length: {
+ type: 'number',
+ },
+ },
+ required: ['length'],
+ },
+ ],
+ },
+ },
+ {
+ type: 'object',
+ properties: {
+ length: {
+ type: 'number',
+ },
+ },
+ required: ['length'],
+ },
+ ],
+ },
+ websiteId: {
+ type: 'string',
+ },
+ },
+ required: [
+ 'id',
+ 'userId',
+ 'createdAt',
+ 'updatedAt',
+ 'name',
+ 'type',
+ 'description',
+ 'parameters',
+ 'websiteId',
+ ],
+ },
+ {
+ type: 'object',
+ properties: {
+ website: {
+ type: 'object',
+ properties: {
+ domain: {
+ type: 'string',
+ },
+ userId: {
+ type: 'string',
+ },
+ },
+ required: ['domain', 'userId'],
+ },
+ },
+ },
+ ],
+ },
+ },
+ count: {
+ type: 'number',
+ },
+ page: {
+ type: 'number',
+ },
+ pageSize: {
+ type: 'number',
+ },
+ orderBy: {
+ type: 'string',
+ },
+ sortDescending: {
+ type: 'boolean',
+ },
+ search: {
+ type: 'string',
+ },
+ isCapped: {
+ type: 'boolean',
+ },
+ },
+ required: ['data', 'count', 'page', 'pageSize'],
+ },
+ },
+ },
+ },
+ '400': badRequestResponse,
+ '401': unauthorizedResponse,
+ '404': notFoundResponse,
+ },
+ },
+ }),
+ defineOperation({
+ method: 'post',
+ path: '/api/websites/{websiteId}/funnels',
+ audience: 'public',
+ auth: 'bearer',
+ operation: {
+ operationId: 'createWebsiteFunnel',
+ summary: 'Create website funnel',
+ tags: ['Websites'],
+ requestParams: { path: z.object({ websiteId: z.uuid() }) },
+ requestBody: {
+ required: true,
+ content: { 'application/json': { schema: funnelDefinitionSchema } },
+ },
+ responses: {
+ '200': {
+ description: 'The operation completed successfully.',
+ content: {
+ 'application/json': {
+ schema: {
+ type: 'object',
+ properties: {
+ ok: {
+ const: true,
+ },
+ },
+ required: ['ok'],
+ },
+ },
+ },
+ },
+ '400': badRequestResponse,
+ '401': unauthorizedResponse,
+ '404': notFoundResponse,
+ },
+ },
+ }),
+] as const;
diff --git a/src/app/api/websites/[websiteId]/funnels/stats/contract.ts b/src/app/api/websites/[websiteId]/funnels/stats/contract.ts
new file mode 100644
index 000000000..afdfc6ae9
--- /dev/null
+++ b/src/app/api/websites/[websiteId]/funnels/stats/contract.ts
@@ -0,0 +1,87 @@
+import { z } from 'zod';
+import { defineOperation } from '@/openapi/operation';
+import { badRequestResponse, unauthorizedResponse, notFoundResponse } from '@/openapi/schemas';
+import { funnelQuerySchema } from '@/lib/analytics-schema';
+
+export const operations = [
+ defineOperation({
+ method: 'get',
+ path: '/api/websites/{websiteId}/funnels/stats',
+ audience: 'public',
+ auth: 'bearer-or-share',
+ operation: {
+ operationId: 'getWebsiteFunnelStats',
+ summary: 'Get website funnel stats',
+ tags: ['Websites'],
+ requestParams: { path: z.object({ websiteId: z.uuid() }), query: funnelQuerySchema },
+ responses: {
+ '200': {
+ description: 'The operation completed successfully.',
+ content: {
+ 'application/json': {
+ schema: {
+ type: 'array',
+ items: {
+ type: 'object',
+ properties: {
+ visitors: {
+ type: 'number',
+ },
+ previous: {
+ type: 'number',
+ },
+ dropped: {
+ type: 'number',
+ },
+ dropoff: {
+ type: 'number',
+ },
+ remaining: {
+ type: 'number',
+ },
+ type: {
+ type: 'string',
+ },
+ value: {
+ type: 'string',
+ },
+ filters: {
+ type: 'array',
+ items: {
+ type: 'object',
+ properties: {
+ property: {
+ type: 'string',
+ },
+ operator: {
+ type: 'string',
+ },
+ value: {
+ type: 'string',
+ },
+ },
+ required: ['property', 'operator', 'value'],
+ },
+ },
+ },
+ required: [
+ 'visitors',
+ 'previous',
+ 'dropped',
+ 'dropoff',
+ 'remaining',
+ 'type',
+ 'value',
+ ],
+ },
+ },
+ },
+ },
+ },
+ '400': badRequestResponse,
+ '401': unauthorizedResponse,
+ '404': notFoundResponse,
+ },
+ },
+ }),
+] as const;
diff --git a/src/app/api/websites/[websiteId]/goals/[goalId]/contract.ts b/src/app/api/websites/[websiteId]/goals/[goalId]/contract.ts
new file mode 100644
index 000000000..60d270d10
--- /dev/null
+++ b/src/app/api/websites/[websiteId]/goals/[goalId]/contract.ts
@@ -0,0 +1,101 @@
+import { z } from 'zod';
+import { defineOperation } from '@/openapi/operation';
+import {
+ badRequestResponse,
+ unauthorizedResponse,
+ notFoundResponse,
+ jsonResponse,
+ okSchema,
+} from '@/openapi/schemas';
+import { goalDefinitionSchema } from '@/lib/analytics-schema';
+
+export const operations = [
+ defineOperation({
+ method: 'get',
+ path: '/api/websites/{websiteId}/goals/{goalId}',
+ audience: 'public',
+ auth: 'bearer-or-share',
+ operation: {
+ operationId: 'getWebsiteGoal',
+ summary: 'Get website goal',
+ tags: ['Websites'],
+ requestParams: { path: z.object({ websiteId: z.uuid(), goalId: z.uuid() }) },
+ responses: {
+ '200': {
+ description: 'The operation completed successfully.',
+ content: {
+ 'application/json': {
+ schema: {
+ type: 'object',
+ properties: {
+ ok: {
+ const: true,
+ },
+ },
+ required: ['ok'],
+ },
+ },
+ },
+ },
+ '400': badRequestResponse,
+ '401': unauthorizedResponse,
+ '404': notFoundResponse,
+ },
+ },
+ }),
+ defineOperation({
+ method: 'post',
+ path: '/api/websites/{websiteId}/goals/{goalId}',
+ audience: 'public',
+ auth: 'bearer',
+ operation: {
+ operationId: 'updateWebsiteGoal',
+ summary: 'Update website goal',
+ tags: ['Websites'],
+ requestParams: { path: z.object({ websiteId: z.uuid(), goalId: z.uuid() }) },
+ requestBody: {
+ required: true,
+ content: { 'application/json': { schema: goalDefinitionSchema } },
+ },
+ responses: {
+ '200': {
+ description: 'The operation completed successfully.',
+ content: {
+ 'application/json': {
+ schema: {
+ type: 'object',
+ properties: {
+ ok: {
+ const: true,
+ },
+ },
+ required: ['ok'],
+ },
+ },
+ },
+ },
+ '400': badRequestResponse,
+ '401': unauthorizedResponse,
+ '404': notFoundResponse,
+ },
+ },
+ }),
+ defineOperation({
+ method: 'delete',
+ path: '/api/websites/{websiteId}/goals/{goalId}',
+ audience: 'public',
+ auth: 'bearer',
+ operation: {
+ operationId: 'deleteWebsiteGoal',
+ summary: 'Delete website goal',
+ tags: ['Websites'],
+ requestParams: { path: z.object({ websiteId: z.uuid(), goalId: z.uuid() }) },
+ responses: {
+ '200': jsonResponse(okSchema, 'Deleted successfully.'),
+ '400': badRequestResponse,
+ '401': unauthorizedResponse,
+ '404': notFoundResponse,
+ },
+ },
+ }),
+] as const;
diff --git a/src/app/api/websites/[websiteId]/goals/[goalId]/stats/contract.ts b/src/app/api/websites/[websiteId]/goals/[goalId]/stats/contract.ts
new file mode 100644
index 000000000..d9a5e45e8
--- /dev/null
+++ b/src/app/api/websites/[websiteId]/goals/[goalId]/stats/contract.ts
@@ -0,0 +1,46 @@
+import { z } from 'zod';
+import { defineOperation } from '@/openapi/operation';
+import { badRequestResponse, unauthorizedResponse, notFoundResponse } from '@/openapi/schemas';
+import { savedStatsQuerySchema } from '@/lib/analytics-schema';
+
+export const operations = [
+ defineOperation({
+ method: 'get',
+ path: '/api/websites/{websiteId}/goals/{goalId}/stats',
+ audience: 'public',
+ auth: 'bearer-or-share',
+ operation: {
+ operationId: 'getWebsiteSavedGoalStats',
+ summary: 'Get website saved goal stats',
+ tags: ['Websites'],
+ requestParams: {
+ path: z.object({ websiteId: z.uuid(), goalId: z.uuid() }),
+ query: savedStatsQuerySchema,
+ },
+ responses: {
+ '200': {
+ description: 'The operation completed successfully.',
+ content: {
+ 'application/json': {
+ schema: {
+ type: 'object',
+ properties: {
+ num: {
+ type: 'number',
+ },
+ total: {
+ type: 'number',
+ },
+ },
+ required: ['num', 'total'],
+ },
+ },
+ },
+ },
+ '400': badRequestResponse,
+ '401': unauthorizedResponse,
+ '404': notFoundResponse,
+ },
+ },
+ }),
+] as const;
diff --git a/src/app/api/websites/[websiteId]/goals/contract.ts b/src/app/api/websites/[websiteId]/goals/contract.ts
new file mode 100644
index 000000000..6ada7aaa4
--- /dev/null
+++ b/src/app/api/websites/[websiteId]/goals/contract.ts
@@ -0,0 +1,216 @@
+import { z } from 'zod';
+import { defineOperation } from '@/openapi/operation';
+import { badRequestResponse, unauthorizedResponse, notFoundResponse } from '@/openapi/schemas';
+import { definitionListSchema, goalDefinitionSchema } from '@/lib/analytics-schema';
+
+export const operations = [
+ defineOperation({
+ method: 'get',
+ path: '/api/websites/{websiteId}/goals',
+ audience: 'public',
+ auth: 'bearer-or-share',
+ operation: {
+ operationId: 'getWebsiteGoals',
+ summary: 'Get website goals',
+ tags: ['Websites'],
+ requestParams: { path: z.object({ websiteId: z.uuid() }), query: definitionListSchema },
+ responses: {
+ '200': {
+ description: 'The operation completed successfully.',
+ content: {
+ 'application/json': {
+ schema: {
+ type: 'object',
+ properties: {
+ data: {
+ type: 'array',
+ items: {
+ allOf: [
+ {
+ type: 'object',
+ properties: {
+ id: {
+ type: 'string',
+ },
+ userId: {
+ type: 'string',
+ },
+ createdAt: {
+ type: 'string',
+ format: 'date-time',
+ },
+ updatedAt: {
+ type: 'string',
+ format: 'date-time',
+ },
+ name: {
+ type: 'string',
+ },
+ type: {
+ type: 'string',
+ },
+ description: {
+ type: 'string',
+ },
+ parameters: {
+ anyOf: [
+ {
+ type: 'string',
+ },
+ {
+ type: 'number',
+ },
+ {
+ const: false,
+ },
+ {
+ const: true,
+ },
+ {
+ type: 'object',
+ properties: {},
+ additionalProperties: {
+ anyOf: [
+ {
+ type: 'string',
+ },
+ {
+ type: 'number',
+ },
+ {
+ const: false,
+ },
+ {
+ const: true,
+ },
+ {},
+ {
+ type: 'object',
+ properties: {
+ length: {
+ type: 'number',
+ },
+ },
+ required: ['length'],
+ },
+ ],
+ },
+ },
+ {
+ type: 'object',
+ properties: {
+ length: {
+ type: 'number',
+ },
+ },
+ required: ['length'],
+ },
+ ],
+ },
+ websiteId: {
+ type: 'string',
+ },
+ },
+ required: [
+ 'id',
+ 'userId',
+ 'createdAt',
+ 'updatedAt',
+ 'name',
+ 'type',
+ 'description',
+ 'parameters',
+ 'websiteId',
+ ],
+ },
+ {
+ type: 'object',
+ properties: {
+ website: {
+ type: 'object',
+ properties: {
+ domain: {
+ type: 'string',
+ },
+ userId: {
+ type: 'string',
+ },
+ },
+ required: ['domain', 'userId'],
+ },
+ },
+ },
+ ],
+ },
+ },
+ count: {
+ type: 'number',
+ },
+ page: {
+ type: 'number',
+ },
+ pageSize: {
+ type: 'number',
+ },
+ orderBy: {
+ type: 'string',
+ },
+ sortDescending: {
+ type: 'boolean',
+ },
+ search: {
+ type: 'string',
+ },
+ isCapped: {
+ type: 'boolean',
+ },
+ },
+ required: ['data', 'count', 'page', 'pageSize'],
+ },
+ },
+ },
+ },
+ '400': badRequestResponse,
+ '401': unauthorizedResponse,
+ '404': notFoundResponse,
+ },
+ },
+ }),
+ defineOperation({
+ method: 'post',
+ path: '/api/websites/{websiteId}/goals',
+ audience: 'public',
+ auth: 'bearer',
+ operation: {
+ operationId: 'createWebsiteGoal',
+ summary: 'Create website goal',
+ tags: ['Websites'],
+ requestParams: { path: z.object({ websiteId: z.uuid() }) },
+ requestBody: {
+ required: true,
+ content: { 'application/json': { schema: goalDefinitionSchema } },
+ },
+ responses: {
+ '200': {
+ description: 'The operation completed successfully.',
+ content: {
+ 'application/json': {
+ schema: {
+ type: 'object',
+ properties: {
+ ok: {
+ const: true,
+ },
+ },
+ required: ['ok'],
+ },
+ },
+ },
+ },
+ '400': badRequestResponse,
+ '401': unauthorizedResponse,
+ '404': notFoundResponse,
+ },
+ },
+ }),
+] as const;
diff --git a/src/app/api/websites/[websiteId]/goals/stats/contract.ts b/src/app/api/websites/[websiteId]/goals/stats/contract.ts
new file mode 100644
index 000000000..95e9065a3
--- /dev/null
+++ b/src/app/api/websites/[websiteId]/goals/stats/contract.ts
@@ -0,0 +1,43 @@
+import { z } from 'zod';
+import { defineOperation } from '@/openapi/operation';
+import { badRequestResponse, unauthorizedResponse, notFoundResponse } from '@/openapi/schemas';
+import { goalQuerySchema } from '@/lib/analytics-schema';
+
+export const operations = [
+ defineOperation({
+ method: 'get',
+ path: '/api/websites/{websiteId}/goals/stats',
+ audience: 'public',
+ auth: 'bearer-or-share',
+ operation: {
+ operationId: 'getWebsiteGoalStats',
+ summary: 'Get website goal stats',
+ tags: ['Websites'],
+ requestParams: { path: z.object({ websiteId: z.uuid() }), query: goalQuerySchema },
+ responses: {
+ '200': {
+ description: 'The operation completed successfully.',
+ content: {
+ 'application/json': {
+ schema: {
+ type: 'object',
+ properties: {
+ num: {
+ type: 'number',
+ },
+ total: {
+ type: 'number',
+ },
+ },
+ required: ['num', 'total'],
+ },
+ },
+ },
+ },
+ '400': badRequestResponse,
+ '401': unauthorizedResponse,
+ '404': notFoundResponse,
+ },
+ },
+ }),
+] as const;
diff --git a/src/app/api/websites/[websiteId]/heatmaps/contract.ts b/src/app/api/websites/[websiteId]/heatmaps/contract.ts
new file mode 100644
index 000000000..de82416c7
--- /dev/null
+++ b/src/app/api/websites/[websiteId]/heatmaps/contract.ts
@@ -0,0 +1,200 @@
+import { z } from 'zod';
+import { defineOperation } from '@/openapi/operation';
+import { badRequestResponse, unauthorizedResponse, notFoundResponse } from '@/openapi/schemas';
+import { heatmapQuerySchema } from '@/lib/analytics-schema';
+
+export const operations = [
+ defineOperation({
+ method: 'get',
+ path: '/api/websites/{websiteId}/heatmaps',
+ audience: 'public',
+ auth: 'bearer',
+ operation: {
+ operationId: 'getWebsiteHeatmaps',
+ summary: 'Get website heatmaps',
+ tags: ['Websites'],
+ requestParams: { path: z.object({ websiteId: z.uuid() }), query: heatmapQuerySchema },
+ responses: {
+ '200': {
+ description: 'The operation completed successfully.',
+ content: {
+ 'application/json': {
+ schema: {
+ type: 'object',
+ properties: {
+ mode: {
+ anyOf: [
+ {
+ const: 'click',
+ },
+ {
+ const: 'scroll',
+ },
+ ],
+ },
+ pages: {
+ type: 'array',
+ items: {
+ type: 'object',
+ properties: {
+ urlPath: {
+ type: 'string',
+ },
+ count: {
+ type: 'number',
+ },
+ sessions: {
+ type: 'number',
+ },
+ },
+ required: ['urlPath', 'count', 'sessions'],
+ },
+ },
+ points: {
+ type: 'array',
+ items: {
+ type: 'object',
+ properties: {
+ x: {
+ type: 'number',
+ },
+ y: {
+ type: 'number',
+ },
+ pageX: {
+ type: 'number',
+ },
+ pageY: {
+ type: 'number',
+ },
+ pageW: {
+ type: 'number',
+ },
+ pageH: {
+ type: 'number',
+ },
+ viewportW: {
+ type: 'number',
+ },
+ viewportH: {
+ type: 'number',
+ },
+ count: {
+ type: 'number',
+ },
+ },
+ required: [
+ 'x',
+ 'y',
+ 'pageX',
+ 'pageY',
+ 'pageW',
+ 'pageH',
+ 'viewportW',
+ 'viewportH',
+ 'count',
+ ],
+ },
+ },
+ snapshot: {
+ type: 'object',
+ properties: {
+ kind: {
+ const: 'iframe',
+ },
+ id: {
+ type: 'string',
+ },
+ url: {
+ type: 'string',
+ },
+ pageW: {
+ type: 'number',
+ },
+ pageH: {
+ type: 'number',
+ },
+ viewportW: {
+ type: 'number',
+ },
+ viewportH: {
+ type: 'number',
+ },
+ },
+ required: ['kind', 'id', 'url', 'pageW', 'pageH', 'viewportW', 'viewportH'],
+ },
+ scroll: {
+ type: 'object',
+ properties: {
+ buckets: {
+ type: 'array',
+ items: {
+ type: 'object',
+ properties: {
+ depth: {
+ type: 'number',
+ },
+ sessions: {
+ type: 'number',
+ },
+ pageW: {
+ type: 'number',
+ },
+ pageH: {
+ type: 'number',
+ },
+ viewportW: {
+ type: 'number',
+ },
+ viewportH: {
+ type: 'number',
+ },
+ },
+ required: [
+ 'depth',
+ 'sessions',
+ 'pageW',
+ 'pageH',
+ 'viewportW',
+ 'viewportH',
+ ],
+ },
+ },
+ totalSessions: {
+ type: 'number',
+ },
+ pageW: {
+ type: 'number',
+ },
+ pageH: {
+ type: 'number',
+ },
+ viewportW: {
+ type: 'number',
+ },
+ viewportH: {
+ type: 'number',
+ },
+ },
+ required: [
+ 'buckets',
+ 'totalSessions',
+ 'pageW',
+ 'pageH',
+ 'viewportW',
+ 'viewportH',
+ ],
+ },
+ },
+ required: ['mode', 'pages', 'points', 'snapshot', 'scroll'],
+ },
+ },
+ },
+ },
+ '400': badRequestResponse,
+ '401': unauthorizedResponse,
+ '404': notFoundResponse,
+ },
+ },
+ }),
+] as const;
diff --git a/src/app/api/websites/[websiteId]/journeys/contract.ts b/src/app/api/websites/[websiteId]/journeys/contract.ts
new file mode 100644
index 000000000..e6aea2268
--- /dev/null
+++ b/src/app/api/websites/[websiteId]/journeys/contract.ts
@@ -0,0 +1,49 @@
+import { z } from 'zod';
+import { defineOperation } from '@/openapi/operation';
+import { badRequestResponse, unauthorizedResponse, notFoundResponse } from '@/openapi/schemas';
+import { journeyQuerySchema } from '@/lib/analytics-schema';
+
+export const operations = [
+ defineOperation({
+ method: 'get',
+ path: '/api/websites/{websiteId}/journeys',
+ audience: 'public',
+ auth: 'bearer-or-share',
+ operation: {
+ operationId: 'getWebsiteJourneys',
+ summary: 'Get website journeys',
+ tags: ['Websites'],
+ requestParams: { path: z.object({ websiteId: z.uuid() }), query: journeyQuerySchema },
+ responses: {
+ '200': {
+ description: 'Analytics results.',
+ content: {
+ 'application/json': {
+ schema: {
+ type: 'array',
+ items: {
+ type: 'object',
+ properties: {
+ items: {
+ type: 'array',
+ items: {
+ type: 'string',
+ },
+ },
+ count: {
+ type: 'number',
+ },
+ },
+ required: ['items', 'count'],
+ },
+ },
+ },
+ },
+ },
+ '400': badRequestResponse,
+ '401': unauthorizedResponse,
+ '404': notFoundResponse,
+ },
+ },
+ }),
+] as const;
diff --git a/src/app/api/websites/[websiteId]/performance/chart/contract.ts b/src/app/api/websites/[websiteId]/performance/chart/contract.ts
new file mode 100644
index 000000000..c8c326243
--- /dev/null
+++ b/src/app/api/websites/[websiteId]/performance/chart/contract.ts
@@ -0,0 +1,61 @@
+import { z } from 'zod';
+import { defineOperation } from '@/openapi/operation';
+import { badRequestResponse, unauthorizedResponse, notFoundResponse } from '@/openapi/schemas';
+import { performanceChartQuerySchema } from '@/lib/analytics-schema';
+
+export const operations = [
+ defineOperation({
+ method: 'get',
+ path: '/api/websites/{websiteId}/performance/chart',
+ audience: 'public',
+ auth: 'bearer-or-share',
+ operation: {
+ operationId: 'getWebsitePerformanceChart',
+ summary: 'Get website performance chart',
+ tags: ['Websites'],
+ requestParams: {
+ path: z.object({ websiteId: z.uuid() }),
+ query: performanceChartQuerySchema,
+ },
+ responses: {
+ '200': {
+ description: 'Analytics results.',
+ content: {
+ 'application/json': {
+ schema: {
+ type: 'object',
+ properties: {
+ chart: {
+ type: 'array',
+ items: {
+ type: 'object',
+ properties: {
+ t: {
+ type: 'string',
+ },
+ p50: {
+ type: 'number',
+ },
+ p75: {
+ type: 'number',
+ },
+ p95: {
+ type: 'number',
+ },
+ },
+ required: ['t', 'p50', 'p75', 'p95'],
+ },
+ },
+ },
+ required: ['chart'],
+ },
+ },
+ },
+ },
+ '400': badRequestResponse,
+ '401': unauthorizedResponse,
+ '404': notFoundResponse,
+ },
+ },
+ }),
+] as const;
diff --git a/src/app/api/websites/[websiteId]/performance/metrics/contract.ts b/src/app/api/websites/[websiteId]/performance/metrics/contract.ts
new file mode 100644
index 000000000..a96099131
--- /dev/null
+++ b/src/app/api/websites/[websiteId]/performance/metrics/contract.ts
@@ -0,0 +1,58 @@
+import { z } from 'zod';
+import { defineOperation } from '@/openapi/operation';
+import { badRequestResponse, unauthorizedResponse, notFoundResponse } from '@/openapi/schemas';
+import { performanceMetricsQuerySchema } from '@/lib/analytics-schema';
+
+export const operations = [
+ defineOperation({
+ method: 'get',
+ path: '/api/websites/{websiteId}/performance/metrics',
+ audience: 'public',
+ auth: 'bearer-or-share',
+ operation: {
+ operationId: 'getWebsitePerformanceMetrics',
+ summary: 'Get website performance metrics',
+ tags: ['Websites'],
+ requestParams: {
+ path: z.object({ websiteId: z.uuid() }),
+ query: performanceMetricsQuerySchema,
+ },
+ responses: {
+ '200': {
+ description: 'Analytics results.',
+ content: {
+ 'application/json': {
+ schema: {
+ type: 'array',
+ items: {
+ type: 'object',
+ properties: {
+ name: {
+ type: 'string',
+ },
+ p50: {
+ type: 'number',
+ },
+ p75: {
+ type: 'number',
+ },
+ p95: {
+ type: 'number',
+ },
+ count: {
+ type: 'number',
+ },
+ },
+ required: ['name', 'p50', 'p75', 'p95', 'count'],
+ },
+ },
+ },
+ },
+ },
+ '400': badRequestResponse,
+ '401': unauthorizedResponse,
+ '404': notFoundResponse,
+ },
+ },
+ }),
+] as const;
diff --git a/src/app/api/websites/[websiteId]/performance/stats/contract.ts b/src/app/api/websites/[websiteId]/performance/stats/contract.ts
new file mode 100644
index 000000000..8906d0f78
--- /dev/null
+++ b/src/app/api/websites/[websiteId]/performance/stats/contract.ts
@@ -0,0 +1,118 @@
+import { z } from 'zod';
+import { defineOperation } from '@/openapi/operation';
+import { badRequestResponse, unauthorizedResponse, notFoundResponse } from '@/openapi/schemas';
+import { performanceStatsQuerySchema } from '@/lib/analytics-schema';
+
+export const operations = [
+ defineOperation({
+ method: 'get',
+ path: '/api/websites/{websiteId}/performance/stats',
+ audience: 'public',
+ auth: 'bearer-or-share',
+ operation: {
+ operationId: 'getWebsitePerformanceStats',
+ summary: 'Get website performance stats',
+ tags: ['Websites'],
+ requestParams: {
+ path: z.object({ websiteId: z.uuid() }),
+ query: performanceStatsQuerySchema,
+ },
+ responses: {
+ '200': {
+ description: 'Analytics results.',
+ content: {
+ 'application/json': {
+ schema: {
+ type: 'object',
+ properties: {
+ lcp: {
+ type: 'object',
+ properties: {
+ p50: {
+ type: 'number',
+ },
+ p75: {
+ type: 'number',
+ },
+ p95: {
+ type: 'number',
+ },
+ },
+ required: ['p50', 'p75', 'p95'],
+ },
+ inp: {
+ type: 'object',
+ properties: {
+ p50: {
+ type: 'number',
+ },
+ p75: {
+ type: 'number',
+ },
+ p95: {
+ type: 'number',
+ },
+ },
+ required: ['p50', 'p75', 'p95'],
+ },
+ cls: {
+ type: 'object',
+ properties: {
+ p50: {
+ type: 'number',
+ },
+ p75: {
+ type: 'number',
+ },
+ p95: {
+ type: 'number',
+ },
+ },
+ required: ['p50', 'p75', 'p95'],
+ },
+ fcp: {
+ type: 'object',
+ properties: {
+ p50: {
+ type: 'number',
+ },
+ p75: {
+ type: 'number',
+ },
+ p95: {
+ type: 'number',
+ },
+ },
+ required: ['p50', 'p75', 'p95'],
+ },
+ ttfb: {
+ type: 'object',
+ properties: {
+ p50: {
+ type: 'number',
+ },
+ p75: {
+ type: 'number',
+ },
+ p95: {
+ type: 'number',
+ },
+ },
+ required: ['p50', 'p75', 'p95'],
+ },
+ count: {
+ type: 'number',
+ },
+ },
+ required: ['lcp', 'inp', 'cls', 'fcp', 'ttfb', 'count'],
+ },
+ },
+ },
+ },
+ '400': badRequestResponse,
+ '401': unauthorizedResponse,
+ '404': notFoundResponse,
+ },
+ },
+ }),
+] as const;
diff --git a/src/app/api/websites/[websiteId]/retention/contract.ts b/src/app/api/websites/[websiteId]/retention/contract.ts
new file mode 100644
index 000000000..b9f39672e
--- /dev/null
+++ b/src/app/api/websites/[websiteId]/retention/contract.ts
@@ -0,0 +1,55 @@
+import { z } from 'zod';
+import { defineOperation } from '@/openapi/operation';
+import { badRequestResponse, unauthorizedResponse, notFoundResponse } from '@/openapi/schemas';
+import { retentionQuerySchema } from '@/lib/analytics-schema';
+
+export const operations = [
+ defineOperation({
+ method: 'get',
+ path: '/api/websites/{websiteId}/retention',
+ audience: 'public',
+ auth: 'bearer-or-share',
+ operation: {
+ operationId: 'getWebsiteRetention',
+ summary: 'Get website retention',
+ tags: ['Websites'],
+ requestParams: { path: z.object({ websiteId: z.uuid() }), query: retentionQuerySchema },
+ responses: {
+ '200': {
+ description: 'The operation completed successfully.',
+ content: {
+ 'application/json': {
+ schema: {
+ type: 'array',
+ items: {
+ type: 'object',
+ properties: {
+ date: {
+ type: 'string',
+ },
+ day: {
+ type: 'number',
+ },
+ visitors: {
+ type: 'number',
+ },
+ returnVisitors: {
+ type: 'number',
+ },
+ percentage: {
+ type: 'number',
+ },
+ },
+ required: ['date', 'day', 'visitors', 'returnVisitors', 'percentage'],
+ },
+ },
+ },
+ },
+ },
+ '400': badRequestResponse,
+ '401': unauthorizedResponse,
+ '404': notFoundResponse,
+ },
+ },
+ }),
+] as const;
diff --git a/src/app/api/websites/[websiteId]/utm/metrics/contract.ts b/src/app/api/websites/[websiteId]/utm/metrics/contract.ts
new file mode 100644
index 000000000..f7e8b05f2
--- /dev/null
+++ b/src/app/api/websites/[websiteId]/utm/metrics/contract.ts
@@ -0,0 +1,46 @@
+import { z } from 'zod';
+import { defineOperation } from '@/openapi/operation';
+import { badRequestResponse, unauthorizedResponse, notFoundResponse } from '@/openapi/schemas';
+import { utmMetricsQuerySchema } from '@/lib/analytics-schema';
+
+export const operations = [
+ defineOperation({
+ method: 'get',
+ path: '/api/websites/{websiteId}/utm/metrics',
+ audience: 'public',
+ auth: 'bearer-or-share',
+ operation: {
+ operationId: 'getWebsiteUtmMetrics',
+ summary: 'Get website utm metrics',
+ tags: ['Websites'],
+ requestParams: { path: z.object({ websiteId: z.uuid() }), query: utmMetricsQuerySchema },
+ responses: {
+ '200': {
+ description: 'Analytics results.',
+ content: {
+ 'application/json': {
+ schema: {
+ type: 'array',
+ items: {
+ type: 'object',
+ properties: {
+ utm: {
+ type: 'string',
+ },
+ views: {
+ type: 'number',
+ },
+ },
+ required: ['utm', 'views'],
+ },
+ },
+ },
+ },
+ },
+ '400': badRequestResponse,
+ '401': unauthorizedResponse,
+ '404': notFoundResponse,
+ },
+ },
+ }),
+] as const;
diff --git a/src/app/api/websites/[websiteId]/utm/metrics/route.ts b/src/app/api/websites/[websiteId]/utm/metrics/route.ts
index 42571789c..dce1e49b3 100644
--- a/src/app/api/websites/[websiteId]/utm/metrics/route.ts
+++ b/src/app/api/websites/[websiteId]/utm/metrics/route.ts
@@ -13,5 +13,11 @@ export async function GET(
const { websiteId } = await params;
if (!(await canViewWebsiteSection(auth, websiteId, 'utm'))) return unauthorized();
const filters = await getQueryFilters(query, websiteId);
- return json(await getUTM(websiteId, { startDate: filters.startDate, endDate: filters.endDate, column: query.type }, filters));
+ return json(
+ await getUTM(
+ websiteId,
+ { startDate: filters.startDate, endDate: filters.endDate, column: query.type },
+ filters,
+ ),
+ );
}
diff --git a/src/lib/mcp/dispatch.ts b/src/lib/mcp/dispatch.ts
index 880a4970d..1375a7056 100644
--- a/src/lib/mcp/dispatch.ts
+++ b/src/lib/mcp/dispatch.ts
@@ -119,36 +119,50 @@ export const MCP_DISPATCH_ROUTES: readonly DispatchRoute[] = [
load: () => import('@/app/api/websites/[websiteId]/sessions/[sessionId]/properties/route'),
},
{
- method: 'POST',
- path: '/api/reports/attribution',
- load: () => import('@/app/api/reports/attribution/route'),
+ method: 'GET',
+ path: '/api/websites/{websiteId}/attribution',
+ load: () => import('@/app/api/websites/[websiteId]/attribution/route'),
+ },
+ {
+ method: 'GET',
+ path: '/api/websites/{websiteId}/breakdown',
+ load: () => import('@/app/api/websites/[websiteId]/breakdown/route'),
},
{
- method: 'POST',
- path: '/api/reports/breakdown',
- load: () => import('@/app/api/reports/breakdown/route'),
+ method: 'GET',
+ path: '/api/websites/{websiteId}/funnels/stats',
+ load: () => import('@/app/api/websites/[websiteId]/funnels/stats/route'),
},
{
- method: 'POST',
- path: '/api/reports/funnel',
- load: () => import('@/app/api/reports/funnel/route'),
+ method: 'GET',
+ path: '/api/websites/{websiteId}/journeys',
+ load: () => import('@/app/api/websites/[websiteId]/journeys/route'),
},
{
- method: 'POST',
- path: '/api/reports/journey',
- load: () => import('@/app/api/reports/journey/route'),
+ method: 'GET',
+ path: '/api/websites/{websiteId}/retention',
+ load: () => import('@/app/api/websites/[websiteId]/retention/route'),
},
{
- method: 'POST',
- path: '/api/reports/retention',
- load: () => import('@/app/api/reports/retention/route'),
+ method: 'GET',
+ path: '/api/websites/{websiteId}/utm/metrics',
+ load: () => import('@/app/api/websites/[websiteId]/utm/metrics/route'),
},
{
- method: 'POST',
- path: '/api/reports/revenue',
- load: () => import('@/app/api/reports/revenue/route'),
+ method: 'GET',
+ path: '/api/websites/{websiteId}/revenue/stats',
+ load: () => import('@/app/api/websites/[websiteId]/revenue/stats/route'),
+ },
+ {
+ method: 'GET',
+ path: '/api/websites/{websiteId}/revenue/chart',
+ load: () => import('@/app/api/websites/[websiteId]/revenue/chart/route'),
+ },
+ {
+ method: 'GET',
+ path: '/api/websites/{websiteId}/revenue/metrics',
+ load: () => import('@/app/api/websites/[websiteId]/revenue/metrics/route'),
},
- { method: 'POST', path: '/api/reports/utm', load: () => import('@/app/api/reports/utm/route') },
];
function escapeRegExp(value: string) {