The Google Analytics Data API v1 gives you programmatic access to Google Analytics 4 (GA4) report data. Google Analytics 4 helps you understand how people use your web, iOS, or Android app. Learn more about Google Analytics 4 properties.
With the Google Analytics Data API v1, you can create reports to answer questions like:
- How many daily active users has my Android app had in the last week?
- How many page views has each of the top 10 page URLs for my site received in the last 28 days?
- How many active users per country has my iOS app had in the last 30 minutes?
The Google Analytics Data API v1 can also be used to:
- Build custom dashboards to display Google Analytics data.
- Automate complex reporting tasks to save time.
- Integrate your Google Analytics data with other business applications.
Quick start guide
Calling the API to create your first report is just a few lines of code away. See the quick start using client libraries to get started. There are client libraries in Java, Python, Node.js, and other languages to simplify your implementation.
- 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 allows generating 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 allows generating 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.
- 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).
- 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
The API schema documentation lists the dimensions and metrics currently supported by the Analytics Data API.