Attribute

DefaultQueryOptions (dqo)

Purpose

Specifies the values of Google Analytics 4 query parameters for WHERE clause filtering during a session. Providing values for these parameters simplifies queries.

Valid Values

(key=value[;key=value])

where:

key

is one of the following query parameters:

  • startDate: The inclusive starting date for the query with Report API. The default is 30daysago (thirty days prior to the current date).
  • endDate: The inclusive ending date for the query with Report API. The default is yesterday (the day prior to the current date).
  • startMinutesAgo: The inclusive start minutes for the query with Realtime Report API. The default is 29 (twenty-nine minutes prior to the current time).
  • endMinutesAgo: The inclusive end minutes for the query with Realtime report API. The default is 0 (current time).
  • currencyCode: A currency code in ISO4217 format, such as AED, USD, JPY. If the field is empty, the Report API uses the property's default currency. There is no default.
  • keepEmptyRows: If set to false or unspecified, each row with all metrics equal to 0 will not be returned with Report API. If set to true, these rows will be returned if they are not separately removed by a filter. The default is false.
  • returnPropertyQuota: If set to true, Report or Realtime API will return the current state of this Analytics Property's quota. The default is false.
  • accountId: A Google Analytics 4 Account ID. An Account ID is needed for analytics admin APIs. There is no default.
  • propertyId: A Google Analytics 4 Property ID. A Property ID is needed for analytics data APIs. A Property ID can be obtained from your Google Analytics dashboard (Dashboard>Admin>Property>Property Settings>PROPERTY ID). There is no default.

Notes

  • Important: In order for SELECT * FROM to work in a query with the Data API, propertyId must be specified. If propertyId is not specified using DefaultQueryOptions, then it must be set explicitly in the WHERE clause.

  • Important: In order for SELECT * FROM to work in a query with the Admin API, accountId must be specified. If accountId is not specified using DefaultQueryOptions, then it must be set explicitly in the WHERE clause.

  • The syntax for startDate and endDate values is as follows:

    • A date in the format YYYY-MM-DD
    • The word today for the current date
    • The word yesterday for the day prior to the current date
    • nndaysAgo where nn is a number of days prior to the current date

Default Value

If no value is specified (the default), the driver uses the following values: startDate=30daysAgo;endDate=yesterday;startMinutesAgo=29;endMinutesAgo=0.