C
Cody
Marketing & Ads

Connecting OpenClaw with Google Analytics: A Practical Guide

·3 min read

Google Analytics 4 is where most teams track their web traffic and conversions. Connecting OpenClaw to GA4 means your Slack bot can answer questions about sessions, conversions, and traffic sources without anyone opening the Analytics UI.

How OpenClaw Integrations Work

OpenClaw is a self-hosted AI assistant that runs on your own server — typically an EC2 instance — and connects to Slack. It uses Claude under the hood to process requests. Out of the box, OpenClaw doesn't ship with pre-built connections to third-party tools. Instead, integrations are built using the skills system: markdown files in ~/.openclaw/skills/ that give Claude instructions for a particular domain, combined with HTTP tool calls to any API you expose to it.

In practice, adding a real integration means: getting API credentials from the third-party service, building or configuring a small proxy/endpoint that OpenClaw can call, and writing a skill file that tells Claude how to use it. For some tools this is an afternoon of work. For others — like Google Analytics — it's considerably more involved.

Connecting OpenClaw with Google Analytics: Step by Step

Step 1: Enable the Google Analytics Data API

Create a Google Cloud project (or use an existing one), enable the Google Analytics Data API, and create a Service Account. Download the service account JSON key — this is how your proxy will authenticate. Go to GA4 → Admin → Account Access Management and add the service account email with Viewer role.

Step 2: Understand the Reporting API

GA4's Data API uses a runReport endpoint where you specify dimensions (e.g., date, sessionSource) and metrics (e.g., sessions, conversions). This is fundamentally different from the old Universal Analytics API. Familiarise yourself with GA4's dimension and metric names before building your proxy — they changed significantly from UA.

Step 3: Build the Proxy and Skill File

Use the @google-analytics/data Node.js client or the Python equivalent in your proxy. Write ~/.openclaw/skills/google-analytics.md documenting the types of traffic questions that can be answered and the properties available (if you have multiple GA4 properties, include their IDs).

Challenges and Caveats

GA4's Dimension/Metric Model Takes Getting Used To

GA4 moved away from UA's session-based model to an event-based model. Dimension and metric names changed, some concepts no longer exist, and new ones appeared. If your skill file uses UA-era terminology, queries will fail silently or return unexpected results.

Data Sampling on Free Properties

GA4 Standard (free) properties may apply data sampling on complex queries or large date ranges. Results are approximate. If your team relies on exact conversion counts, this is worth knowing.

Real-Time Data Has Its Own API

The standard runReport endpoint returns data with a processing delay (typically 24–48 hours for some dimensions). If you want real-time data, you need the runRealtimeReport endpoint, which has a different set of supported dimensions and metrics.


Skip All of This — Use Cody Instead

Cody has Google Analytics integration built in. Ask about traffic, conversions, or anomalies in Slack and get an answer — no service accounts, no API keys.

Get started with Cody →


Related Guides


Need the model-flexible version? See: How to Connect Google Analytics to OpenClaw: Setup, Models, and Workflow Guide.