Analytics give you insight into the usage trends, search quality, and end-user engagement of your app. The console provides an interactive dashboard experience powered by Looker. This page describes how to view analytics for your apps.
Before you begin
Ensure your app is connected to a data store. App metrics are only available from the time a data store is linked to an app.
If you don't have a data store, you need to connect a Google data source or a third-party data source to your app.
User events for analytics
This section describes the user events Agentspace uses to generate the search-related metrics, such as search count and click-through-rate. No additional configurations are needed if you are using the user interface to search and get answers through the Agentspace assistant. However, if you use the Agentspace APIs in your own apps, you must configure the search in your app to capture the user events and then import user events to your app..
Agentspace apps require the following user events to get the metrics:
- Search events.Required for click-through-rate.
- View-item events.Required for click-through-rate.
The following information is also used for some analytics:
- Impressions. You can provide impressions (item views or clicks)
that are attributable to Google by including the associated item
in
UserEvent.Documents
when ingesting user events. This information is needed for attribution and to compute per-search metrics. - Attribution tokens. Attribution tokens are unique IDs generated by
Google and returned with each search request. Make sure to
include that attribution token as
UserEvent.attributionToken
with any user events resulting from a search. This is needed to identify if a search is served by the API. Only user events with a Google-generated attribution token are used to compute metrics. - Search logs. Search logs are based on search requests. To allow Google
to identify user sessions so that it can deliver per-session analytics and
higher quality search results, Google strongly recommends that you set the
optional field
SearchRequest.UserPseudoId
.
If there are no search logs or user events, default values are shown for all metrics.
View Agentspace analytics
You can view search analytics for your app. You see the metrics related to
the search calls made to your app. If your app is connected to multiple data
stores, then making search calls to the app by specifying the engine
resource
is recommended so that you can get results from across all its connected data
stores.
Use the following instructions to view analytics about your app.
-
In the Google Cloud console, go to the Agentspace page.
-
Click the name of the app that you want to view analytics for.
-
Click Analytics.
-
Click a tab to view that metric group:
- Adoption: Metrics on user adoption status.
- Usage and Quality: Metrics on user feedback and app usage.
- Agent: Metrics related to in-app agents, such as deep research, idea forge, and custom agents.
- Value: Metrics on cost savings achieved by users querying data with the app.
See the analytics data for adoption -
To filter your metrics, specify the filters available for the metric tab and then click the Refreshbutton to apply them.
Metrics definitions
The following table describes how metrics are defined.
(public preview)
- If a search result is clicked before a new search is initiated.
- If the response from a search includes a people search result, and isn't followed by another search within two minutes. This is because people-search results are displayed on the search result page and don't typically require a click.
- If the user thumbs-up the answer, the query is considered successful.
- If there is no feedback and the user does not ask another query within 30 seconds, the query is assumed to be successful.
Export metrics
Follow these steps to export the metrics to a BigQuery table in your Google Cloud project:
-
Verify that you have the required permissions and roles.
- You need to have the Discovery Engine Viewer role to be able to call the API.
- Required permissions to create a BigQuery dataset
- Required permissions to create a table .
-
Create a BigQuery dataset:
-
Open the BigQuery page in the Google Cloud console.
-
In the Explorerpanel, select the same project that your Agentspace app is in to create the dataset.
-
Click the option and click Create dataset.
-
On the Create datasetpage:
-
For Dataset ID, enter a unique dataset name . You need the dataset name to export the metrics through the API.
-
For Location type, the following table shows you how to map the BigQuery locations to the Agentspace app locations:
Agentspace app multi-region location BigQuery multi-region location Global US (multiple regions in United States) US (multiple regions in United States) US (multiple regions in United States) EU (multiple regions in the Europe Union) EU (multiple regions in the Europe Union)
-
-
Click Create dataset.
-
-
Create an empty BigQuery table for the dataset you created.
- In the Explorerpanel, expand your project, and then select the dataset you created.
- In the Dataset infosection, click Create table.
- In the Create tablepanel, specify a name for your table in the Tablefield. You need the table name to export the metrics through the API.
- Click Create table.
-
Call the
analytics:exportMetrics
method to retrieve metrics data for the past 30 days, which includes the current day.curl -X POST \ -H "Authorization: Bearer $( gcloud auth print-access-token --project PROJECT_ID ) " \ -H "Content-Type: application/json" \ -H "X-Goog-User-Project: PROJECT_ID " \ -d '{ "analytics": "projects/ PROJECT_ID /locations/global/collections/default_collection/engines/ APP_ID ", "outputConfig": { "bigqueryDestination": { "datasetId": " BIGQUERY_DATASET_ID ", "tableId": " BIGQUERY_TABLE_ID " } } }' \ "https://discoveryengine.googleapis.com/v1alpha/projects/ PROJECT_ID /locations/global/collections/default_collection/engines/ APP_ID /analytics:exportMetrics"
Replace the following:
-
PROJECT_ID
: the ID of your Google Cloud project. -
APP_ID
: the ID of the app that you want to export metrics from. -
BIGQUERY_DATASET_ID
: the ID of the BigQuery dataset you created.
The dataset ID follows the<PROJECT_ID>.<DATASET_ID>
format. You only need to provide the<DATASET_ID>
. -
BIGQUERY_TABLE_ID
: the ID of the BigQuery table you created.
In the Classic explorerview, the table ID follows the<PROJECT_ID>.<DATASET_ID>.<TABLE_ID>
format. You only need to provide the<TABLE_ID>
.
-