Google Analytics Events API

The Events API from Google Analytics — 1 operation(s) for events.

Operations 1

POST /collect Google Analytics Send Events to Google Analytics #

Documentation

📖
Documentation
https://developers.google.com/analytics/devguides/reporting/data/v1
📖
APIReference
https://developers.google.com/analytics/devguides/reporting/data/v1/rest
📖
GettingStarted
https://developers.google.com/analytics/devguides/reporting/data/v1/quickstart
📖
Authentication
https://developers.google.com/analytics/devguides/reporting/data/v1/quickstart-client-libraries
📖
RateLimits
https://developers.google.com/analytics/devguides/reporting/data/v1/quotas
📖
Documentation
https://developers.google.com/analytics/devguides/config/admin/v1
📖
APIReference
https://developers.google.com/analytics/devguides/config/admin/v1/rest
📖
GettingStarted
https://developers.google.com/analytics/devguides/config/admin/v1/quickstart
📖
Documentation
https://developers.google.com/analytics/devguides/collection/protocol/ga4
📖
APIReference
https://developers.google.com/analytics/devguides/collection/protocol/ga4/reference
📖
GettingStarted
https://developers.google.com/analytics/devguides/collection/protocol/ga4/sending-events
📖
Troubleshooting
https://developers.google.com/analytics/devguides/collection/protocol/ga4/troubleshooting
📖
Documentation
https://developers.google.com/analytics/devguides/config/userdeletion/v3
📖
APIReference
https://developers.google.com/analytics/devguides/config/userdeletion/v3/reference
📖
Authentication
https://developers.google.com/analytics/devguides/config/userdeletion/v3/authorization
📖
Documentation
https://developers.google.com/analytics/devguides/reporting/core/v4
📖
GettingStarted
https://developers.google.com/analytics/devguides/migration/api/reporting-ua-to-ga4
📖
Documentation
https://developers.google.com/analytics/devguides/config/mgmt/v3
📖
APIReference
https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference

Specifications

Code Examples

Other Resources

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/google-analytics-events-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

google-analytics-events-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Google Analytics Measurement Protocol (GA4) Events API
  description: The Google Analytics Measurement Protocol lets you send events directly to Google Analytics servers via HTTP requests to augment existing GA4 data with server-to-server and offline interactions.
  version: '1.0'
  contact:
    name: Google Analytics
    url: https://developers.google.com/analytics
  license:
    name: Google APIs Terms of Service
    url: https://developers.google.com/analytics/terms
  x-logo:
    url: https://www.google.com/analytics/images/google-analytics-logo.png
servers:
- url: https://www.google-analytics.com/mp
  description: Global endpoint
- url: https://region1.google-analytics.com/mp
  description: EU endpoint
