Google Analytics 4 Data API Overview

You can use the Data API to programmatically access Google Analytics 4 (GA4) report data. This API isn't compatible with legacy Universal Analytics properties.

Learn more about Google Analytics 4 properties.

Here are some examples you might report on using the Google Analytics Data API v1:

  • How many daily active users has your Android app had in the last week.
  • How many page views the top 10 pages on your site had in the last 28 days.
  • How many active users per country your iOS app had in the last 30 minutes.

You can also use the Google Analytics Data API v1 to do the following:

  • Build custom dashboards to display Google Analytics data.
  • Automate complex reporting tasks to save time.
  • Integrate your Google Analytics data with other business applications.

Get started

To get started, see the client library quickstart. There are client libraries in Java, Python, Node.js, and other languages to simplify your implementation.

Available methods

Here's a list of the Data API methods. For more details, see the reference documentation.

  • runReport This method returns a customized report of your Google Analytics event data and is the preferred method for simple report queries.
  • batchRunReports This is a batch version of the runReport method which lets you generate multiple reports using a single API call.
  • runPivotReport This method returns a customized pivot report of you Google Analytics event data. Pivot reports are more advanced and expressive formats than regular reports. Each pivot describes the visible dimension columns and rows in the report response.
  • batchRunPivotReports This is a batch version of the runPivotReport method which lets you generate multiple reports using a single API call.
  • getMetadata This method returns metadata for dimensions and metrics available in reporting methods. Used to explore the dimensions and metrics. The response of this method also includes the Custom dimensions and metrics available for the specified GA4 property.
  • checkCompatibility This method lists dimensions and metrics that can be added to a report request and maintain compatibility.
  • runRealtimeReport This method returns a customized report of realtime event data for your property. Events appear in realtime reports seconds after they have been sent to the Google Analytics. Realtime reports show events and usage data for the periods of time ranging from the present moment to 30 minutes ago (up to 60 minutes for Google Analytics 360 properties).
  • properties.audienceExports A group of methods that let you generate Audience Exports, which include a snapshot of the users in an audience.
  • properties.recurringAudienceLists (Early preview) A group of methods that let you manage recurring Audience Exports. A recurring audience export produces new audience lists each day.
  • runFunnelReport (Early preview) This method returns a customized funnel report of your Google Analytics event data. Funnel exploration lets you visualize the steps your users take to complete a task and quickly see how well they are succeeding or failing at each step.

Supported dimensions and metrics

For a list of all the dimesions and metrics supported by the Data API, see the API schema documentation.