- [Resource: UserEvent](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#UserEvent)
  - [JSON representation](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#UserEvent.SCHEMA_REPRESENTATION)
- [UserInfo](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#UserInfo)
  - [JSON representation](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#UserInfo.SCHEMA_REPRESENTATION)
- [PreciseLocation](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#PreciseLocation)
  - [JSON representation](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#PreciseLocation.SCHEMA_REPRESENTATION)
- [PageInfo](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#PageInfo)
  - [JSON representation](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#PageInfo.SCHEMA_REPRESENTATION)
- [DocumentInfo](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#DocumentInfo)
  - [JSON representation](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#DocumentInfo.SCHEMA_REPRESENTATION)
- [PanelInfo](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#PanelInfo)
  - [JSON representation](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#PanelInfo.SCHEMA_REPRESENTATION)
- [SearchInfo](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#SearchInfo)
  - [JSON representation](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#SearchInfo.SCHEMA_REPRESENTATION)
- [CompletionInfo](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#CompletionInfo)
  - [JSON representation](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#CompletionInfo.SCHEMA_REPRESENTATION)
- [TransactionInfo](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#TransactionInfo)
  - [JSON representation](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#TransactionInfo.SCHEMA_REPRESENTATION)
- [MediaInfo](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#MediaInfo)
  - [JSON representation](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#MediaInfo.SCHEMA_REPRESENTATION)
- [Feedback](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#Feedback)
  - [JSON representation](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#Feedback.SCHEMA_REPRESENTATION)
- [FeedbackType](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#FeedbackType)
- [Reason](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#Reason)
- [ConversationInfo](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#ConversationInfo)
  - [JSON representation](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#ConversationInfo.SCHEMA_REPRESENTATION)
- [FeedbackSource](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#FeedbackSource)
- [ModelArmorDisputeInfo](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#ModelArmorDisputeInfo)
  - [JSON representation](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#ModelArmorDisputeInfo.SCHEMA_REPRESENTATION)
- [Methods](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#METHODS_SUMMARY)

## Resource: UserEvent

UserEvent captures all metadata information Discovery Engine API needs to know about how end users interact with your website.

| JSON representation |
|---|
| ``` { "eventType": string, "conversionType": string, "userPseudoId": string, "engine": string, "dataStore": string, "eventTime": string, "userInfo": { object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#UserInfo`) }, "directUserRequest": boolean, "sessionId": string, "pageInfo": { object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#PageInfo`) }, "attributionToken": string, "filter": string, "documents": [ { object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#DocumentInfo`) } ], "panel": { object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#PanelInfo`) }, "searchInfo": { object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#SearchInfo`) }, "completionInfo": { object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#CompletionInfo`) }, "transactionInfo": { object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#TransactionInfo`) }, "tagIds": [ string ], "promotionIds": [ string ], "attributes": { string: { "text": [ string ], "numbers": [ number ] }, ... }, "mediaInfo": { object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#MediaInfo`) }, "panels": [ { object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#PanelInfo`) } ], "feedback": { object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#Feedback`) }, "entity": string } ``` |

| Fields ||
|---|---|
| `eventType` | `string` Required. User event type. Allowed values are: Generic values: - `search`: Search for Documents. - `view-item`: Detailed page view of a Document. - `view-item-list`: View of a panel or ordered list of Documents. - `view-home-page`: View of the home page. - `view-category-page`: View of a category page, e.g. Home \> Men \> Jeans Retail-related values: - `add-to-cart`: Add an item(s) to cart, e.g. in Retail online shopping - `purchase`: Purchase an item(s) Media-related values: - `media-play`: Start/resume watching a video, playing a song, etc. - `media-complete`: Finished or stopped midway through a video, song, etc. Custom conversion value: - `conversion`: Customer defined conversion event. |
| `conversionType` | `string` Optional. Conversion type. Required if `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#UserEvent.FIELDS.event_type` is `conversion`. This is a customer-defined conversion name in lowercase letters or numbers separated by "-", such as "watch", "good-visit" etc. Do not set the field if `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#UserEvent.FIELDS.event_type` is not `conversion`. This mixes the custom conversion event with predefined events like `search`, `view-item` etc. |
| `userPseudoId` | `string` Required. A unique identifier for tracking visitors. For example, this could be implemented with an HTTP cookie, which should be able to uniquely identify a visitor on a single device. This unique identifier should not change if the visitor log in/out of the website. Do not set the field to the same fixed ID for different users. This mixes the event history of those users together, which results in degraded model quality. The field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an `INVALID_ARGUMENT` error is returned. The field should not contain PII or user-data. We recommend to use Google Analytics [Client ID](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#clientId) for this field. |
| `engine` | `string` The `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.engines#Engine` resource name, in the form of `projects/{project}/locations/{location}/collections/{collectionId}/engines/{engineId}`. Optional. Only required for `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.engines#Engine` produced user events. For example, user events from blended search. |
| `dataStore` | `string` The `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.dataStores#DataStore` resource full name, of the form `projects/{project}/locations/{location}/collections/{collectionId}/dataStores/{dataStoreId}`. Optional. Only required for user events whose data store can't by determined by `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#UserEvent.FIELDS.engine` or `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#UserEvent.FIELDS.documents`. If data store is set in the parent of write/import/collect user event requests, this field can be omitted. |
| `eventTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Only required for `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents/import#google.cloud.discoveryengine.v1.UserEventService.ImportUserEvents` method. Timestamp of when the user event happened. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `userInfo` | ``object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#UserInfo`)`` Information about the end user. |
| `directUserRequest` | `boolean` Should set to true if the request is made directly from the end user, in which case the `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#UserInfo.FIELDS.user_agent` can be populated from the HTTP request. This flag should be set only if the API request is made directly from the end user such as a mobile app (and not if a gateway or a server is processing and pushing the user events). This should not be set when using the JavaScript tag in `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents/collect#google.cloud.discoveryengine.v1.UserEventService.CollectUserEvent`. |
| `sessionId` | `string` A unique identifier for tracking a visitor session with a length limit of 128 bytes. A session is an aggregation of an end user behavior in a time span. A general guideline to populate the sessionId: 1. If user has no activity for 30 min, a new sessionId should be assigned. 2. The sessionId should be unique across users, suggest use uuid or add `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#UserEvent.FIELDS.user_pseudo_id` as prefix. |
| `pageInfo` | ``object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#PageInfo`)`` Page metadata such as categories and other critical information for certain event types such as `view-category-page`. |
| `attributionToken` | `string` Token to attribute an API response to user action(s) to trigger the event. Highly recommended for user events that are the result of `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.servingConfigs/recommend#google.cloud.discoveryengine.v1.RecommendationService.Recommend`. This field enables accurate attribution of recommendation model performance. The value must be one of: - `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/RecommendResponse#FIELDS.attribution_token` for events that are the result of `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.servingConfigs/recommend#google.cloud.discoveryengine.v1.RecommendationService.Recommend`. - `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/SearchResponse#FIELDS.attribution_token` for events that are the result of `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.servingConfigs/search#google.cloud.discoveryengine.v1.SearchService.Search`. This token enables us to accurately attribute page view or conversion completion back to the event and the particular predict response containing this clicked/purchased product. If user clicks on product K in the recommendation results, pass `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/RecommendResponse#FIELDS.attribution_token` as a URL parameter to product K's page. When recording events on product K's page, log the `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/RecommendResponse#FIELDS.attribution_token` to this field. |
| `filter` | `string` Optional. The filter syntax consists of an expression language for constructing a predicate from one or more fields of the documents being filtered. One example is for `search` events, the associated `SearchRequest` may contain a filter expression in `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.servingConfigs/search#body.request_body.FIELDS.filter` conforming to <https://google.aip.dev/160#filtering>. Similarly, for `view-item-list` events that are generated from a `RecommendRequest`, this field may be populated directly from `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.servingConfigs/recommend#body.request_body.FIELDS.filter` conforming to <https://google.aip.dev/160#filtering>. The value must be a UTF-8 encoded string with a length limit of 1,000 characters. Otherwise, an `INVALID_ARGUMENT` error is returned. |
| `documents[]` | ``object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#DocumentInfo`)`` List of `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.dataStores.branches.documents#Document`s associated with this user event. This field is optional except for the following event types: - `view-item` - `add-to-cart` - `purchase` - `media-play` - `media-complete` In a `search` event, this field represents the documents returned to the end user on the current page (the end user may have not finished browsing the whole page yet). When a new page is returned to the end user, after pagination/filtering/ordering even for the same query, a new `search` event with different `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#UserEvent.FIELDS.documents` is desired. |
| `panel` | ``object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#PanelInfo`)`` Panel metadata associated with this user event. |
| `searchInfo` | ``object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#SearchInfo`)`` `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.servingConfigs/search#google.cloud.discoveryengine.v1.SearchService.Search` details related to the event. This field should be set for `search` event. |
| `completionInfo` | ``object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#CompletionInfo`)`` `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores/completeQuery#google.cloud.discoveryengine.v1.CompletionService.CompleteQuery` details related to the event. This field should be set for `search` event when autocomplete function is enabled and the user clicks a suggestion for search. |
| `transactionInfo` | ``object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#TransactionInfo`)`` The transaction metadata (if any) associated with this user event. |
| `tagIds[]` | `string` A list of identifiers for the independent experiment groups this user event belongs to. This is used to distinguish between user events associated with different experiment setups. |
| `promotionIds[]` | `string` The promotion IDs if this is an event associated with promotions. Currently, this field is restricted to at most one ID. |
| `attributes` | `map (key: string, value: object)` Optional. Extra user event features to include in the recommendation model. These attributes must NOT contain data that needs to be parsed or processed further, e.g. JSON or other encodings. If you provide custom attributes for ingested user events, also include them in the user events that you associate with prediction requests. Custom attribute formatting must be consistent between imported events and events provided with prediction requests. This lets the Discovery Engine API use those custom attributes when training models and serving predictions, which helps improve recommendation quality. This field needs to pass all below criteria, otherwise an `INVALID_ARGUMENT` error is returned: - The key must be a UTF-8 encoded string with a length limit of 5,000 characters. - For text attributes, at most 400 values are allowed. Empty values are not allowed. Each value must be a UTF-8 encoded string with a length limit of 256 characters. - For number attributes, at most 400 values are allowed. For product recommendations, an example of extra user information is `traffic_channel`, which is how a user arrives at the site. Users can arrive at the site by coming to the site directly, coming through Google search, or in other ways. |
| `attributes.text[]` | `string` The textual values of this custom attribute. For example, `["yellow", "green"]` when the key is "color". Empty string is not allowed. Otherwise, an `INVALID_ARGUMENT` error is returned. Exactly one of `CustomAttribute.text` or `CustomAttribute.numbers` should be set. Otherwise, an `INVALID_ARGUMENT` error is returned. |
| `attributes.numbers[]` | `number` The numerical values of this custom attribute. For example, `[2.3, 15.4]` when the key is "lengths_cm". Exactly one of `CustomAttribute.text` or `CustomAttribute.numbers` should be set. Otherwise, an `INVALID_ARGUMENT` error is returned. |
| `mediaInfo` | ``object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#MediaInfo`)`` Media-specific info. |
| `panels[]` | ``object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#PanelInfo`)`` Optional. List of panels associated with this event. Used for page-level impression data. |
| `feedback` | ``object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#Feedback`)`` Optional. This field is optional except for the `add-feedback` event types. |
| `entity` | `string` Optional. Represents the entity for customers that may run multiple different entities, domains, sites or regions, for example, `Google US`, `Google Ads`, `Waymo`, `google.com`, `youtube.com`, etc. We recommend that you set `entity` to get better per-entity search, completion, and prediction results. |

## UserInfo

Information of an end user.

| JSON representation |
|---|
| ``` { "userId": string, "userAgent": string, "timeZone": string, "preciseLocation": { object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#PreciseLocation`) } } ``` |

| Fields ||
|---|---|
| `userId` | `string` Highly recommended for logged-in users. Unique identifier for logged-in user, such as a user name. Don't set for anonymous users. Always use a hashed value for this ID. Don't set the field to the same fixed ID for different users. This mixes the event history of those users together, which results in degraded model quality. The field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an `INVALID_ARGUMENT` error is returned. Represents an opaque ID to the Search API. The Search API doesn't interpret the value in any way. This field is used to associate events with a user across sessions if the events are being uploaded. |
| `userAgent` | `string` User agent as included in the HTTP header. The field must be a UTF-8 encoded string with a length limit of 1,000 characters. Otherwise, an `INVALID_ARGUMENT` error is returned. This should not be set when using the client side event reporting with GTM or JavaScript tag in `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents/collect#google.cloud.discoveryengine.v1.UserEventService.CollectUserEvent` or if `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#UserEvent.FIELDS.direct_user_request` is set. |
| `timeZone` | `string` Optional. IANA time zone, e.g. Europe/Budapest. |
| `preciseLocation` | ``object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#PreciseLocation`)`` Optional. Input only. Precise location of the user. It is used in Custom Ranking to calculate the distance between the user and the relevant documents. |

## PreciseLocation

Precise location info with multiple representation options.

| JSON representation |
|---|
| ``` { // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "point": { object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/Shared.Types/LatLng`) }, "address": string // End of mutually exclusive fields. } ``` |

| Fields ||
|---|---|
| The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `point` | ``object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/Shared.Types/LatLng`)`` Optional. location represented by a latitude/longitude point. |
| `address` | `string` location represented by a natural language address. Will later be geocoded and converted to either a point or a polygon. |
| End of mutually exclusive fields. ||

## PageInfo

Detailed page information.

| JSON representation |
|---|
| ``` { "pageviewId": string, "pageCategory": string, "uri": string, "referrerUri": string } ``` |

| Fields ||
|---|---|
| `pageviewId` | `string` A unique ID of a web page view. This should be kept the same for all user events triggered from the same pageview. For example, an item detail page view could trigger multiple events as the user is browsing the page. The `pageviewId` property should be kept the same for all these events so that they can be grouped together properly. When using the client side event reporting with JavaScript pixel and Google Tag Manager, this value is filled in automatically. |
| `pageCategory` | `string` The most specific category associated with a category page. To represent full path of category, use '\>' sign to separate different hierarchies. If '\>' is part of the category name, replace it with other character(s). Category pages include special pages such as sales or promotions. For instance, a special sale page may have the category hierarchy: `"pageCategory" : "Sales > 2017 Black Friday Deals"`. Required for `view-category-page` events. Other event types should not set this field. Otherwise, an `INVALID_ARGUMENT` error is returned. |
| `uri` | `string` Complete URL (window.location.href) of the user's current page. When using the client side event reporting with JavaScript pixel and Google Tag Manager, this value is filled in automatically. Maximum length 5,000 characters. |
| `referrerUri` | `string` The referrer URL of the current page. When using the client side event reporting with JavaScript pixel and Google Tag Manager, this value is filled in automatically. However, some browser privacy restrictions may cause this field to be empty. |

## DocumentInfo

Detailed document information associated with a user event.

| JSON representation |
|---|
| ``` { "promotionIds": [ string ], "joined": boolean, // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "id": string, "name": string, "uri": string // End of mutually exclusive fields. "quantity": integer, "conversionValue": number } ``` |

| Fields ||
|---|---|
| `promotionIds[]` | `string` The promotion IDs associated with this Document. Currently, this field is restricted to at most one ID. |
| `joined` | `boolean` Output only. Whether the referenced Document can be found in the data store. |
| A required descriptor of the associated `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.dataStores.branches.documents#Document`. - If `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#DocumentInfo.FIELDS.id` is specified, then the default values for `{location}`, `{collection_id}`, `{data_store_id}`, and `{branch_id}` are used when annotating with the stored Document. - If `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#DocumentInfo.FIELDS.name` is specified, then the provided values (default values allowed) for `{location}`, `{collection_id}`, `{data_store_id}`, and `{branch_id}` are used when annotating with the stored Document. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `id` | `string` The `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.dataStores.branches.documents#Document` resource ID. |
| `name` | `string` The `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.dataStores.branches.documents#Document` resource full name, of the form: `projects/{project}/locations/{location}/collections/{collectionId}/dataStores/{dataStoreId}/branches/{branchId}/documents/{documentId}` |
| `uri` | `string` The `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.dataStores.branches.documents#Document` URI - only allowed for website data stores. |
| End of mutually exclusive fields. ||
| `quantity` | `integer` Quantity of the Document associated with the user event. Defaults to 1. For example, this field is 2 if two quantities of the same Document are involved in a `add-to-cart` event. Required for events of the following event types: - `add-to-cart` - `purchase` |
| `conversionValue` | `number` Optional. The conversion value associated with this Document. Must be set if `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#UserEvent.FIELDS.event_type` is "conversion". For example, a value of 1000 signifies that 1000 seconds were spent viewing a Document for the `watch` conversion type. |

## PanelInfo

Detailed panel information associated with a user event.

| JSON representation |
|---|
| ``` { "panelId": string, "displayName": string, "documents": [ { object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#DocumentInfo`) } ], "panelPosition": integer, "totalPanels": integer } ``` |

| Fields ||
|---|---|
| `panelId` | `string` Required. The panel ID. |
| `displayName` | `string` The display name of the panel. |
| `documents[]` | ``object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#DocumentInfo`)`` Optional. The document IDs associated with this panel. |
| `panelPosition` | `integer` The ordered position of the panel, if shown to the user with other panels. If set, then `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#PanelInfo.FIELDS.total_panels` must also be set. |
| `totalPanels` | `integer` The total number of panels, including this one, shown to the user. Must be set if `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#PanelInfo.FIELDS.panel_position` is set. |

## SearchInfo

Detailed search information.

| JSON representation |
|---|
| ``` { "searchQuery": string, "orderBy": string, "offset": integer } ``` |

| Fields ||
|---|---|
| `searchQuery` | `string` Optional. The user's search query. See `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.servingConfigs/search#body.request_body.FIELDS.query` for definition. The value must be a UTF-8 encoded string with a length limit of 5,000 characters. Otherwise, an `INVALID_ARGUMENT` error is returned. At least one of `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#SearchInfo.FIELDS.search_query` or `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#PageInfo.FIELDS.page_category` is required for `search` events. Other event types should not set this field. Otherwise, an `INVALID_ARGUMENT` error is returned. |
| `orderBy` | `string` The order in which products are returned, if applicable. See `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.servingConfigs/search#body.request_body.FIELDS.order_by` for definition and syntax. The value must be a UTF-8 encoded string with a length limit of 1,000 characters. Otherwise, an `INVALID_ARGUMENT` error is returned. This can only be set for `search` events. Other event types should not set this field. Otherwise, an `INVALID_ARGUMENT` error is returned. |
| `offset` | `integer` An integer that specifies the current offset for pagination (the 0-indexed starting location, amongst the products deemed by the API as relevant). See `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.servingConfigs/search#body.request_body.FIELDS.offset` for definition. If this field is negative, an `INVALID_ARGUMENT` is returned. This can only be set for `search` events. Other event types should not set this field. Otherwise, an `INVALID_ARGUMENT` error is returned. |

## CompletionInfo

Detailed completion information including completion attribution token and clicked completion info.

| JSON representation |
|---|
| ``` { "selectedSuggestion": string, "selectedPosition": integer } ``` |

| Fields ||
|---|---|
| `selectedSuggestion` | `string` Optional. End user selected `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/CompleteQueryResponse#QuerySuggestion.FIELDS.suggestion`. |
| `selectedPosition` | `integer` End user selected `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/CompleteQueryResponse#QuerySuggestion.FIELDS.suggestion` position, starting from 0. |

## TransactionInfo

A transaction represents the entire purchase transaction.

| JSON representation |
|---|
| ``` { "currency": string, "transactionId": string, "value": number, "tax": number, "cost": number, "discountValue": number } ``` |

| Fields ||
|---|---|
| `currency` | `string` Required. Currency code. Use three-character ISO-4217 code. |
| `transactionId` | `string` The transaction ID with a length limit of 128 characters. |
| `value` | `number` Required. Total non-zero value associated with the transaction. This value may include shipping, tax, or other adjustments to the total value that you want to include. |
| `tax` | `number` All the taxes associated with the transaction. |
| `cost` | `number` All the costs associated with the products. These can be manufacturing costs, shipping expenses not borne by the end user, or any other costs, such that: - Profit = `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#TransactionInfo.FIELDS.value` - `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#TransactionInfo.FIELDS.tax` - `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#TransactionInfo.FIELDS.cost` |
| `discountValue` | `number` The total discount(s) value applied to this transaction. This figure should be excluded from `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#TransactionInfo.FIELDS.value` For example, if a user paid `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#TransactionInfo.FIELDS.value` amount, then nominal (pre-discount) value of the transaction is the sum of `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#TransactionInfo.FIELDS.value` and `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#TransactionInfo.FIELDS.discount_value` This means that profit is calculated the same way, regardless of the discount value, and that `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#TransactionInfo.FIELDS.discount_value` can be larger than `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#TransactionInfo.FIELDS.value`: - Profit = `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#TransactionInfo.FIELDS.value` - `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#TransactionInfo.FIELDS.tax` - `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#TransactionInfo.FIELDS.cost` |

## MediaInfo

Media-specific user event information.

| JSON representation |
|---|
| ``` { "mediaProgressDuration": string, "mediaProgressPercentage": number } ``` |

| Fields ||
|---|---|
| `mediaProgressDuration` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#duration` format)`` The media progress time in seconds, if applicable. For example, if the end user has finished 90 seconds of a playback video, then `https://protobuf.dev/reference/protobuf/google.protobuf#duration` should be set to 90. A duration in seconds with up to nine fractional digits, ending with '`s`'. Example: `"3.5s"`. |
| `mediaProgressPercentage` | `number` Media progress should be computed using only the `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#MediaInfo.FIELDS.media_progress_duration` relative to the media total length. This value must be between `[0, 1.0]` inclusive. If this is not a playback or the progress cannot be computed (e.g. ongoing livestream), this field should be unset. |

## Feedback

Information about the user feedback. This information will be used for logging and metrics purpose.

| JSON representation |
|---|
| ``` { "feedbackType": enum (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#FeedbackType`), "reasons": [ enum (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#Reason`) ], "comment": string, "conversationInfo": { object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#ConversationInfo`) }, "llmModelVersion": string, "feedbackSource": enum (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#FeedbackSource`), "componentVersion": string, "dataTermsAccepted": boolean, "modelArmorDisputeInfo": { object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#ModelArmorDisputeInfo`) } } ``` |

| Fields ||
|---|---|
| `feedbackType` | ``enum (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#FeedbackType`)`` Required. Indicates whether the user gives a positive or negative feedback. |
| `reasons[]` | ``enum (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#Reason`)`` Optional. The reasons why the user gives feedback. |
| `comment` | `string` Optional. The additional user comment of the feedback. |
| `conversationInfo` | ``object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#ConversationInfo`)`` The related conversation information when user gives feedback. |
| `llmModelVersion` | `string` The version of the LLM model that was used to generate the response. |
| `feedbackSource` | ``enum (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#FeedbackSource`)`` Optional. The UI component the user feedback comes from, which could be GOOGLE_CONSOLE, GOOGLE_WIDGET, GOOGLE_WEBAPP. |
| `componentVersion` | `string` Optional. The version of the component that this report is being sent from. |
| `dataTermsAccepted` | `boolean` Optional. Whether the customer accepted data use terms. |
| `modelArmorDisputeInfo` | ``object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents#ModelArmorDisputeInfo`)`` Optional. Optional Model Armor false-positive dispute metadata attached to feedback. |

## FeedbackType

The type of the feedback user gives.

| Enums ||
|---|---|
| `FEEDBACK_TYPE_UNSPECIFIED` | Unspecified feedback type. |
| `LIKE` | The user gives a positive feedback. |
| `DISLIKE` | The user gives a negative feedback. |

## Reason

The reason why the user gives feedback.

| Enums ||
|---|---|
| `REASON_UNSPECIFIED` | Unspecified reason. |
| `INACCURATE_RESPONSE` | The response is inaccurate. |
| `NOT_RELEVANT` | The response is not relevant. |
| `INCOMPREHENSIVE` | The response is incomprehensive. |
| `OFFENSIVE_OR_UNSAFE` | The response is offensive or unsafe. |
| `FORMAT_AND_STYLES` | The response is not well-formatted. |
| `BAD_CITATION` | The response is not well-associated with the query. |
| `CANVAS_NOT_GENERATED` | The expected canvas was not generated for the response. |
| `CANVAS_QUALITY_BAD` | The generated canvas is of bad quality (e.g. inaccurate, incomplete, poorly formatted). |
| `CANVAS_EXPORT_FAILED` | Exporting the generated canvas failed (e.g. download or external export action did not complete successfully). |
| `RELEVANT` | The response is relevant. |
| `COMPREHENSIVE` | The response is comprehensive. |
| `GOOD_CITATION` | The response is well-associated with the query. |
| `ACCURATE` | The response is accurate. |

## ConversationInfo

The conversation information such as the question index and session name.

| JSON representation |
|---|
| ``` { "questionIndex": integer, "session": string, "query": { object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/Query`) }, "assistToken": string, "answerQueryToken": string, "taskName": string, "trajectoryId": string, "stepSeqNum": string } ``` |

| Fields ||
|---|---|
| `questionIndex` | `integer` The index of the user input within the conversation messages. |
| `session` | `string` Name of the newly generated or continued session. |
| `query` | ``object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/Query`)`` Required. The user's search query. |
| `assistToken` | `string` Optional. The token which could be used to fetch the assistant log. |
| `answerQueryToken` | `string` Optional. The token which could be used to fetch the answer log. |
| `taskName` | `string` Optional. The full resource name of the Sobi task if the conversation was handled by a long-running agent task. Format (canonical, or the short alias the Task API also accepts): projects/{project}/locations/{location}/agents/{agent}/tasks/{task} projects/{project}/locations/{location}/tasks/{task} |
| `trajectoryId` | `string` Optional. The runtime trajectory ID of the rated agent task turn, as set on `TaskServerEvent.trajectory_id`. Shared by all steps of the turn. |
| `stepSeqNum` | `string (https://developers.google.com/discovery/v1/type-format format)` Optional. The `TaskServerEvent.seq_num` of the step that opened the rated agent task reply. |

## FeedbackSource

Source of the feedback as per integration.

| Enums ||
|---|---|
| `FEEDBACK_SOURCE_UNSPECIFIED` | Unspecified feedback source. |
| `GOOGLE_CONSOLE` | Feedback source is Google Console. |
| `GOOGLE_WIDGET` | Feedback source is Google Widget. |
| `GOOGLE_WEBAPP` | Feedback source is Google Webapp. |
| `GOOGLE_AGENTSPACE_MOBILE` | Feedback source is Google AgentSpace Mobile app. |
| `GOOGLE_AGENTSPACE_DESKTOP` | Feedback source is Google AgentSpace Desktop app. |

## ModelArmorDisputeInfo

Information submitted when a user disputes a Model Armor `BLOCK` or `FLAG` verdict.

| JSON representation |
|---|
| ``` { "expectedLabel": string, "templateName": string, "sanitizationResultJson": string } ``` |

| Fields ||
|---|---|
| `expectedLabel` | `string` Optional. The expected-label reason chip selected by the user (for example, "Everyday question" or "Legitimate work-related query"). |
| `templateName` | `string` Optional. Resource name of the Model Armor template that produced the sanitization result, in the format `projects/{project}/locations/{location}/templates/{id}`. |
| `sanitizationResultJson` | `string` Optional. The raw Model Armor `SanitizationResult`, serialized as JSON. |

| ## Methods ||
|---|---|
| ### `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents/collect` | Writes a single user event from the browser. |
| ### `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents/import` | Bulk import of user events. |
| ### `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents/purge` | Deletes permanently all user events specified by the filter provided. |
| ### `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.userEvents/write` | Writes a single user event. |