Method: properties.chat

Provides a chat interface for interacting with Google Analytics data through the API.

This product uses AI and may display inaccurate info. Your chat activity may be used to improve the product and your use is subject to Google's Terms, AI Use Policy, and Privacy Policy. Learn more about properties.chat AI Privacy.

HTTP request

POST https://analyticsdata.googleapis.com/v1alpha/{property=properties/*}:chat

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
property

string

Required. The property to chat about. Format: properties/{property}

Request body

The request body contains data with the following structure:

JSON representation
{
  "userQuery": string,
  "returnPropertyQuota": boolean,
  "sessionId": string
}
Fields
userQuery

string

Required. The user's query.

returnPropertyQuota

boolean

Optional. If true, the response will include the current state of this Analytics Property's quota. Quota is returned in PropertyChatQuota.

sessionId

string

Optional. Provide this session ID to continue an existing conversation and maintain context. If this field is empty or unset, a new chat session is created. Invalid session IDs will result in an error.

Response body

Response message for the properties.chat method.

If successful, the response body contains data with the following structure:

JSON representation
{
  "sessionId": string,
  "blocks": [
    {
      object (ResponseBlock)
    }
  ],
  "propertyQuota": {
    object (PropertyChatQuota)
  }
}
Fields
sessionId

string

The unique identifier for this chat session. Provide this ID in subsequent requests to maintain conversational context.

blocks[]

object (ResponseBlock)

The response blocks that make up the chat response. This can include text, tables, and lists.

propertyQuota

object (PropertyChatQuota)

This Analytics Property's quota state including this request.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/analytics.chatbot.read

ResponseBlock

One block of structured data in chat response.

JSON representation
{

  // The following is a list of mutually exclusive fields. At most one of the
  // fields will be set in a response:
  "text": string,
  "table": {
    object (DataTable)
  }
  // End of mutually exclusive fields.
}
Fields
One block of structured data. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response:
text

string

A block of text.

table

object (DataTable)

A block of table data.

End of mutually exclusive fields.

DataTable

A table of data.

JSON representation
{
  "headers": [
    {
      object (DataTableHeader)
    }
  ],
  "rows": [
    {
      object (DataTableRow)
    }
  ]
}
Fields
headers[]

object (DataTableHeader)

Describes dimension columns. The number of headers and ordering of headers matches the dimensions present in rows.

rows[]

object (DataTableRow)

Rows of dimension value combinations and metric values in the report.

DataTableHeader

Describes a column header in a DataTable.

JSON representation
{
  "header": string,
  "dataType": string
}
Fields
header

string

The header name.

dataType

string

The data type.

DataTableRow

A row in a DataTable.

JSON representation
{
  "columns": [
    {
      object (DataTableCell)
    }
  ]
}
Fields
columns[]

object (DataTableCell)

The cell values in the row.

DataTableCell

A cell in a data table.

JSON representation
{
  "value": string
}
Fields
value

string

The value of the cell.

PropertyChatQuota

Property quota for chatbot specific fields.

JSON representation
{
  "tokensPerDay": {
    object (QuotaStatus)
  },
  "tokensPerHour": {
    object (QuotaStatus)
  }
}
Fields
tokensPerDay

object (QuotaStatus)

properties.chat tokens consumed per day.

tokensPerHour

object (QuotaStatus)

properties.chat tokens consumed per hour.