> ## Documentation Index
> Fetch the complete documentation index at: https://docs.modulex.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Analytics Integration for AI Agents & Workflows

> Manage Google Analytics 4 properties, list accounts, configure key events, and run analytics reports against the Google Analytics Admin and Data APIs.

{/* Self-hosted logo — build-time vendored from modulex.json / Iconify (see scripts/lib/logo.js). */}

<img src="https://mintcdn.com/modulexaillc/zKB2qsP6Q61VNLfB/logos/google-analytics.svg?fit=max&auto=format&n=zKB2qsP6Q61VNLfB&q=85&s=2b811131cc5a96732a281ac8f39fe414" alt="Google Analytics logo" width="72" height="72" data-path="logos/google-analytics.svg" />

## Overview

Add **Google Analytics** to any ModuleX agent or workflow. Manage Google Analytics 4 properties, list accounts, configure key events, and run analytics reports against the Google Analytics Admin (`analyticsadmin.googleapis.com`) and Data (`analyticsdata.googleapis.com`) APIs.

<Info>
  **Categories**: Analytics & Data · Analytics & Reporting · Marketing · Productivity & Collaboration · **Auth**: OAuth2 · **Actions**: 6
</Info>

## Authentication

### OAuth2 Authentication

Connect using Google OAuth (recommended)

#### Required Credentials

| Field         | Description                          | Required | Format                                                   |
| ------------- | ------------------------------------ | -------- | -------------------------------------------------------- |
| Client ID     | Google Cloud OAuth 2.0 Client ID     | Yes      | `1234567890-abcdefghijklmnop.apps.googleusercontent.com` |
| Client Secret | Google Cloud OAuth 2.0 Client Secret | Yes      | `GOCSPX-xxxxxxxxxxxxxxxxxxxxxxxx`                        |

#### OAuth Configuration

* **Authorization URL**: `https://accounts.google.com/o/oauth2/v2/auth`
* **Token URL**: `https://oauth2.googleapis.com/token`
* **Scopes**: `https://www.googleapis.com/auth/analytics.edit`, `https://www.googleapis.com/auth/analytics.readonly`

## Available Actions

