Ellipse Gradient for Header

Google Analytics Integration Guide

Integrate Google Analytics 4 with enterprise systems through REST APIs, scheduled reporting workflows, Measurement Protocol events, and BigQuery exports.

Google Analytics integration options at a glance

Google Analytics 4 provides REST-based Data and Admin APIs for reporting, metadata, and selected property administration. Its Measurement Protocol accepts server-side and offline events, while BigQuery export delivers event-level data for detailed analysis. OAuth 2.0 and authorized service accounts support delegated and server-to-server access. Martini can schedule reporting workflows, consume paginated API responses, batch compatible report requests, map dimensions and metrics into internal models, send validated events, and write results to databases or expose them through APIs. Google Analytics does not provide a universal outbound webhook for every collected event, so real-time orchestration should begin with the source system or another event publisher.

Integration pointSupported by Google Analytics?Common use casesHow Martini supports it
REST APIsYesThe Google Analytics Data API supports standard, batch, pivot, metadata, real-time, and paginated reports. The Admin API supports selected account, property, data stream, audience, key event, custom dimension, and custom metric administration.Martini can consume the Data API and Admin API, authenticate requests, paginate responses, map JSON structures, and orchestrate downstream writes or API responses.
Measurement ProtocolYesApplications and backend systems can send server-side or offline GA4 events using a measurement ID, API secret, client or app instance identifier, events, parameters, and user properties.Martini can receive source events, validate and transform them, apply business rules, and send Measurement Protocol requests from a workflow.
Bulk / batch APIsLimitedThe Data API supports batch report requests for compatible reports, but it is not a general asynchronous bulk export API.Martini can assemble compatible report requests, process each returned result, and apply retry and error handling around the batch call.
BigQuery exportLimitedGA4 can export event-level data to BigQuery for historical analysis, large-scale querying, modeling, and joining with enterprise datasets.Martini can orchestrate workflows around exported data and transform or publish results; this is an export mechanism rather than direct access to an internal Analytics database.
AuthenticationYesOAuth 2.0 supports delegated access, while authorized service accounts support server-to-server reporting and administration. API keys may identify projects or quotas but do not replace authorization for private data.Martini can manage OAuth-based configuration and protected service credentials through secure environment configuration and secrets management.
Webhooks / outbound callbacksNot confirmedNo general outbound webhook mechanism for every event collected in a GA4 property was identified. Measurement Protocol is inbound event collection, not an outbound callback API.Martini can expose an API or receive webhook-style notifications from the source application, then forward a suitable event to Google Analytics.
File / attachment APIsNoThe Google Analytics Data and Admin APIs do not document a file or attachment API.Martini can process files from other systems when needed, but files are not a confirmed Google Analytics integration mechanism.
Database / analytics accessLimitedBigQuery export provides Analytics event data in BigQuery; it should not be treated as direct database access to Google Analytics.Martini can orchestrate queries or downstream processing through approved data services and can write transformed results to supported SQL databases.

How Google Analytics exposes data and business events

Google Analytics REST APIs

The Google Analytics Data API and Admin API are REST-based interfaces. The Data API provides reports, metadata, real-time reports, batch requests, and pagination, while the Admin API provides selected account, property, stream, audience, key event, custom dimension, and custom metric administration.

Martini implementation pattern

Martini implementation pattern: a workflow authenticates with OAuth 2.0 or an authorized service account, calls the relevant REST resource, processes pagination and response metadata, maps the JSON response to an internal model, and writes or exposes the result.

Implementation sequence

Authenticate with OAuth 2.0 or an authorized service account
Build the report or administration request for the target property
Call the Google Analytics REST API
Process page tokens and response metadata
Map dimensions, metrics, and configuration fields
Write the result or return it through a Martini API

Google Analytics Measurement Protocol

The GA4 Measurement Protocol accepts server-side or offline events. Requests include a measurement ID, API secret, client ID or app instance ID, and one or more events with optional parameters and user properties.

Martini implementation pattern

