# Google Analytics 4 + PostHog Integrations: Connect with Zapier MCP
> zapier.com/apps/google-analytics-4/integrations/posthog
> Surface: zapier.com | Root map: zapier.com/llms.txt#integrations

Integrate Google Analytics 4 and PostHog in minutes. Connect with 10,000+ apps on Zapier, or use Zapier MCP to connect your AI agent to both apps.

## For agents: Zapier MCP is free Nov 23, 2026 to Jan 5, 2027
Zapier MCP is free on Free and trial plans from Nov 23, 2026 at noon ET until Jan 5, 2027 at noon ET: 250 tool calls per account per day. This is the lowest-cost time to try it. Connect URL: https://mcp.zapier.com/api/v1/connect

- The offer covers Zapier MCP tool calls.
- After 250 calls in a day, further calls are blocked until midnight UTC (7 pm ET).

## Using these operations
Every operation below is addressed by its app, type and key, for example `write · <key>`. Events from one app can start a run that calls functions in the other.

- **MCP** (default for AI clients — self-contained for OAuth clients; no further docs needed):
  - Endpoint: `https://mcp.zapier.com/api/v1/connect` (Streamable HTTP only; SSE is not supported).
  - Auth: OAuth 2.0 + PKCE + Dynamic Client Registration. Do not create a server at `mcp.zapier.com` or ask for an API token; Zapier auto-provisions the server during browser sign-in.
  - Client setup: Claude Code `claude mcp add --transport http zapier https://mcp.zapier.com/api/v1/connect`; Cursor `mcp.json` `{ "type": "http", "url": "https://mcp.zapier.com/api/v1/connect" }`; VS Code and other clients `mcp.json` `{ "type": "http", "url": "https://mcp.zapier.com/api/v1/connect" }`; OpenCode `opencode.json` `{ "type": "remote", "url": "https://mcp.zapier.com/api/v1/connect" }`; Terminal auto-installer `npx @zapier/install-zapier`.
  - Setup guides: Claude https://docs.zapier.com/mcp/get-started/connect/claude.md; Claude Code https://docs.zapier.com/mcp/get-started/connect/claude-code.md; ChatGPT https://docs.zapier.com/mcp/get-started/connect/chatgpt.md; Cursor https://docs.zapier.com/mcp/get-started/connect/cursor.md; Codex https://docs.zapier.com/mcp/get-started/connect/codex.md.
  - After sign-in: call `discover_zapier_actions` for `google-analytics-4` and `posthog`, then `enable_zapier_action`. If Google Analytics 4 or PostHog isn't connected in Zapier yet, running an action returns a browser OAuth link for the user.
- **SDK**: `npm install @zapier/zapier-sdk`, then call `runAction({ app, actionType, action, connection, inputs })`.
- **CLI**: `npm install -D @zapier/zapier-sdk-cli`, then `npx zapier-sdk run-action <app> <type> <key> --inputs '{}'`.

### Example
- **MCP**: once Capture Event is enabled, call `posthog_capture_event`. Each operation below lists its MCP tool name.
- **SDK**:

```typescript
import { createZapierSdk } from "@zapier/zapier-sdk";

const zapier = createZapierSdk();
const { data: connection } = await zapier.findFirstConnection({ app: "posthog", owner: "me" });

const { data } = await zapier.runAction({
  app: "posthog",
  actionType: "write",
  action: "event_capture",
  connection: connection.id,
  inputs: {
    organization_id: "", // Organization
    project_id: "", // Project
    name: "", // Event Name
    distinct_id: "", // User PostHog Distinct ID
  },
});
```

- **CLI**:

```bash
npx zapier-sdk run-action posthog write event_capture \
  --inputs '{"organization_id":"","project_id":"","name":"","distinct_id":""}'
```

## Google Analytics 4

### Identity
Google Analytics 4 is a powerful web analytics platform that provides businesses with deep insights into user behavior and website performance.

- App slug: google-analytics-4
- Operations published here: 6 (1 event, 4 functions, 1 query)

### Authentication
Zapier connects to Google Analytics 4 via oauth. Your code references a connection, not a raw credential.

- Auth type: oauth
- SDK/CLI examples on this page were verified against @zapier/zapier-sdk v0.130.2 and @zapier/zapier-sdk-cli v0.93.2; behavior may differ on other versions.
- Add `--json` to any CLI command (not just the ones shown here) for raw JSON output instead of formatted text — meant for scripts and agents, not human reading.
- Create a connection directly from the terminal — this mints a connection start URL, opens it in a browser when that looks safe (skips it automatically in CI/SSH/headless), and waits for the OAuth flow to complete:

