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

# Google Analytics

> Access and analyze Google Analytics data including accounts, properties, dimensions, metrics, and reports

## Overview

The Google Analytics server enables AI assistants to interact with [Google Analytics](https://analytics.google.com), providing comprehensive analytics data access including account management, property configuration, custom dimensions and metrics, realtime reporting, and historical data analysis through the Google Analytics Data API.

## How to Add Google Analytics

<Steps>
  <Step title="Add Server">
    Add the Google Analytics server to your Civic environment through the server directory.
  </Step>

  <Step title="Authorize">
    Simply log in with your Google account and approve the OAuth consent request. No admin approval needed.
  </Step>

  <Step title="Test Connection">
    Try "Show me my Google Analytics account summaries" to verify the connection works.
  </Step>
</Steps>

<Note>
  **Simple OAuth Consent:** Google Analytics uses standard Google OAuth consent. Works with personal Google accounts and Google Workspace without special admin approval.
</Note>

## What You Can Do

<CardGroup cols={2}>
  <Card title="Account & Property Management" icon="building">
    List accounts, properties, and Google Ads links
  </Card>

  <Card title="Custom Configuration" icon="sliders">
    Retrieve custom dimensions and metrics for properties
  </Card>

  <Card title="Realtime Reporting" icon="bolt">
    Run realtime reports with current visitor data
  </Card>

  <Card title="Historical Reporting" icon="chart-line">
    Generate data reports with date ranges and complex filtering
  </Card>
</CardGroup>

## Available Tools (6)

### Account & Property Operations

<AccordionGroup>
  <Accordion title="get_account_summaries">
    Retrieve information about all Google Analytics accounts and properties accessible to the user. Returns account and property details for configuration.
  </Accordion>

  <Accordion title="get_property_details">
    Get detailed information about a specific Google Analytics property by property ID. Property ID can be a number or "properties/123" format.
  </Accordion>

  <Accordion title="list_google_ads_links">
    List all Google Ads account links for a specific property. Shows integration between Analytics and advertising accounts.
  </Accordion>

  <Accordion title="get_custom_dimensions_and_metrics">
    Retrieve custom Core Reporting dimensions and metrics defined for a specific property. Essential for understanding available custom data fields.
  </Accordion>
</AccordionGroup>

### Reporting Operations

<AccordionGroup>
  <Accordion title="run_realtime_report">
    Run a Google Analytics Data API realtime report showing current visitor activity. Supports realtime dimensions and metrics, filtering with FilterExpression, ordering with OrderBy, and pagination. Returns up to 10 rows per request.
  </Accordion>

  <Accordion title="run_report">
    Run a Google Analytics Data API historical report with date ranges. Supports standard and custom dimensions/metrics, complex filtering with FilterExpression, ordering with OrderBy, pagination, and currency code specification. Returns up to 10 rows per request.
  </Accordion>
</AccordionGroup>

## Use Cases

### Account Discovery

"Show me all my Google Analytics accounts and properties" - List accessible analytics configurations.

### Property Details

"Get information about property 123456789" - View specific property configuration.

### Google Ads Integration

"List all Google Ads links for my property" - View advertising account connections.

### Custom Configuration

"Show me the custom dimensions and metrics for property 123456789" - Understand available custom data fields.

### Realtime Monitoring

"Show me current active users by country in realtime" - Monitor live visitor activity with dimensions like country and metrics like activeUsers.

### Realtime Event Tracking

"Get realtime data for 'purchase' events" - Track specific events as they happen using dimension filters.

### Historical Analysis

"Show me page views for the last 30 days by page path" - Analyze historical data with date range "30daysAgo" to "yesterday".

### Date Range Comparison

"Compare January 2025 vs February 2025 traffic" - Use multiple date ranges to compare periods.

### Event Filtering

"Show events from google / cpc source" - Apply dimension filters to segment data by traffic source.

### Metric Filtering

"Find pages with more than 100 views" - Use metric filters to find high-performing content.

### Sorted Reports

"Show top 10 pages by event count descending" - Apply OrderBy to sort results by metrics.

### Currency Conversion

"Show revenue in EUR instead of default currency" - Specify ISO4217 currency code like "EUR", "USD", or "JPY".

<Note>
  **Property ID Format:** Accepts either a number (e.g., 123456789) or string format "properties/123456789".

  **Report Limits:** Both run\_realtime\_report and run\_report return maximum 10 rows per request. Use offset for pagination to retrieve additional data.

  **Date Ranges:** Supports absolute dates ("2025-01-01") and relative dates ("yesterday", "today", "30daysAgo").

  **Filtering:** Uses Google Analytics Data API FilterExpression with support for:

  * Simple filters (string\_filter, numeric\_filter, in\_list\_filter, empty\_filter)
  * NOT expressions
  * AND/OR group filters
  * Independent dimension\_filter and metric\_filter application

  **Filter Limitations:** dimension\_filter and metric\_filter are applied independently. Complex combinations like `(dimension1 AND metric1) OR (dimension2 AND metric2)` require multiple report requests or client-side filtering.

  **Dimensions & Metrics:**

  * run\_realtime\_report: Only realtime dimensions and metrics from [Realtime API Schema](https://developers.google.com/analytics/devguides/reporting/data/v1/realtime-api-schema)
  * run\_report: Standard dimensions/metrics from [API Schema](https://developers.google.com/analytics/devguides/reporting/data/v1/api-schema) plus custom dimensions/metrics from get\_custom\_dimensions\_and\_metrics

  **Ordering:** Use OrderBy objects to sort by dimensions (with order\_type: ALPHANUMERIC, CASE\_INSENSITIVE, NUMERIC) or metrics in ascending/descending order.
</Note>

***

## Guardrails

In addition to the [14 universal guardrails](/civic/concepts/guardrails), this server has **41 server-specific guardrails** across 6 operations.

| Guardrail                              | Operation                           | Timing   | Description                                                                |
| -------------------------------------- | ----------------------------------- | -------- | -------------------------------------------------------------------------- |
| Filter Account IDs                     | `get_account_summaries`             | Response | Filters out specific account IDs from results                              |
| Filter Industry Vertical               | `get_account_summaries`             | Response | Filters properties by industry vertical                                    |
| Hide Property IDs                      | `get_account_summaries`             | Response | Hides property IDs for restricted properties                               |
| Limit Accounts Returned                | `get_account_summaries`             | Response | Limits number of accounts returned                                         |
| Redact Admin Emails                    | `get_account_summaries`             | Response | Redacts email addresses of account administrators                          |
| Block Sensitive Properties             | `get_custom_dimensions_and_metrics` | Request  | Blocks access to properties with sensitive data                            |
| Filter Custom Dimensions               | `get_custom_dimensions_and_metrics` | Response | Filters custom dimensions by name pattern including PII-related dimensions |
| Restrict Custom Dimension Properties   | `get_custom_dimensions_and_metrics` | Request  | Restricts to specific property IDs                                         |
| Block Property Patterns                | `get_property_details`              | Request  | Blocks properties matching certain patterns                                |
| Restrict Property IDs                  | `get_property_details`              | Request  | Restricts to approved property IDs only                                    |
| Block Ads Property Patterns            | `list_google_ads_links`             | Request  | Blocks access to certain property patterns                                 |
| Redact Conversion Tracking             | `list_google_ads_links`             | Response | Redacts conversion tracking details                                        |
| Restrict Ads Link Properties           | `list_google_ads_links`             | Request  | Restricts Google Ads links to specific property IDs only                   |
| Block Realtime Revenue Metrics         | `run_realtime_report`               | Request  | Blocks revenue and conversion metrics                                      |
| Block Sensitive Dimension Combinations | `run_realtime_report`               | Request  | Blocks sensitive dimension combinations                                    |
| Filter Realtime PII                    | `run_realtime_report`               | Response | Filters rows containing PII                                                |
| Filter Realtime Revenue                | `run_realtime_report`               | Response | Filters revenue and monetary metrics                                       |
| Hide Realtime Geo Details              | `run_realtime_report`               | Response | Hides geographic data below country level                                  |
| Limit Realtime Dimensions              | `run_realtime_report`               | Request  | Limits number of dimensions requested                                      |
| Limit Realtime Metrics                 | `run_realtime_report`               | Request  | Limits number of metrics requested                                         |
| Realtime Row Limit                     | `run_realtime_report`               | Request  | Enforces maximum row limit                                                 |
| Redact Realtime User IDs               | `run_realtime_report`               | Response | Redacts user identifiers from results                                      |
| Restrict Realtime Properties           | `run_realtime_report`               | Request  | Restricts realtime reports to specific property IDs                        |
| Block Report Dimension Combinations    | `run_report`                        | Request  | Blocks sensitive dimension combinations                                    |
| Block User-Scoped Dimensions           | `run_report`                        | Request  | Blocks user-scoped dimensions                                              |
| Filter IP Addresses                    | `run_report`                        | Response | Filters IP address information                                             |
| Filter Report PII                      | `run_report`                        | Response | Filters PII from dimension values                                          |
| Filter Transaction IDs                 | `run_report`                        | Response | Filters transaction IDs                                                    |
| Hide Report Geo Details                | `run_report`                        | Response | Hides detailed geographic information                                      |
| Limit Report Dimensions                | `run_report`                        | Request  | Limits number of dimensions                                                |
| Limit Report Metrics                   | `run_report`                        | Request  | Limits number of metrics                                                   |
| Redact Report Emails                   | `run_report`                        | Response | Redacts email and phone dimensions                                         |
| Redact Report User IDs                 | `run_report`                        | Response | Redacts user identifiers                                                   |
| Report Row Limit                       | `run_report`                        | Request  | Enforces maximum row limit                                                 |
| Restrict Report Properties             | `run_report`                        | Request  | Restricts reports to approved property IDs                                 |
| Redact Phone Numbers                   | *(all operations)*                  | Response | Redacts phone numbers (international formats) from responses               |

<Tip>
  Configure guardrails via the Civic UI or ask the Configurator Agent: "Add guardrails to my Google Analytics server."
</Tip>