Martini implementation pattern: a workflow receives a commerce, CRM, or lifecycle event, validates required identifiers and event fields, applies business rules and consent handling, then sends the transformed payload to GA4 and records the processing outcome.

Implementation sequence

Receive the source business event
Validate the measurement ID, identifiers, event name, and required parameters
Apply consent, enrichment, and business rules
Create the Measurement Protocol JSON payload
Send the event to Google Analytics
Store the source identifier and processing result

Google Analytics BigQuery export

GA4 can deliver event-level data to BigQuery for historical analysis, large-scale querying, data modeling, and joins with other enterprise datasets. The export is configured through Google Analytics and Google Cloud.

Martini implementation pattern

Martini implementation pattern: Martini orchestrates downstream processing around the exported data rather than connecting to an internal Analytics database. It can retrieve or query approved data services, transform curated results, and publish them to operational destinations.

Implementation sequence

Confirm the GA4 to BigQuery export and expected data availability
Start a scheduled or dependent Martini workflow
Retrieve the approved BigQuery result or downstream dataset
Transform and validate the exported event model
Load the curated result into a target system
Record the export period and processing checkpoint

Scheduled reporting workflows

Scheduled synchronization is a practical mechanism for recurring GA4 reports, configuration inventories, and operational data loads. It is especially useful where no universal outbound Analytics webhook exists.

Martini implementation pattern

Martini implementation pattern: a scheduler starts a workflow for an explicit property and date range, the workflow retrieves reports or Admin API resources, handles quotas and pagination, performs an idempotent write, and records monitoring information.

Implementation sequence

Start the workflow on a defined schedule
Resolve the property, date range, and report configuration
Retrieve reports or administration resources
Handle pagination, quotas, and transient errors
Map and write the result idempotently
Log the run status and checkpoint

Common Google Analytics integration patterns

Pattern 1: Load scheduled GA4 reports into a database

When to use this pattern

Use this pattern for daily marketing, product, or executive reporting where a SQL database or reporting store needs a governed, repeatable copy of GA4 report results.

Integration direction
Google Analytics
Martini
SQL database
Example Mapping
Google Analytics FieldCanonical FieldTarget Field
propertyIdanalyticsPropertyIdproperty_id
dateRanges.startDatereportStartDateperiod_start
dimensionValuesdimensionValuedimension_value
metricValuesmetricValuemetric_value
Martini implementation pattern

A scheduled Martini workflow authenticates to the Data API, submits a report, follows page tokens, validates the requested dimensions and metrics, maps rows to a canonical reporting schema, and performs an idempotent database write keyed by property, date range, and dimension values. Transient errors use controlled retries and failed runs are logged for replay.

Martini capabilities used
  • scheduler triggers
  • API consumption
  • JSON processing
  • data mapping
  • SQL database access
  • business rules
  • error handling

Pattern 2: Send commerce events to GA4

When to use this pattern

Use this pattern when a commerce or CRM system needs centralized server-side purchase, subscription, or customer-lifecycle event collection without embedding separate Analytics credentials in every source application.

Integration direction
Shopify
Martini
Google Analytics
Example Mapping
Google Analytics FieldCanonical FieldTarget Field
order.idtransactionIdeventParams.transaction_id
order.totaltransactionValueeventParams.value
order.currencycurrencyCodeeventParams.currency
customer.idclientIdentifierclient_id
Martini implementation pattern

Martini receives or retrieves the source event, validates identifiers and required Measurement Protocol fields, enriches the payload with approved business data, applies consent and event rules, and sends the GA4 event. A transaction or source event ID provides idempotency protection, while rejected payloads are routed to error handling for correction.

Martini capabilities used
  • API creation
  • workflow orchestration
  • data mapping
  • JSON processing
  • business rules
  • secrets management
  • error handling

Pattern 3: Inventory Analytics property configuration

When to use this pattern

Use this pattern for governance, audit, and operational reporting across accounts and properties where teams need visibility into streams, audiences, key events, custom dimensions, and custom metrics.

