Sung Kim
Sung Kim

Reputation: 8536

Is there any way to download the entire google analytics 4 data for a certain period?

I was reading some API documents including https://developers.google.com/analytics/devguides/reporting/data/v1/basics. However, this API allows downloading certain dimensions and metrics.

request = RunReportRequest(
        property=f"properties/{property_id}",
        dimensions=[Dimension(name="country")],
        metrics=[Metric(name="activeUsers")],
        date_ranges=[DateRange(start_date="2020-09-01", end_date="2020-09-15")],
    )

Is there any way to download the entire data as json or something?

Upvotes: 1

Views: 1645

Answers (2)

dikesh
dikesh

Reputation: 3125

"Donwnload the entire data" is a vague statement. First you need to decide what kind of data you need. Aggregated data or Raw data?

Aggregated data e.g. daily / hourly activeUsers, events, sessions etc. can be extracted using Data API as you have already tried. Each API requests accepts fixed number of dimensions and metrics. So as per your business requirements you should decide the dimension-metric combinations and extract the data using the API.

Raw events can be extracted from BigQuery if you have linked GA4 property to it. Here is the BigQuery table schema for that where each row has clientId, timestamp and other event level details which are not available with Data API. Again based on business requirements you can write queries and extract the data.

Upvotes: 2

Brett
Brett

Reputation: 1299

BigQuery Export allows you to download all your raw events. Using the Data API, you could create individual reports with say 5 dimensions & metrics each; then, you could download your data in slices through say 10 of those reports.

BigQuery and the Data API will have different schemas. For example, BigQuery gives the event timestamp, and the most precise time granularity that the Data API gives is hour. So, your decision between the Data API & BigQuery may depend on which dimensions & metrics you need.

What dimensions & metrics are most important to you?

Upvotes: 2

Related Questions