Skip to main content
Google Analytics logo

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.
Categories: Analytics & Data · Analytics & Reporting · Marketing · Productivity & Collaboration · Auth: OAuth2 · Actions: 6

Authentication

OAuth2 Authentication

Connect using Google OAuth (recommended)

Required Credentials

FieldDescriptionRequiredFormat
Client IDGoogle Cloud OAuth 2.0 Client IDYes1234567890-abcdefghijklmnop.apps.googleusercontent.com
Client SecretGoogle Cloud OAuth 2.0 Client SecretYesGOCSPX-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

Parameters

page_size
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)
page_token
string
Optional page token from a previous response, used to retrieve the next page of accounts.

Response

{
  "$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"
}

Response

{
  "$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"
}

Parameters

account
string
required
The parent account resource name, e.g. ‘accounts/123456789’. Use list_account_options to discover available accounts.
display_name
string
required
Human-readable display name for the new property. Max 100 UTF-16 code units.
time_zone
string
required
Reporting time zone for the property. Must be a valid IANA timezone identifier, e.g. ‘America/Los_Angeles’, ‘Europe/London’, ‘Asia/Tokyo’.
industry_category
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.
currency_code
string
ISO 4217 currency code used in reports involving monetary values, e.g. ‘USD’, ‘EUR’, ‘JPY’.

Response

{
  "$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"
}

Parameters

parent
string
required
Parent property resource name where the key event will be created. Format: ‘properties/123’.
event_name
string
required
Immutable event name for this key event. Examples: ‘click’, ‘purchase’, ‘sign_up’.
counting_method
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.

Response

{
  "$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"
}

Parameters

view_id
string
required
ID of the Universal Analytics view to query. Found in the legacy Google Analytics Admin UI under View Settings.
start_date
string
required
Start date in YYYY-MM-DD format.
end_date
string
required
End date in YYYY-MM-DD format.
metrics
array
required
List of metric expression strings (each becomes a {expression: <metric>} entry), e.g. [‘ga:sessions’, ‘ga:pageviews’].
dimensions
array
Optional list of dimension name strings (each becomes a {name: <dimension>} entry), e.g. [‘ga:country’, ‘ga:browser’].

Response

{
  "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"
}

Parameters

property
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.
start_date
string
required
Start date in YYYY-MM-DD format.
end_date
string
required
End date in YYYY-MM-DD format.
metrics
array
required
List of metric name strings (each becomes a {name: <metric>} entry), e.g. [‘activeUsers’, ‘screenPageViews’].
dimensions
array
Optional list of dimension name strings (each becomes a {name: <dimension>} entry), e.g. [‘country’, ‘deviceCategory’].
dimension_filter
object
Optional GA4 FilterExpression object restricting which dimension values appear in the report. See the Google Analytics Data API v1 docs for the schema.

Response

{
  "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"
}

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 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 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.

Amplitude

Google Tag Manager

Luma