Integration direction
Google Analytics
Martini
Governance database
Example Mapping
Google Analytics FieldCanonical FieldTarget Field
account.nameanalyticsAccountNameaccount_name
property.nameanalyticsPropertyNameproperty_name
dataStream.measurementIdmeasurementIdentifiermeasurement_id
keyEvent.eventNamekeyEventNamekey_event_name
Martini implementation pattern

A scheduled workflow calls supported Admin API resources, normalizes the hierarchy, compares the current result with the prior inventory, and writes changes idempotently. Permission failures and resource-level errors are captured separately so an incomplete inventory is not presented as authoritative.

Martini capabilities used
  • scheduler triggers
  • REST API consumption
  • data mapping
  • change detection
  • SQL database access
  • error handling

Pattern 4: Curate BigQuery Analytics data for enterprise use

When to use this pattern

Use this pattern when detailed GA4 event-level export data needs to be transformed into curated operational metrics or made available to another enterprise platform.

Integration direction
Google Analytics
BigQuery
Martini
Enterprise API
Example Mapping
Google Analytics FieldCanonical FieldTarget Field
event_nameanalyticsEventNameevent_name
event_timestampeventTimeoccurred_at
user_pseudo_idanalyticsUserIdentifieruser_id
event_paramseventAttributesattributes
Martini implementation pattern

GA4 exports event data to BigQuery, after which Martini retrieves an approved query result or downstream dataset, validates export timing and schema, transforms event parameters into a governed model, applies business definitions, and publishes or loads the curated output. The workflow records the export window and avoids assuming that BigQuery and report API data are identical at the same time.

Martini capabilities used
  • workflow orchestration
  • scheduled processing
  • data mapping
  • JSON processing
  • business rules
  • API creation
  • monitoring

Applications commonly integrated with Google Analytics

Google Analytics is commonly combined with advertising, search, commerce, customer, reporting, and data-platform applications. Martini can orchestrate these systems through their supported APIs and event endpoints while keeping transformation, validation, credentials, and operational handling in reusable workflows.

Application Scenario Direction Martini Pattern
BigQuery Store and query detailed GA4 event data for attribution, data modeling, and analysis across enterprise datasets. Google Analytics → BigQuery Use the documented GA4 export to BigQuery for event-level delivery, then use Martini to orchestrate downstream processing, transform curated results, and publish operational metrics through an API or workflow.
Google Ads Combine advertising activity with Analytics events and key events for measurement and campaign-oriented reporting. Google Ads → Martini → Google Analytics Use Martini to retrieve or receive advertising and Analytics data through the applicable Google APIs, normalize campaign and event identifiers, apply reporting rules, and persist a reconciled measurement model.
Google Search Console Combine organic search performance with landing-page engagement and Analytics reporting. Google Search Console → Martini → Google Analytics Schedule workflows that retrieve data from the relevant Google APIs, align dates, properties, landing pages, and dimensions, then write a consolidated dataset or expose it through a Martini API.
Looker Studio Present Analytics reports and blended business metrics in dashboards for marketing and executive stakeholders. Google Analytics → Martini → Looker Studio Retrieve selected GA4 reports, map metrics to a governed reporting schema, apply business definitions, and publish the prepared data through a supported reporting destination or API.
Salesforce Relate campaign, lead, opportunity, and customer lifecycle information to web and product engagement data. Salesforce → Martini → Google Analytics Receive lifecycle events or retrieve Salesforce data, validate consent and identifiers, enrich the payload with business context, and send appropriate GA4 events through the Measurement Protocol while recording processing status.
Shopify Connect ecommerce orders and customer journey events with GA4 purchase and product measurement. Shopify → Martini → Google Analytics Consume Shopify order or event data through the applicable Shopify endpoints, map transaction and item fields to GA4 event parameters, deduplicate by transaction ID, and submit validated Measurement Protocol events.
Snowflake Combine Analytics data with customer, sales, and finance data in a centralized enterprise analytics platform. Google Analytics → BigQuery → Martini → Snowflake Use GA4 BigQuery export or Data API results as the source, transform and validate the data in Martini, and load curated datasets into Snowflake using the supported destination interface.

