Connect Google Analytics 4 to Relevance AI to automate reporting, track conversions, and manage properties with AI agents
Google Analytics 4 (GA4) is Google’s analytics platform for measuring traffic, engagement, and conversions across your websites and apps. With the Google Analytics integration in Relevance AI, you can connect your GA4 properties to AI agents that run custom reports, create key events for conversion tracking, manage properties programmatically, and query the GA4 APIs directly.
This integration is built by Relevance AI. For integration-specific support, contact Relevance AI support. For Google Analytics platform issues, visit Google Analytics Help.
The Google Analytics integration uses OAuth to authenticate with your Google account. You only need to complete this process once per Google account.
1
Navigate to Integrations & API Keys
Select Integrations & API Keys from the left sidebar in your Relevance AI dashboard.
2
Find Google Analytics
Browse the integrations directory and click on Google Analytics.
3
Click Connect
Click the Connect button to start the OAuth flow.
4
Sign in to Google
You’ll be redirected to Google’s authentication page. Select the Google account that has access to the GA4 properties you want to use.
5
Review permissions
Review the permissions Relevance AI is requesting. These are needed to read analytics data and manage your GA4 properties on your behalf.
6
Approve access
Click Allow to grant access. You’ll be redirected back to Relevance AI.
7
Confirm connection
Your Google Analytics account will now appear as connected in the Integrations dashboard and will be available for use in your agents and tools.
You can connect multiple Google accounts if you manage GA4 properties across different Google logins. Each connected account appears separately in the integrations list.
Your Google account must have at least Viewer access to the GA4 properties you want to query. To create properties or key events, you need Editor or Administrator access on those properties.
The Google Analytics integration provides four tool steps that your agents can use. Search for “Google Analytics” in the tool step search bar when building your tools.
Retrieve analytics data from a GA4 property by specifying metrics (quantitative measurements) and dimensions (data categories). Use this to pull traffic data, engagement stats, conversion counts, or any other GA4 report data into your agent workflows.Key inputs:
Property ID: The GA4 property to query (e.g., properties/123456789)
Metrics: What to measure — for example, sessions, activeUsers, conversions, screenPageViews
Dimensions: How to break down the data — for example, date, country, sessionSource, pagePath
Date range: The time period to report on
Filters: Optional dimension or metric filters to narrow results
What are metrics and dimensions?
In GA4, metrics are numeric values (how much, how many), and dimensions are attributes used to categorize or segment that data. For example, sessions is a metric and country is a dimension — together they give you sessions by country.
Create a key event in a GA4 property. Key events mark the actions that matter most to your business — they were called “conversions” in Universal Analytics (UA) and earlier versions of GA4. Creating a key event tells GA4 to highlight that event in reports and use it as a conversion signal.Key inputs:
Property ID: The GA4 property to add the key event to
Event name: The name of the existing GA4 event to mark as a key event (e.g., purchase, sign_up, generate_lead)
Note: The event must already be collected in your GA4 property before it can be designated as a key event. You cannot create an event and mark it as a key event in the same step.
Create a new Google Analytics 4 property programmatically. This is useful when you’re provisioning GA4 tracking for new client websites, new app launches, or when you manage analytics at scale across many sites.Key inputs:
Display name: The name for the new property
Time zone: The reporting time zone for the property
Currency code: The currency used for revenue metrics (e.g., USD, EUR)
Industry category: The industry the property belongs to (optional, used for benchmarking)
Note: You must have Administrator access in the Google Analytics account where the property will be created. Properties are created under your Google Analytics account, not under a specific website — you’ll still need to set up a data stream separately to start collecting data.
Make a custom API call to any Google Analytics Data API or Admin API endpoint. Use this when the pre-built tool steps don’t cover your specific use case.This tool step handles OAuth authentication automatically, so you don’t need to manage access tokens. See the advanced section below for full usage details and examples.
For use cases beyond the pre-built tool steps, the Google Analytics API Call tool step gives you direct access to both the GA4 Data API and the GA4 Admin API.
This example retrieves the top 10 pages by page views for the past 30 days.API: POST https://analyticsdata.googleapis.com/v1beta/properties/{propertyId}:runReport
This example marks the purchase event as a key event on a GA4 property.API: POST https://analyticsadmin.googleapis.com/v1beta/properties/{propertyId}/keyEvents
This example retrieves how many users are active on the site right now, broken down by country.API: POST https://analyticsdata.googleapis.com/v1beta/properties/{propertyId}:runRealtimeReport
Build an agent that runs GA4 reports on a schedule, compiles key metrics (sessions, conversions, revenue), and delivers formatted summaries to Slack, email, or a Google Sheet. The agent can compare performance week-over-week or month-over-month and flag significant changes automatically.
Conversion tracking automation
Create an agent that reads from a CRM or project management tool and automatically creates GA4 key events when new business goals are defined. This removes the manual step of updating GA4 settings each time your team identifies a new conversion action to track.
Multi-property management
Deploy an agent that provisions GA4 properties at scale — useful for agencies managing analytics for multiple clients or organizations rolling out tracking across many regional sites. The agent creates properties, applies consistent settings, and logs the property IDs for reference.
Custom dashboard creation
Connect GA4 data to internal dashboards by having an agent pull specific metrics and dimensions on demand. The agent can combine data from multiple GA4 properties, apply business logic, and write results to a database or BI tool for visualization.
Threshold-based alerts
Set up an agent that monitors GA4 metrics and sends alerts when values cross defined thresholds — for example, when bounce rate exceeds 80%, when daily sessions drop by more than 20% compared to the previous week, or when conversion rate falls below a target. The agent runs reports at regular intervals and routes alerts to the appropriate channel.
Cross-platform analytics
Build an agent that combines GA4 data with data from your CRM, advertising platforms, or marketing automation tools. For example, pull GA4 conversion data alongside HubSpot lead data to get a full picture of how web traffic translates into pipeline, or combine GA4 session data with ad spend data to calculate cost per session by channel.
Marketing ROI calculation
Create an agent that retrieves GA4 conversion data (key events, revenue) alongside campaign spend data from advertising platforms, then calculates return on ad spend (ROAS), cost per acquisition (CPA), and other ROI metrics. Results can be written to a spreadsheet or sent as a periodic report.
Audience behavior analysis
Deploy an agent that runs detailed GA4 reports segmented by user attributes — device type, location, traffic source, landing page — and identifies patterns in how different audience segments engage with your site. The agent can surface insights about which segments convert at higher rates or where users drop off in key flows.
Request minimal permissions: OAuth grants access to all GA4 properties in your Google account. Where possible, use a dedicated Google account with access only to the properties your agent needs, rather than a personal account with access to many unrelated properties.
Respect rate limits: The GA4 Data API enforces quotas per property, including limits on requests per day, tokens per day, and concurrent requests. Design your agents to batch reports where possible and avoid making redundant API calls. See GA4 API quotas for current limits.
Account for data processing delays: GA4 data is typically processed within 24–48 hours. Real-time reports show data from the last 30 minutes but exclude some processed signals. If your use case requires fully processed data (including attribution and session stitching), query for dates at least 48 hours in the past.
Use property IDs, not names: Property names can change but property IDs don’t. Store and reference properties by their numeric ID (visible in GA4 Admin > Property Settings) rather than by display name.
Handle empty responses: GA4 reports return no rows when there’s no matching data for the requested dimensions and date range. Make sure your agent handles empty result sets gracefully rather than treating them as errors.
To connect the integration, your Google account must have at least Viewer access on the GA4 properties you want to query. To create key events or manage property settings, you need Editor access. To create new properties, you need Administrator access on the Google Analytics account.You can check your access level in GA4 under Admin > Account Access Management or Property Access Management.
Can I connect multiple Google accounts?
Yes. You can connect multiple Google accounts by completing the OAuth flow once for each account. Each connected account will appear separately in your Relevance AI integrations list, and you can select which account to use when configuring individual tool steps.
What are GA4 key events?
Key events are the actions you’ve identified as important to your business — for example, purchases, form submissions, or sign-ups. In GA4, you first collect an event (via your tracking code or Google Tag Manager), then designate it as a key event to highlight it in reports and use it for conversion measurement. Key events were called “conversions” in Universal Analytics and in earlier versions of GA4; Google renamed them to key events in 2024.
What are GA4 API rate limits?
The GA4 Data API enforces per-property quotas including:
Core reporting: 200,000 tokens per day, 40,000 tokens per hour, 10 concurrent requests
Real-time reporting: 75,000 tokens per day, 15,000 tokens per hour
Tokens are consumed based on the complexity of your queries. Simple queries use fewer tokens than complex ones with many dimensions or large date ranges. See the GA4 quotas documentation for full details.
Why is my GA4 data showing a delay?
GA4 processes most data within 24 hours, but full processing (including attribution, session stitching, and some conversions) can take up to 48 hours. Real-time data is available within minutes but represents a subset of the fully processed data. If you need accurate, fully processed metrics, query for dates at least 48 hours in the past.
Can I access Universal Analytics (UA) data?
No. Universal Analytics properties stopped processing new data in July 2023. The Google Analytics integration in Relevance AI connects to GA4 only. Historical UA data is no longer accessible via the API.
How do I find my GA4 property ID?
In Google Analytics, go to Admin > Property Settings. Your property ID is the numeric ID shown at the top of the page (e.g., 123456789). When using the API, you reference it as properties/123456789.
Why am I getting permission errors when creating properties?
Creating GA4 properties requires Administrator access on the Google Analytics account (not just the property). If you receive a permission error, check your access level under Admin > Account Access Management and ensure your connected Google account has Administrator rights on the account where you want to create the property.
To disconnect your Google Analytics account from Relevance AI:
Navigate to Integrations & API Keys from the left sidebar.
Find your Google Analytics connection in the integrations list.
Click on the integration to expand its details.
Click the three-dot menu and select Remove.
Removing the integration revokes Relevance AI’s access to your Google Analytics data. Any agents or tools using Google Analytics tool steps will stop working until you reconnect. Removing the integration from Relevance AI does not affect your Google Analytics account or data in any way.
Need help?
Contact our support team for assistance with the Google Analytics integration
Explore more integrations
Discover other integrations to extend your agent workflows