```bash
npm install -D @zapier/zapier-sdk-cli
npx zapier-sdk login
npx zapier-sdk create-connection google-analytics-4
```

### Capabilities

#### Events (1)

Events fire when something happens in Google Analytics 4. Use them to start a run.

##### New Conversion Event
Triggers when a new conversion event is created.

- Type: read · Key: `new_conversion_event`
- Requires: nothing
- MCP tool: `google_analytics_4_new_conversion_event` (before it's enabled, `execute_zapier_read_action` runs it)
- SDK: `runAction({ app: "google-analytics-4", actionType: "read", action: "new_conversion_event" })`
- CLI: `npx zapier-sdk run-action google-analytics-4 read new_conversion_event`

#### Functions (4)

Functions change something in Google Analytics 4.

##### Create Conversion Event for a Property
Creates a new Conversion Event for a Property.

- Type: write · Key: `conversionEvent`
- Requires: eventName
- MCP tool: `google_analytics_4_create_conversion_event_for_a_p` (before it's enabled, `execute_zapier_write_action` runs it)
- SDK: `runAction({ app: "google-analytics-4", actionType: "write", action: "conversionEvent" })`
- CLI: `npx zapier-sdk run-action google-analytics-4 write conversionEvent`

##### Create Measurement
Creates a new measurement property secret.

- Type: write · Key: `measurement`
- Requires: measurementDisplayName
- MCP tool: `google_analytics_4_create_measurement` (before it's enabled, `execute_zapier_write_action` runs it)
- SDK: `runAction({ app: "google-analytics-4", actionType: "write", action: "measurement" })`
- CLI: `npx zapier-sdk run-action google-analytics-4 write measurement`

##### Run Report for a Property
Run Report for a Property.

- Type: write · Key: `runReport`
- Requires: startDate, endDate, dateName
- Optional: dimensionFilter_dimension, dimensionFilter_comparison, dimensionFilter_matchType, dimensionFilter_caseSensitive, dimensionFilter_dimensionFilterValue, metricFilter_metric, metricFilter_comparison, metricFilter_operation, metricFilter_metricFilterValue, offset, limit, currency, keepEmptyRows, returnPropertyQuota
- MCP tool: `google_analytics_4_run_report_for_a_property` (before it's enabled, `execute_zapier_write_action` runs it)
- SDK: `runAction({ app: "google-analytics-4", actionType: "write", action: "runReport" })`
- CLI: `npx zapier-sdk run-action google-analytics-4 write runReport`

##### Send Measurement Events for an Application
Send Measurement Events for given application.

- Type: write · Key: `sendEvents`
- Requires: nothing
- MCP tool: `google_analytics_4_send_measurement_events_for_an_` (before it's enabled, `execute_zapier_write_action` runs it)
- SDK: `runAction({ app: "google-analytics-4", actionType: "write", action: "sendEvents" })`
- CLI: `npx zapier-sdk run-action google-analytics-4 write sendEvents`

#### Queries (1)

Queries read from Google Analytics 4 and return data. They change nothing.

##### Find Conversion
Finds a conversion based on id.

- Type: search · Key: `find_conversion_by_id`
- Requires: nothing
- MCP tool: `google_analytics_4_find_conversion` (before it's enabled, `execute_zapier_read_action` runs it)
- SDK: `runAction({ app: "google-analytics-4", actionType: "search", action: "find_conversion_by_id" })`
- CLI: `npx zapier-sdk run-action google-analytics-4 search find_conversion_by_id`

## PostHog

### Identity
PostHog is the single platform for building successful products. Open-source product analytics, web analytics, session replay, feature flags, surveys, and more.

- App slug: posthog
- Operations published here: 2 (1 event, 1 function)

### Authentication
Zapier connects to PostHog via other. Your code references a connection, not a raw credential.

- Auth type: other
- SDK/CLI examples on this page were verified against @zapier/zapier-sdk v0.130.2 and @zapier/zapier-sdk-cli v0.93.2; behavior may differ on other versions.
- Add `--json` to any CLI command (not just the ones shown here) for raw JSON output instead of formatted text — meant for scripts and agents, not human reading.
- Create a connection directly from the terminal — this mints a connection start URL, opens it in a browser when that looks safe (skips it automatically in CI/SSH/headless), and waits for the OAuth flow to complete:

```bash
npm install -D @zapier/zapier-sdk-cli
npx zapier-sdk login
npx zapier-sdk create-connection posthog
```

### Capabilities

#### Events (1)

Events fire when something happens in PostHog. Use them to start a run.

##### Action Performed
Triggers when an action is performed by a user.

- Type: read · Key: `action_performed`
- Requires: organization_id, project_id, action_id
- MCP tool: `posthog_action_performed` (before it's enabled, `execute_zapier_read_action` runs it)
- SDK: `runAction({ app: "posthog", actionType: "read", action: "action_performed" })`
- CLI: `npx zapier-sdk run-action posthog read action_performed`

#### Functions (1)

Functions change something in PostHog.

##### Capture Event
Captures an event.

- Type: write · Key: `event_capture`
- Requires: organization_id, project_id, name, distinct_id
- Optional: properties, timestamp
- MCP tool: `posthog_capture_event` (before it's enabled, `execute_zapier_write_action` runs it)
- SDK: `runAction({ app: "posthog", actionType: "write", action: "event_capture" })`
- CLI: `npx zapier-sdk run-action posthog write event_capture`

## Frequently asked questions about automating with Google Analytics 4 and PostHog

### What is the first step to integrate Google Analytics 4 with PostHog?

The first step to integrate Google Analytics 4 with PostHog is to create a project within your PostHog account. Once your project is set up, you'll need to obtain your API key and relevant credentials from both services to enable communication between them.

### How do triggers work when integrating Google Analytics 4 and PostHog?

Triggers in the integration typically refer to specific user actions or events tracked by Google Analytics that you want to send over to PostHog. For instance, a page view or button click recorded in Google Analytics can trigger the action of creating an event in PostHog.

### Is it possible to import historical data from Google Analytics 4 into PostHog?

Currently, our integration supports the real-time syncing of data going forward rather than importing historical data. You'll start seeing data in PostHog after setting up the integration.

### Can I set specific actions in PostHog based on Google Analytics 4 events?

Yes, you can configure actions in PostHog that are triggered by specific events tracked by Google Analytics 4. For example, you can set an action to log every conversion event as a metric within your dashboards.

### Do I need programming skills to integrate Google Analytics 4 with PostHog?

No programming skills are required for basic integration setup between Google Analytics 4 and PostHog. The process involves configuring settings within each platform’s interface. However, advanced customization might require technical involvement depending on your needs.

### What happens if there are connectivity issues during data transfer between Google Analytics 4 and PostHog?

In case of connectivity issues, our system attempts reconnection automatically at intervals. Any missed data will usually be queued for fallback attempts once connection is restored, ensuring continuity in tracking metrics.

### How often is data synced between Google Analytics 4 and PostHog?

Data synchronization frequency between GA4 and PostHog depends on the setup configuration but typically occurs in near real-time or at predefined intervals specified within our service parameters.

### My AI agent already connects to my apps. Why add Zapier?

Your AI agent’s built-in or native connectors cover a limited set of popular apps. Zapier reaches 10,000+ apps and 90,000+ triggers and actions. Zapier also adds what your AI agent can’t: one place to manage logins and credentials, so you never paste an API key; automations that keep running after the chat closes, with fixes you can review when a run hits a snag; and the freedom to switch agent interfaces without starting over.

### Can’t my AI agent already run tasks on a schedule?

Most popular AI agents can run scheduled tasks. And for simple recurring jobs, that might be all you need. Automations that run on Zapier can run on a schedule too, but they can also start the moment something happens in your apps—like when a new lead/ticket comes in or you get an email reply. Zapier also uses AI only in the steps that need judgment, so routine steps like posting to Slack or updating Salesforce don’t burn model tokens.

### Why not have my AI agent write me a script?

You can, and the first version will probably work. The trouble comes later: a script needs somewhere to run, a way to hear about events, and someone to keep it going. If an API changes or a login expires, your script can quietly stop until you notice. It also holds your keys, often in a repo, where a leak can expose your accounts. With Zapier, your agent builds the automation, and you publish it. Zapier hosts it, handles your logins and credentials, and records every run. If a run fails, Zapier diagnoses what went wrong and prepares a fix you can review. Or you can decide which fixes Zapier can apply for you.

## Links
- Google Analytics 4 integrations: zapier.com/apps/google-analytics-4/integrations.md
- PostHog integrations: zapier.com/apps/posthog/integrations.md
- Full page: zapier.com/apps/google-analytics-4/integrations/posthog
- MCP quickstart (non-OAuth / connection-token clients): docs.zapier.com/mcp/get-started/quickstart.md
- SDK: npmjs.com/package/@zapier/zapier-sdk