<AccordionGroup>
  <Accordion title="list_account_options — List Google Analytics accounts available to the authenticated user via the Admin API (/accounts endpoint).">
    ### Parameters

    <ResponseField name="page_size" type="integer">
      Maximum number of accounts to return per page. The service may return fewer than this value. If unspecified, at most 50 accounts are returned (max 200). (Default: `50`)
    </ResponseField>

    <ResponseField name="page_token" type="string">
      Optional page token from a previous response, used to retrieve the next page of accounts.
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "$defs": {
        "AccountSummary": {
          "additionalProperties": false,
          "description": "A Google Analytics account (admin API).",
          "properties": {
            "name": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Name"
            },
            "display_name": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Display Name"
            },
            "account": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Account"
            }
          },
          "title": "AccountSummary",
          "type": "object"
        }
      },
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "accounts": {
          "items": {
            "$ref": "#/$defs/AccountSummary"
          },
          "title": "Accounts",
          "type": "array"
        },
        "next_page_token": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Next Page Token"
        }
      },
      "required": [
        "success"
      ],
      "title": "ListAccountOptionsOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="list_property_options — List GA4 properties visible to the authenticated user by flattening the propertySummaries returned from the Admin API /accountSummaries endpoint.">
    ### Response

    ```json theme={null}
    {
      "$defs": {
        "PropertySummary": {
          "additionalProperties": false,
          "description": "A Google Analytics property summary (admin API).",
          "properties": {
            "property": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Property"
            },
            "display_name": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Display Name"
            },
            "property_type": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Property Type"
            },
            "parent": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Parent"
            }
          },
          "title": "PropertySummary",
          "type": "object"
        }
      },
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "properties": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PropertySummary"
          },
          "title": "Properties"
        }
      },
      "required": [
        "success"
      ],
      "title": "ListPropertyOptionsOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="create_ga4_property — Create a new GA4 property under an existing Google Analytics account via the Admin API (POST /properties).">
    ### Parameters

    <ResponseField name="account" type="string" required>
      The parent account resource name, e.g. 'accounts/123456789'. Use list\_account\_options to discover available accounts.
    </ResponseField>

    <ResponseField name="display_name" type="string" required>
      Human-readable display name for the new property. Max 100 UTF-16 code units.
    </ResponseField>

    <ResponseField name="time_zone" type="string" required>
      Reporting time zone for the property. Must be a valid IANA timezone identifier, e.g. 'America/Los\_Angeles', 'Europe/London', 'Asia/Tokyo'.
    </ResponseField>

    <ResponseField name="industry_category" type="string">
      Industry category associated with the property. Valid values include AUTOMOTIVE, FINANCE, HEALTHCARE, TECHNOLOGY, TRAVEL, ARTS\_AND\_ENTERTAINMENT, GAMES, SHOPPING, JOBS\_AND\_EDUCATION, and others; pass INDUSTRY\_CATEGORY\_UNSPECIFIED if unsure.
    </ResponseField>

    <ResponseField name="currency_code" type="string">
      ISO 4217 currency code used in reports involving monetary values, e.g. 'USD', 'EUR', 'JPY'.
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "$defs": {
        "PropertyResource": {
          "additionalProperties": false,
          "description": "A full GA4 property resource (admin API).",
          "properties": {
            "name": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Name"
            },
            "parent": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Parent"
            },
            "display_name": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Display Name"
            },
            "industry_category": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Industry Category"
            },
            "time_zone": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Time Zone"
            },
            "currency_code": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Currency Code"
            },
            "property_type": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Property Type"
            },
            "create_time": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Create Time"
            },
            "update_time": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Update Time"
            }
          },
          "title": "PropertyResource",
          "type": "object"
        }
      },
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "property": {
          "anyOf": [
            {
              "$ref": "#/$defs/PropertyResource"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "raw": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Raw"
        }
      },
      "required": [
        "success"
      ],
      "title": "CreateGa4PropertyOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="create_key_event — Create a new GA4 key event (conversion) on a property via the Admin API (POST /{parent}/keyEvents).">
    ### Parameters

    <ResponseField name="parent" type="string" required>
      Parent property resource name where the key event will be created. Format: 'properties/123'.
    </ResponseField>

    <ResponseField name="event_name" type="string" required>
      Immutable event name for this key event. Examples: 'click', 'purchase', 'sign\_up'.
    </ResponseField>

    <ResponseField name="counting_method" type="string" required>
      Method by which the key event is counted across multiple events within a session. Valid values: ONCE\_PER\_EVENT, ONCE\_PER\_SESSION, or COUNTING\_METHOD\_UNSPECIFIED.
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "$defs": {
        "KeyEventResource": {
          "additionalProperties": false,
          "description": "A GA4 key event resource (admin API).",
          "properties": {
            "name": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Name"
            },
            "event_name": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Event Name"
            },
            "counting_method": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Counting Method"
            },
            "create_time": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Create Time"
            },
            "deletable": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Deletable"
            },
            "custom": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Custom"
            }
          },
          "title": "KeyEventResource",
          "type": "object"
        }
      },
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "key_event": {
          "anyOf": [
            {
              "$ref": "#/$defs/KeyEventResource"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "raw": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Raw"
        }
      },
      "required": [
        "success"
      ],
      "title": "CreateKeyEventOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="run_report — Run a Universal Analytics (v4 Reporting API) report against a given view ID. Note: Universal Analytics was sunset July 2024 by Google; use run_report_in_ga4 for new GA4 reports.">
    ### Parameters

    <ResponseField name="view_id" type="string" required>
      ID of the Universal Analytics view to query. Found in the legacy Google Analytics Admin UI under View Settings.
    </ResponseField>

    <ResponseField name="start_date" type="string" required>
      Start date in YYYY-MM-DD format.
    </ResponseField>

    <ResponseField name="end_date" type="string" required>
      End date in YYYY-MM-DD format.
    </ResponseField>

    <ResponseField name="metrics" type="array" required>
      List of metric expression strings (each becomes a \{expression: \<metric>} entry), e.g. \['ga:sessions', 'ga:pageviews'].
    </ResponseField>

    <ResponseField name="dimensions" type="array">
      Optional list of dimension name strings (each becomes a \{name: \<dimension>} entry), e.g. \['ga:country', 'ga:browser'].
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "reports": {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "title": "Reports",
          "type": "array"
        },
        "raw": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Raw"
        }
      },
      "required": [
        "success"
      ],
      "title": "RunReportOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="run_report_in_ga4 — Run a GA4 Data API report against a GA4 property (POST /properties/{property}:runReport).">
    ### Parameters

    <ResponseField name="property" type="string" required>
      GA4 property identifier. Accepts either the bare numeric ID ('123456789') or the full resource path ('properties/123456789'); only the numeric ID is sent in the URL.
    </ResponseField>

    <ResponseField name="start_date" type="string" required>
      Start date in YYYY-MM-DD format.
    </ResponseField>

    <ResponseField name="end_date" type="string" required>
      End date in YYYY-MM-DD format.
    </ResponseField>

    <ResponseField name="metrics" type="array" required>
      List of metric name strings (each becomes a \{name: \<metric>} entry), e.g. \['activeUsers', 'screenPageViews'].
    </ResponseField>

    <ResponseField name="dimensions" type="array">
      Optional list of dimension name strings (each becomes a \{name: \<dimension>} entry), e.g. \['country', 'deviceCategory'].
    </ResponseField>

    <ResponseField name="dimension_filter" type="object">
      Optional GA4 FilterExpression object restricting which dimension values appear in the report. See the Google Analytics Data API v1 docs for the schema.
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "row_count": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Row Count"
        },
        "dimension_headers": {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "title": "Dimension Headers",
          "type": "array"
        },
        "metric_headers": {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "title": "Metric Headers",
          "type": "array"
        },
        "rows": {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "title": "Rows",
          "type": "array"
        },
        "totals": {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "title": "Totals",
          "type": "array"
        },
        "raw": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Raw"
        }
      },
      "required": [
        "success"
      ],
      "title": "RunReportInGa4Output",
      "type": "object"
    }
    ```
  </Accordion>
