Query metrics about the conversation data that you have in CCAI Insights. These metrics include, for example, the total conversation count, average silence percentage, and average conversation duration.
Prerequisites
Contact your Google representative to enable this feature in your project.
Query metrics
The following code sample demonstrates how to query metrics. A conversation create time filter is always required. Reference list conversations for more information about this filter.
All metrics
Get all metrics.
REST
Before using any of the request data, make the following replacements:
- PROJECT_ID: your project ID.
- MIN_TIMESTAMP: a minimum timestamp filter. For example,
YYYY-MM-DDT00:00:00+00
- MAX_TIMESTAMP: a maximum timestamp filter. For example,
YYYY-MM-DDT00:00:00+00
HTTP method and URL:
GET https://contactcenterinsights.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1:queryMetrics
Request JSON body:
{ "filter": "create_time>='MIN_TIMESTAMP' create_time<'MAX_TIMESTAMP'" }
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_ID/locations/us-central1/operations/OPERATION_ID", "metadata": { "@type": "type.googleapis.com/google.cloud.contactcenterinsights.v1.QueryMetricsMetadata" } }
All metrics grouped by topics
Get all metrics grouped by topics. Reference topic modeling overview for information about topics.
REST
Before using any of the request data, make the following replacements:
- PROJECT_ID: your project ID.
- MIN_TIMESTAMP: a minimum timestamp filter. For example,
YYYY-MM-DDT00:00:00+00
- MAX_TIMESTAMP: a maximum timestamp filter. For example,
YYYY-MM-DDT00:00:00+00
HTTP method and URL:
GET https://contactcenterinsights.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1:queryMetrics
Request JSON body:
{ "filter": "create_time>='MIN_TIMESTAMP' create_time<'MAX_TIMESTAMP'", "dimensions": [{ "dimensionKey": "ISSUE" }] }
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_ID/locations/us-central1/operations/OPERATION_ID", "metadata": { "@type": "type.googleapis.com/google.cloud.contactcenterinsights.v1.QueryMetricsMetadata" } }
All metrics over a daily time series
Get all metrics over a daily time series. Each data point in the time series represents one day's worth of metrics.
REST
Before using any of the request data, make the following replacements:
- PROJECT_ID: your project ID.
- MIN_TIMESTAMP: a minimum timestamp filter. For example,
YYYY-MM-DDT00:00:00+00
- MAX_TIMESTAMP: a maximum timestamp filter. For example,
YYYY-MM-DDT00:00:00+00
HTTP method and URL:
GET https://contactcenterinsights.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1:queryMetrics
Request JSON body:
{ "filter": "create_time>='MIN_TIMESTAMP' create_time<'MAX_TIMESTAMP'", "timeGranularity": "DAILY" }
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_ID/locations/us-central1/operations/OPERATION_ID", "metadata": { "@type": "type.googleapis.com/google.cloud.contactcenterinsights.v1.QueryMetricsMetadata" } }
All metrics grouped by topics over a daily time series
Get all metrics grouped by topics over a daily time series. Each data point in the time series represents one day's worth of metrics. Reference topic modeling overview for information about topics.
REST
Before using any of the request data, make the following replacements:
- PROJECT_ID: your project ID.
- MIN_TIMESTAMP: a minimum timestamp filter. For example,
YYYY-MM-DDT00:00:00+00
- MAX_TIMESTAMP: a maximum timestamp filter. For example,
YYYY-MM-DDT00:00:00+00
HTTP method and URL:
GET https://contactcenterinsights.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1:queryMetrics
Request JSON body:
{ "filter": "create_time>='MIN_TIMESTAMP' create_time<'MAX_TIMESTAMP'", "dimensions": [{ "dimensionKey": "ISSUE" }], "timeGranularity": "DAILY" }
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_ID/locations/us-central1/operations/OPERATION_ID", "metadata": { "@type": "type.googleapis.com/google.cloud.contactcenterinsights.v1.QueryMetricsMetadata" } }