import { APIResource } from '../resource'; import { APIPromise } from '../api-promise'; import type { RequestOptions } from '../internal/request-options'; export declare class VideoAnalytics extends APIResource { /** * This endpoint retrieves viewer analytics data. This endpoint is use for deep insights on the analytics data. * * @param {VideoAnalyticViewerDataParams} body - The request body to send. * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. * @returns {APIPromise} 200 * * @example * ```ts * const videoAnalytic = await client.videoAnalytics.viewerData({ * metrics: ['views'], * date_range: { * start_at: '2024-01-01', * end_at: '2024-01-01', * }, * group_by: 'daily', * }); * ``` */ viewerData(body: VideoAnalyticViewerDataParams, options?: RequestOptions): APIPromise; /** * Read viewer metrics for one workspace, grouped by a breakdown field, for a date range of at most 60 days. This does not change assets or delivery. * * @param {VideoAnalyticBreakdownDataParams} body - The request body to send. * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. * @returns {APIPromise} 200 * * @example * ```ts * const videoAnalytic = await client.videoAnalytics.breakdownData({ * date_range: { start_at: '2026-07-20', end_at: '2026-08-20' }, * filters: [], * breakdowns: [ * { name: 'custom_video_id', metric: 'views', page: 1, page_size: 10 }, * { name: 'custom_video_title', metric: 'completion_percent_by_views', page: 1, page_size: 10 }, * ], * workspace_id: '6694c405e63913eecf3cf5fb', * }); * ``` */ breakdownData(body: VideoAnalyticBreakdownDataParams, options?: RequestOptions): APIPromise; /** * This endpoint retrieves aggregated data of the given metrics. * * @param {VideoAnalyticAggregatedDataParams} body - The request body to send. * @param {RequestOptions} [options] - Options to apply to the request, such as headers and an abort signal. * @returns {APIPromise} 200 * * @example * ```ts * const videoAnalytic = await client.videoAnalytics.aggregatedData({ * aggregate: [ * { * metric: 'views', * function: 'sum', * }, * ], * workspace_id: '', * timeframe: { * start_at: '2024-01-01', * end_at: '2024-01-01', * }, * }); * ``` */ aggregatedData(body: VideoAnalyticAggregatedDataParams, options?: RequestOptions): APIPromise; } export interface VideoAnalyticViewerDataParams { /** * Get data for one or more metrics in the same request. Supported values: `views`, `unique_views`, `impressions`, `completion_percent_by_views`, `playing_time`, `concurrent_users`, `widget_form_submitted`, and `cta_clicks`. */ metrics: Array<'views' | 'unique_views' | 'impressions' | 'completion_percent_by_views' | 'playing_time' | 'concurrent_users' | 'widget_form_submitted' | 'cta_clicks'>; /** * The timeframe to get the data for. The maximum range between start_at and end_at is 60 days. */ date_range: VideoAnalyticViewerDataParams.DateRange; /** * Gumlet workspace ID */ workspace_id?: string; /** * Build *segments* of users using multiple filters on the data, `value` should be an *exact match* */ filters?: Array; /** * Data can be grouped by `daily`, `weekly` or `monthly`. * @default daily */ group_by?: 'daily' | 'weekly' | 'monthly'; /** * Group metrics by the selected dimension. You can select up to 3 dimensions for nested category results; results follow the selection order. */ chart_dimension?: VideoAnalyticViewerDataParams.ChartDimension; /** * Whether the request is to download the chart data */ download?: boolean; } export declare namespace VideoAnalyticViewerDataParams { interface DateRange { /** * Date in yyyy-MM-dd format * @format date */ start_at: string; /** * Date in yyyy-MM-dd format * @format date */ end_at: string; } interface Filter { /** * Name of the breakdown to filter data on. */ name: 'meta_browser' | 'meta_operating_system' | 'meta_operating_system_version' | 'meta_device_category' | 'meta_device_manufacturer' | 'meta_device_name' | 'meta_device_display_width' | 'meta_device_display_height' | 'meta_country' | 'meta_city' | 'meta_region' | 'player_software' | 'player_software_version' | 'player_language_code' | 'player_name' | 'meta_page_url' | 'meta_asn' | 'custom_user_id' | 'custom_user_email' | 'custom_video_id' | 'custom_video_title' | 'video_source_url' | 'custom_video_variant_name' | 'custom_video_language' | 'custom_video_variant' | 'custom_data_1' | 'custom_data_2' | 'custom_data_3' | 'custom_data_4' | 'custom_data_5'; /** * Value to be matched for the given filter name. Currently we support exact matches. */ value: string; /** * Operator to be used while filtering the data * @default equals */ operator?: 'equals' | 'does not equal' | 'contains' | 'does not contain' | 'is set' | 'is not set'; } interface ChartDimension { group_by?: Array; } namespace ChartDimension { interface GroupBy { name?: 'custom_video_title' | 'custom_video_id' | 'custom_workspace_id' | 'video_source_url' | 'video_source_format' | 'player_software_version' | 'player_software' | 'meta_page_url' | 'audio_language' | 'subtitle_language' | 'video_width_pixels' | 'video_height_pixels' | 'meta_country' | 'meta_city' | 'meta_device_category' | 'meta_device_manufacturer' | 'meta_browser' | 'meta_browser_version' | 'meta_browser_language' | 'meta_operating_system' | 'meta_operating_system_version' | 'meta_device_name' | 'meta_asn'; } } } export interface VideoAnalyticViewerDataResponse { views?: Array; unique_views?: Array; analytics_data?: VideoAnalyticViewerDataResponse.AnalyticsData; breakdowns?: Record; } export declare namespace VideoAnalyticViewerDataResponse { interface View { /** * @default 0 */ x?: number; y?: unknown; unit?: string; } interface UniqueView { /** * @default 0 */ x?: number; y?: unknown; unit?: string; } interface AnalyticsData { views?: Array; } namespace AnalyticsData { interface View { /** * Date in epoch format */ x?: string; /** * Value */ y?: string; unit?: string; } } } export interface VideoAnalyticBreakdownDataParams { /** * The timeframe to get the data for. The maximum range between start_at and end_at is 60 days. */ date_range: VideoAnalyticBreakdownDataParams.DateRange; /** * Breakdown fields and metrics to retrieve data for. Supports 1 to 3 breakdowns per request. * @minItems 1 * @maxItems 3 */ breakdowns: Array; /** * The five to ten character unique identifier of the Gumlet workspace ID available on the Video Workspaces. */ workspace_id: string; /** * Build *segments* of users using multiple filters on the data, `value` should be an *exact match* */ filters?: Array; } export declare namespace VideoAnalyticBreakdownDataParams { interface DateRange { /** * Date in yyyy-MM-dd format * @format date */ start_at: string; /** * Date in yyyy-MM-dd format * @format date */ end_at: string; } interface Breakdown { /** * Name of the field to break down the data by. */ name: 'meta_browser' | 'meta_operating_system' | 'meta_operating_system_version' | 'meta_device_category' | 'meta_device_manufacturer' | 'meta_device_name' | 'meta_device_display_width' | 'meta_device_display_height' | 'meta_country' | 'meta_city' | 'meta_region' | 'player_software' | 'player_software_version' | 'player_language_code' | 'player_name' | 'meta_page_url' | 'meta_asn' | 'custom_user_id' | 'custom_user_email' | 'custom_video_id' | 'custom_video_title' | 'video_source_url' | 'custom_video_variant_name' | 'custom_video_language' | 'custom_video_variant' | 'custom_data_1' | 'custom_data_2' | 'custom_data_3' | 'custom_data_4' | 'custom_data_5'; /** * The metric to retrieve breakdown data for. */ metric: 'views' | 'unique_views' | 'impressions' | 'completion_percent_by_views' | 'playing_time' | 'concurrent_users' | 'widget_form_submitted' | 'cta_clicks'; /** * Page number for paginated results. * @default 1 */ page?: number; /** * Number of results per page. * @default 100 */ page_size?: number; } interface Filter { /** * Name of the breakdown to filter data on. */ name: 'meta_browser' | 'meta_operating_system' | 'meta_operating_system_version' | 'meta_device_category' | 'meta_device_manufacturer' | 'meta_device_name' | 'meta_device_display_width' | 'meta_device_display_height' | 'meta_country' | 'meta_city' | 'meta_region' | 'player_software' | 'player_software_version' | 'player_language_code' | 'player_name' | 'meta_page_url' | 'meta_asn' | 'custom_user_id' | 'custom_user_email' | 'custom_video_id' | 'custom_video_title' | 'video_source_url' | 'custom_video_variant_name' | 'custom_video_language' | 'custom_video_variant' | 'custom_data_1' | 'custom_data_2' | 'custom_data_3' | 'custom_data_4' | 'custom_data_5'; /** * Value to be matched for the given filter name. Currently we support exact matches. */ value: string; /** * Operator to be used while filtering the data * @default equals */ operator?: 'equals' | 'does not equal' | 'contains' | 'does not contain' | 'is set' | 'is not set'; } } export interface VideoAnalyticBreakdownDataResponse { views?: VideoAnalyticBreakdownDataResponse.Views; } export declare namespace VideoAnalyticBreakdownDataResponse { interface Views { data?: Array; /** * Whether there is another page of results */ has_next_page?: boolean; /** * Current page number */ current_page?: number; } namespace Views { interface Data { /** * Breakdown field value */ key?: string; /** * Metric value for the breakdown key */ value?: number; unit?: string; } } } export interface VideoAnalyticAggregatedDataParams { /** * Aggregate multiple metrics at the same time */ aggregate: Array; /** * The unique identifier of the Gumlet workspace ID available on the Video Workspaces. */ workspace_id: string; /** * The timeframe to get the data for. The maximum range between start_at and end_at is 60 days. */ timeframe: VideoAnalyticAggregatedDataParams.Timeframe; /** * Get aggregations for metrics with multiple filters, `value` should be an exact match */ filters?: Array; } export declare namespace VideoAnalyticAggregatedDataParams { interface Aggregate { /** * The metric to be aggregated for this request. */ metric: 'views' | 'unique_views' | 'completion_percent_by_views' | 'playing_time' | 'concurrent_users' | 'impressions' | 'widget_form_submitted' | 'cta_clicks'; /** * Aggregation function which is to be used. */ function: 'sum' | 'average'; } interface Timeframe { /** * Date in yyyy-MM-dd format * @format date */ start_at: string; /** * Date in yyyy-MM-dd format * @format date */ end_at: string; } interface Filter { /** * Name of the breakdown to filter data on. */ name: 'meta_browser' | 'meta_operating_system' | 'meta_operating_system_version' | 'meta_device_category' | 'meta_device_manufacturer' | 'meta_device_name' | 'meta_device_display_width' | 'meta_device_display_height' | 'meta_country' | 'meta_city' | 'meta_region' | 'player_software' | 'player_software_version' | 'player_height_pixels' | 'player_width_pixels' | 'player_language_code' | 'meta_page_url' | 'meta_asn' | 'custom_user_id' | 'user_name' | 'user_email' | 'custom_video_id' | 'custom_video_title' | 'video_source_url' | 'video_source_hostname' | 'video_source_format' | 'custom_video_language' | 'custom_video_variant' | 'custom_data_1' | 'custom_data_2' | 'custom_data_3' | 'custom_data_4' | 'custom_data_5'; /** * Value to be matched for the given filter name. Currently we support exact matches. */ value: string; /** * Operator to be used while filtering the data * @default equals */ operator?: 'equals' | 'does not equal' | 'contains' | 'does not contain' | 'is set' | 'is not set'; } } export interface VideoAnalyticAggregatedDataResponse { views?: VideoAnalyticAggregatedDataResponse.Views; } export declare namespace VideoAnalyticAggregatedDataResponse { interface Views { sum?: Views.Sum; } namespace Views { interface Sum { /** * @default 0 */ value?: number; unit?: string; } } } export declare namespace VideoAnalytics { export { type VideoAnalyticViewerDataResponse as VideoAnalyticViewerDataResponse, type VideoAnalyticBreakdownDataResponse as VideoAnalyticBreakdownDataResponse, type VideoAnalyticAggregatedDataResponse as VideoAnalyticAggregatedDataResponse, type VideoAnalyticViewerDataParams as VideoAnalyticViewerDataParams, type VideoAnalyticBreakdownDataParams as VideoAnalyticBreakdownDataParams, type VideoAnalyticAggregatedDataParams as VideoAnalyticAggregatedDataParams, }; } //# sourceMappingURL=video-analytics.d.ts.map