Google Analytics 4 (GA4) Reporting - AgenticBI Integration

AgenticBI lets you explore, visualize, transform, warehouse, and automate reporting on your Google Analytics 4 data, and merge it with data from your other sources.

Overview

Connect, extract, and transform your Google Analytics 4 data directly from the AgenticBI UI, then visualize it and automate your reporting.

UI-Based Approach

Connecting

  1. Log in to AgenticBI and select Queries from the left sidebar.

  2. Click New Datasource + and select Google Analytics 4 from the list of datasources.

  3. Authorize AgenticBI with the Google account connected to your Google Analytics property.

  4. Enter the following details:

    a. Datasource name: A name that identifies this datasource.

    b. Google Analytics Profile ID: The Property ID of the Google Analytics property you want to query. To find it, see the Property ID documentation.

    c. Refresh Token: The token returned by Google when you authorized access. AgenticBI uses it to connect and pull your GA reports. You can revoke access at any time at https://www.google.com/settings/u/1/security.

  5. Click Save and start querying.

adding-ga4

Query

After you connect, AgenticBI loads the list of available metrics and dimensions, along with sample values. Use them to build queries in the visual builder without writing code, either by dragging and dropping fields or by choosing from the drop-down lists.

Metrics: The metrics you want to track. Choose from the drop-down or type them in. See the API Schema for the full list of metrics.

Dimensions: The fields used to group the selected metrics. For example, grouping by the "browser" dimension returns the metrics for each browser. For more information, see Dimension Filters.

Filter Dimensions: Conditions applied to the data before it is aggregated. Use these to narrow the dataset without changing how the results are grouped. Filter dimensions are passed to the GA4 API as dimensionFilters only, so they do not appear as columns in the results. For example, you can limit results to one country without adding country as a grouping column.

Start Date and End Date: The period to pull data for. Enter a date in the format yyyy-MM-dd, or a relative date such as today, yesterday, or NdaysAgo, where N is a positive integer. Use either a start and end date or a date range, not both.

Date Range: The period to pull data for, relative to now. Leave this empty if you set a start and end date. Enter a number followed by a unit: y for years, m for months, w for weeks, d for days, h for hours, or min for minutes. For example, 3m is the last 3 months. The following values are supported:

Date Range Op Comments
min Date range of n minutes back from now. Example (10 minutes): 10min
d Date range of n days back from today. Example (up to 120 days): 120d
w Date range of n weeks back from today. Example (up to 10 weeks): 10w
m Date range of n months back from today. Example (up to 3 months): 3m
y Date range of n years back from today. Example (up to 1 year): 1y
today Midnight of today until now
yesterday Midnight of yesterday until now
this hour The start of the current hour until now
this week Midnight of Monday of the current week until now
this month Midnight of the 1st of the current month until now
last hour The previous hour, from 0 minutes and 0 seconds until now
last week Midnight of Monday of the previous week until now
last month Midnight of the 1st of the previous month until now

Max Results: The maximum number of records to pull. Google Analytics allows up to 10,000 rows per data pull.

Sort By Field: The field to sort the returned data by. For example, sessions sorts ascending and -sessions sorts descending.

query-ga4

Note: You can also transform the results with Cloud9QL.

Data Execution Strategy

Choose how the query runs:

  • Direct Execution: Runs the query directly on the original datasource, with nothing stored in between. Each time a widget is displayed, it fetches the data in real time from the underlying datasource.

  • Non-Direct Execution: Stores the results in AgenticBI's Elastic Store. This is useful for long-running queries and reduces the load on your datasource. Non-direct queries can run once or on a schedule.

For more information, see Defining Data Execution Strategy.

data-strategy

Preview and Create the Dataset

Click Preview to check the results of your query and fine-tune the output if needed.

preview

The result of a query is called a Dataset. When you are happy with the results, name your dataset and click Create & Run.

dataset created