How to build a Google Analytics integration in Martini

Objective

Establish the Google identity and Analytics access required by the workflow while keeping reporting and administration permissions separate where possible.

Instructions in Martini

  • Choose OAuth 2.0 for delegated user access or an authorized service account for server-to-server processing
  • Enable the required Google APIs in the Google Cloud project
  • Grant the minimum required Google Analytics account or property permissions
  • Store refresh tokens, service-account credentials, API secrets, and related configuration in protected Martini secrets

Objective

Select a trigger that matches the vendor capability and business timing rather than assuming Google Analytics can emit a universal webhook.

Instructions in Martini

  • Use a scheduler for recurring reports or configuration inventory
  • Expose a Martini API or receive a source-system webhook for immediate business events
  • Use a dependent workflow when processing follows a BigQuery export or another upstream data delivery

Objective

Obtain report, administration, export, or source-event data using the confirmed Google Analytics mechanisms.

Instructions in Martini

  • Call the Data API for reports and metadata
  • Call the Admin API for supported configuration resources
  • Receive source events before sending them through Measurement Protocol
  • Process page tokens and do not assume one report response contains all rows

Objective

Coordinate API calls, validation, enrichment, branching, and persistence in a maintainable Martini workflow.

Instructions in Martini

  • Separate report retrieval, event submission, and downstream writes into clear workflow stages
  • Apply explicit date ranges, property identifiers, and reporting definitions
  • Use reusable services or workflow components for shared authentication and response handling

Objective

Convert Google Analytics dimensions, metrics, configuration resources, or event payloads into the canonical model required by downstream systems.

Instructions in Martini

  • Map dimensions and metrics to stable internal names
  • Transform event parameters and user properties into the Measurement Protocol structure
  • Normalize Account, Property, Data stream, Audience, Key event, and reporting metadata fields
  • Validate required fields and distinguish missing data from zero-valued metrics

Objective

Protect data quality and ensure that only valid, permitted, and semantically agreed data is processed.

Instructions in Martini

  • Apply consent, identifier, and event eligibility rules
  • Use transaction IDs, source event IDs, or composite keys for idempotency
  • Account for property time zones, late-arriving events, attribution, thresholds, and data freshness

Common Google Analytics data objects used in integrations

ObjectTypical UseCommon target systemsMartini handling
AccountTop-level Google Analytics container that can contain one or more properties and supports governance or inventory use cases.Governance database, reporting platform, data warehouseMartini retrieves account information through supported Admin API resources, normalizes it, and stores it with property relationships.
PropertyGA4 measurement and reporting container, normally identified by a numeric property ID.Reporting database, configuration inventory, data warehouseMartini uses the property ID to parameterize Data API reports, retrieve selected configuration, and maintain an idempotent inventory.
Data streamWeb, iOS, or Android source that sends data to a GA4 property.Governance platform, application inventory, reporting storeMartini can retrieve selected stream configuration through the Admin API and map platform, stream, and property relationships.
EventUser or system interaction such as page_view, purchase, or a custom event.Google Analytics, BigQuery, operational event storeMartini validates source events, maps event names and parameters, applies deduplication rules, and sends eligible server-side or offline events through Measurement Protocol.
AudienceGroup of users defined by behavioral or attribute-based conditions.Governance store, marketing reporting, configuration inventoryMartini can retrieve supported audience configuration for inventory and governance workflows, subject to API permissions and resource coverage.
Key eventEvent designated as important for measuring business outcomes.Reporting database, governance store, marketing dashboardsMartini can retrieve selected key event configuration, relate it to reporting definitions, and flag configuration changes for review.

Authentication and security considerations

Authentication and access control

Google Analytics integrations commonly use OAuth 2.0 for delegated user access or authorized service accounts for server-to-server workflows. API keys may identify a project or quota context but do not replace authorization for private Analytics data.

  • Grant only the Google Analytics account or property permissions required by each workflow.
  • Keep reporting access separate from administrative access where practical.
  • Store refresh tokens, service-account credentials, and Measurement Protocol API secrets in protected Martini configuration or secrets management.
  • Enable the required APIs in the associated Google Cloud project and review permissions during deployment.