tags:
- name: Events
paths:
  /collect:
    post:
      operationId: collectEvents
      summary: Google Analytics Send Events to Google Analytics
      description: Sends one or more events to Google Analytics for processing. Up to 25 events can be sent per request. Events can be backdated up to 72 hours.
      parameters:
      - name: api_secret
        in: query
        required: true
        description: The API Secret generated in the Google Analytics UI. Found under Admin > Data Streams > Choose your stream > Measurement Protocol > Create.
        schema:
          type: string
        example: secret_abc123
      - name: measurement_id
        in: query
        required: false
        description: The Measurement ID for a web data stream. Required for web streams. Found in the Google Analytics UI under Admin > Data Streams.
        schema:
          type: string
        example: '123456'
      - name: firebase_app_id
        in: query
        required: false
        description: The Firebase App ID for an app data stream. Required for app streams. Found in the Firebase console under Project Settings.
        schema:
          type: string
        example: '123456'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MeasurementPayload'
      responses:
        '204':
          description: Events accepted. Note that a 2xx response does not guarantee the events are valid or will appear in reports. The Measurement Protocol does not return error details for malformed payloads.
        '400':
          description: Malformed request
        '403':
          description: Invalid api_secret
      tags:
      - Events
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  schemas:
    UserPropertyValue:
      type: object
      properties:
        value:
          oneOf:
          - type: string
          - type: number
          - type: boolean
          description: The value of the user property.
          example: example_value
    Device:
      type: object
      properties:
        category:
          type: string
          description: Device category (e.g., mobile, tablet, desktop).
          example: example_value
        language:
          type: string
          description: Device language setting.
          example: example_value
        screen_resolution:
          type: string
          description: Screen resolution (e.g., 1920x1080).
          example: example_value
        operating_system:
          type: string
          description: Operating system name.
          example: example_value
        operating_system_version:
          type: string
          description: Operating system version.
          example: example_value
        model:
          type: string
          description: Device model.
          example: example_value
        brand:
          type: string
          description: Device brand.
          example: example_value
        browser:
          type: string
          description: Browser name.
          example: example_value
        browser_version:
          type: string
          description: Browser version.
          example: example_value
    MeasurementPayload:
      type: object
      required:
      - events
      properties:
        client_id:
          type: string
          description: Uniquely identifies a user instance of a web client. Required for web streams.
          example: '123456789.1234567890'
        app_instance_id:
          type: string
          description: Uniquely identifies a user instance of an app. Required for app streams.
          example: '123456'
        user_id:
          type: string
          description: A unique identifier for a user. Enables cross-platform analysis. Must contain only UTF-8 characters.
          example: '123456'
        timestamp_micros:
          type: integer
          format: int64
          description: Unix timestamp in microseconds for the request. Used to backdate events up to 72 hours.
          example: 1713355200000000
        user_properties:
          type: object
          description: User-scoped properties for the measurement.
          additionalProperties:
            $ref: '#/components/schemas/UserPropertyValue'
        user_data:
          type: object
          description: User-provided data for enhanced measurement.
        consent:
          $ref: '#/components/schemas/Consent'
        non_personalized_ads:
          type: boolean
          description: Deprecated. Use consent.ad_personalization instead.
          deprecated: true
          example: true
        user_location:
          $ref: '#/components/schemas/UserLocation'
        ip_override:
          type: string
          description: IP address used to derive geographic information.
          example: '123456'
        device:
          $ref: '#/components/schemas/Device'
        validation_behavior:
          type: string
          description: Controls validation strictness. RELAXED only rejects malformed requests. ENFORCE_RECOMMENDATIONS also rejects invalid types and exceeded limits.
          enum:
          - RELAXED
          - ENFORCE_RECOMMENDATIONS
          default: RELAXED
          example: RELAXED
        events:
          type: array
          description: Array of event objects. Maximum 25 events per request.
          maxItems: 25
          items:
            $ref: '#/components/schemas/Event'
    Event:
      type: object
      required:
      - name
      properties:
        name:
          type: string
          description: The name of the event. Must not use reserved names (ad_click, app_exception, error, session_start, etc.) or reserved prefixes (_, firebase_, ga_, google_, gtag.).
          example: Example Name
        params:
          type: object
          description: Event parameters as key-value pairs. Common parameters include session_id, engagement_time_msec, and timestamp_micros.
          additionalProperties: true
          properties:
            session_id:
              type: string
              description: Session identifier for accurate session metrics.
            engagement_time_msec:
              type: integer
              description: User engagement duration in milliseconds.
            timestamp_micros:
              type: integer
              format: int64
              description: Unix epoch time in microseconds to override event timestamp.
    UserLocation:
      type: object
      properties:
        city:
          type: string
          description: City name.
          example: example_value
        region_id:
          type: string
          description: Region identifier.
          example: '123456'
        country_id:
          type: string
          description: Country identifier.
          example: '123456'
        subcontinent_id:
          type: string
          description: Subcontinent identifier.
          example: '123456'
        continent_id:
          type: string
          description: Continent identifier.
          example: '123456'
    Consent:
      type: object
      properties:
        ad_user_data:
          type: string
          description: Consent for using user data in advertising.
          enum:
          - GRANTED
          - DENIED
          example: GRANTED
        ad_personalization:
          type: string
          description: Consent for ad personalization.
          enum:
          - GRANTED
          - DENIED
          example: GRANTED
externalDocs:
  description: Measurement Protocol documentation
  url: https://developers.google.com/analytics/devguides/collection/protocol/ga4