</AccordionGroup>

## Limits & Quotas

* **Admin API** — default quota is 1,200 requests per minute per project, with
  a daily ceiling of 600,000 requests per project. See the
  [Admin API quotas docs](https://developers.google.com/analytics/devguides/config/admin/v1/quotas)
  for the per-method breakdown.
* **Data API** — quotas are tracked separately per property (core tokens,
  realtime tokens, server errors). See the
  [Data API quotas docs](https://developers.google.com/analytics/devguides/reporting/data/v1/quotas)
  for the multi-token model and per-tier limits (Standard vs. Analytics 360).
* **Universal Analytics Reporting API v4** is included for backward
  compatibility only; Universal Analytics properties stopped processing data on
  July 1, 2024. `run_report` will return `success=False` with an API error
  for any non-GA4 view.
* **Error model** — non-2xx HTTP responses and timeouts are caught and returned
  as `success=False` plus a populated `error` string rather than raised. Plan
  for agent-side retries based on the error string.

## Related integrations

<CardGroup cols={3}>
  <Card title="Amplitude" href="/integrations/tools/amplitude" />

  <Card title="Google Tag Manager" href="/integrations/tools/google-tag-manager" />

  <Card title="Luma" href="/integrations/tools/luma" />
</CardGroup>

## Links

* [Google Analytics](https://analytics.google.com)