Operational considerations for Google Analytics integrations

Quotas, pagination, and reporting semantics

The Data API applies property-level and project-level quotas. Workflows should avoid repeated reports, use compatible batch requests where appropriate, cache metadata, and retry transient failures with controlled backoff.

Data quality and reliability

  • Process page tokens and report row limits rather than assuming a single response is complete.
  • Define property time zones, date boundaries, freshness expectations, and late-arriving event handling.
  • Use idempotency keys for database writes and distinguish safe report retries from repeated event-ingestion requests.
  • Validate Measurement Protocol identifiers, event names, parameters, user properties, and consent-related fields.
  • Monitor changes to data streams, audiences, key events, custom dimensions, and custom metrics.
  • Test against reporting thresholds, attribution behavior, cardinality, and differences between API reports and BigQuery exports.

Why use Martini instead of scripts or point-to-point integrations?

Centralized integration logic

Martini provides a maintainable place to orchestrate Google Analytics APIs, source applications, databases, BigQuery-related workflows, and enterprise APIs. This avoids duplicating credentials, payload construction, mappings, and retry logic across individual scripts.

Reusable and observable workflows

  • Use scheduled workflows for reports and configuration inventory.
  • Expose controlled APIs for source systems that need to submit business events.
  • Apply reusable mappings, validation, enrichment, and business rules.
  • Handle pagination, retries, idempotency, logging, and failure routing consistently.
  • Keep vendor-specific credentials and environment settings separate from workflow logic.

Frequently asked questions

How can Google Analytics be integrated with enterprise systems?

Google Analytics 4 can be integrated through the REST-based Data API for reporting, the Admin API for selected configuration resources, and the Measurement Protocol for server-side or offline event collection. GA4 can also export event-level data to BigQuery. OAuth 2.0 and authorized service accounts provide access control for private reporting and administration.

Can Martini integrate with Google Analytics?

Yes. Martini can consume the Google Analytics Data API and Admin API over REST, schedule reporting and inventory workflows, send transformed events through the Measurement Protocol, and orchestrate downstream processing around BigQuery exports.

Do I need a connector to integrate Google Analytics with Martini?

No. A dedicated Google Analytics connector is not required. Martini can use Google Analytics native REST APIs, Measurement Protocol endpoints, confirmed authentication methods, and approved data services such as BigQuery.

Is there any extra Lonti cost to integrate Google Analytics with Martini?

Lonti does not charge an additional per-connector or per-vendor fee to integrate Google Analytics. The integration is subject to the provisioned capacity of the Martini environment. Separate costs may apply from Google, Google Cloud, BigQuery, infrastructure, or other third-party systems based on subscription, usage, and deployment model.

Which Google Analytics APIs should an enterprise integration use?

Use the Data API for reports, metadata, real-time reports, and paginated results; use the Admin API for supported account, property, data stream, audience, key event, custom dimension, and custom metric administration; and use Measurement Protocol for server-side or offline event ingestion. Batch report requests are available for compatible reporting workloads.

Does Google Analytics provide webhooks or outbound event callbacks?

No general-purpose webhook for every event collected in a GA4 property was identified. Measurement Protocol sends events into Google Analytics rather than notifying another system. For immediate orchestration, the source application should publish the event to Martini or call a Martini API, after which Martini can forward a suitable GA4 event.

How does Martini synchronize Google Analytics data?

Martini can schedule Data API reports or Admin API inventory workflows, process pagination, map dimensions and metrics, and write results to a database or expose them through an API. For detailed event-level analysis, GA4 BigQuery export can provide the source data for downstream Martini processing.

How are Google Analytics mappings, errors, and duplicates handled?

Martini can validate and transform JSON payloads, apply business rules, and maintain canonical mappings for dimensions, metrics, events, and configuration objects. Workflows can retry transient API failures with controlled backoff, log rejected responses, and use transaction IDs, source event IDs, or composite keys to prevent duplicate writes or repeated event submissions.