# Google Analytics

Run Google Analytics 4 reports and realtime reports, and look up accounts, properties, data streams and the dimensions and metrics a property offers.

## Connect Google Analytics

1. In the sidebar, open **Connections** and press **Add connection**.
2. Type `google analytics` and choose **Google Analytics**.
3. Press **Sign in with Google**.
4. Choose your account in Google’s window and allow access.

You should see **Signed in as** and the account’s address.

You can also connect from a step: under **Connection**, press **New**.

**What if it says “Google sign-in isn’t set up here”?**

This installation has no Google app yet. An admin of the installation sees **Set up Google sign-in** instead, and sets it up once for everyone:

1. In Google Cloud, create an OAuth client of type **Web application**, and turn on the API for Google Analytics.
2. In GoRunner, copy the **Redirect address to add in Google Cloud**, and add it to the client.
3. Paste the **Client ID** and **Client secret**, then press **Save and sign in**.

Publish the app in Google Cloud. An app left in Testing signs everyone out after 7 days.

Everyone else sees who to ask.

[Set up Google sign-in for connections](https://docs.gorunner.io/self-host/oauth-apps)

**Can I use my own Google app?**

Yes. In the sheet, open **Use your own Google app** and paste its **Client ID** and **Client secret**. Add the **Redirect address to add in Google Cloud** to your app first. The connection then signs in through your app instead of the installation’s.

[Connections](https://docs.gorunner.io/build/connections) says how to sign in again, rename or delete it. In a product that embeds GoRunner, **Add connection** can be missing: then [your provider makes connections](https://docs.gorunner.io/embed/customer-connections) for you.

## Do things in Google Analytics

Add a **Google Analytics** step, choose a **Resource**, then an **Operation**. Choose a row to see its fields.

- [Report](https://docs.gorunner.io/apps/google-analytics#fields-f-report): Get · Get Realtime
- [Dimensions and Metrics](https://docs.gorunner.io/apps/google-analytics#fields-f-metadata): Get
- [Account](https://docs.gorunner.io/apps/google-analytics#fields-f-account): Get Many
- [Property](https://docs.gorunner.io/apps/google-analytics#fields-f-property): Get · Get Many
- [Data Stream](https://docs.gorunner.io/apps/google-analytics#fields-f-datastream): Get Many

To start a workflow from Google Analytics, use a [Schedule](https://docs.gorunner.io/apps/schedule), [Webhook](https://docs.gorunner.io/apps/webhook) or [Form](https://docs.gorunner.io/apps/form) trigger.

Later steps read a step’s output by its name: see [Use data from earlier steps](https://docs.gorunner.io/build/use-data-from-earlier-steps).

## Limits

- A reply from Google Analytics can be up to 16 MB (a file download can have its own limit). A larger one fails the step; it is never cut short.
- When Google Analytics says to slow down (429), the step waits as long as it asks, if the step’s time allows. Otherwise it fails and says when to try again.

Not in your list? See [When an app isn’t here](https://docs.gorunner.io/apps/when-an-app-isnt-here#q-not-in-list).

## For developers

In the API, which calls apps pieces, Google Analytics is `pieceId: "googleanalytics"` with `actionId: "googleanalytics"`, set by `resource` and an `operation_…` field, such as `operation_account`. [Get an app](https://docs.gorunner.io/api/apps/get-app) returns every field.

It reads from outside without changing anything (`reads_external`). See [How versions and side effects work](https://docs.gorunner.io/apps#q-versions).

### Google Analytics › Report

### Get

- **Property · Required**: The Google Analytics 4 property.
- **Date Range · Optional**: The days to report on, in the property's time zone. The "last" ranges end yesterday. Options: Last 7 days, Last 28 days, Last 30 days, Last 90 days, Today, Yesterday, Custom. Default: Last 7 days.
- **Start Date · Required**: YYYY-MM-DD, or today, yesterday or NdaysAgo (such as 14daysAgo). Shows when **Date Range** is **Custom**.
- **End Date · Required**: YYYY-MM-DD, or today, yesterday or NdaysAgo. Shows when **Date Range** is **Custom**.
- **Metrics · Optional**: What to count, such as activeUsers, sessions, screenPageViews, conversions, totalRevenue.
- **Dimensions · Optional**: What to break the numbers down by, such as date, country, pagePath, sessionSource (up to 9).
- **Dimension Filter · Optional**: Keep only rows matching a GA4 filter expression, such as {"filter": {"fieldName": "country", "stringFilter": {"value": "Germany"}}}.
- **Metric Filter · Optional**: Keep only rows whose metrics match, applied after counting, such as {"filter": {"fieldName": "sessions", "numericFilter": {"operation": "GREATER_THAN", "value": {"int64Value": "10"}}}}.
- **Sort By · Optional**: Metrics or dimensions to order the rows by, comma-separated; a leading minus sorts high to low, such as -sessions, date.
- **Totals · Optional**: Also return each metric's total, maximum or minimum over all rows. Options: Total, Maximum, Minimum.
- **Keep Empty Rows · Optional**: Also return rows whose metrics are all 0. Off by default.
- **Currency · Optional**: ISO 4217 code for revenue metrics, such as EUR. Empty uses the property's currency.
- **Simplify · Optional**: Return each row as one object of dimension and metric values by name, numbers as numbers. Off returns the rows as Google sends them. On by default.
- **Return All · Optional**: Read every row, page by page (at most 50000; past that the step fails rather than stop early). Off by default.
- **Limit · Optional**: How many rows to return (1–50000). Default: 100. Shows when **Return All** is off.

### Get Realtime

- **Property · Required**: The Google Analytics 4 property.
- **Last Minutes · Optional**: How many of the last minutes to report on: up to 30 (60 on Google Analytics 360). Default: 30.
- **Metrics · Optional**: What to count, such as activeUsers, sessions, screenPageViews, conversions, totalRevenue.
- **Dimensions · Optional**: What to break the numbers down by, such as date, country, pagePath, sessionSource (up to 9).
- **Dimension Filter · Optional**: Keep only rows matching a GA4 filter expression, such as {"filter": {"fieldName": "country", "stringFilter": {"value": "Germany"}}}.
- **Metric Filter · Optional**: Keep only rows whose metrics match, applied after counting, such as {"filter": {"fieldName": "sessions", "numericFilter": {"operation": "GREATER_THAN", "value": {"int64Value": "10"}}}}.
- **Sort By · Optional**: Metrics or dimensions to order the rows by, comma-separated; a leading minus sorts high to low, such as -sessions, date.
- **Totals · Optional**: Also return each metric's total, maximum or minimum over all rows. Options: Total, Maximum, Minimum.
- **Simplify · Optional**: Return each row as one object of dimension and metric values by name, numbers as numbers. Off returns the rows as Google sends them. On by default.
- **Return All · Optional**: Read every row, page by page (at most 50000; past that the step fails rather than stop early). Off by default.
- **Limit · Optional**: How many rows to return (1–50000). Default: 100. Shows when **Return All** is off.

### Google Analytics › Dimensions and Metrics

### Get

- **Property · Optional**: The property whose dimensions and metrics to list. Empty lists the ones every property has.

### Google Analytics › Account

### Get Many

- **Return All · Optional**: Read every account, page by page (at most 2000; past that the step fails rather than stop early). Off by default.
- **Limit · Optional**: How many accounts to return (1–2000). Default: 50. Shows when **Return All** is off.

### Google Analytics › Property

### Get

- **Property · Required**: The Google Analytics 4 property.

### Get Many

- **Account · Optional**: Only the properties of this account. Empty lists the properties of every account.
- **Return All · Optional**: Read every property, page by page (at most 2000; past that the step fails rather than stop early). Off by default.
- **Limit · Optional**: How many propertys to return (1–2000). Default: 50. Shows when **Return All** is off.

### Google Analytics › Data Stream

### Get Many

- **Property · Required**: The Google Analytics 4 property.
- **Return All · Optional**: Read every data stream, page by page (at most 2000; past that the step fails rather than stop early). Off by default.
- **Limit · Optional**: How many data streams to return (1–2000). Default: 50. Shows when **Return All** is off.

Source: https://docs.gorunner.io/apps/google-analytics
