> For the full index of Sherpa pages for agents, see https://www.withsherpa.ai/llms.txt

URL: https://www.withsherpa.ai/docs/analytics-connections
Title: PostHog and Google Analytics | Sherpa Docs
Description: Connect the analytics tools you already use so your agent can answer questions from them too.

[Docs](https://www.withsherpa.ai/docs) Forms and integrations

# PostHog and Google Analytics

Connect the analytics tools you already use so your agent can answer questions from them too.

You probably have years of history in Google Analytics, or product events in PostHog. You do not have to give either up. Connect them and your agent can answer from all three sources in one chat, and tell you where they disagree.

## See it in action

Ask your agent this.

> Using our Google Analytics data, which landing pages brought the most visitors last month? Then answer the same question from Sherpa's own analytics and tell me where the two disagree.

It answers with something like this.

The order is the same in both.

| Landing page | Google Analytics | Sherpa |
| --- | --- | --- |
| /pricing | 212,400 | 228,100 |
| /templates | 141,900 | 150,300 |
| Homepage | 96,200 | 119,400 |

Sherpa counts a little higher, mostly on the homepage. That is common when some visitors block Google Analytics.

## What happens

1. In Sherpa, open **Connections** and connect PostHog or Google Analytics.

2. Ask your agent a question and name the source you want it to use.

3. Your agent runs the query and explains the answer in plain words.

## What to check

- The numbers are close to what you see in the tool itself for the same dates.

## Three sources, one chat

| Source | Best for |
| --- | --- |
| Sherpa | Everything on the website. Clicks, scrolling, bookings, experiments and AI agents. See [Read your analytics](https://www.withsherpa.ai/docs/analytics-overview) |
| PostHog | What people do in your product after they sign up |
| Google Analytics | History from before you moved to Sherpa, and numbers that match your ad platforms |

When a tool is connected, your agent can query it the same way it queries Sherpa. If you do not name a source, it uses Sherpa.

## Good to know

### Numbers will differ a little

Each tool counts visitors and sessions its own way and filters bots differently. Compare trends and rankings, not exact totals.

### Use their events as goals

A [funnel](https://www.withsherpa.ai/docs/funnels) step can be an event from PostHog or Google Analytics, such as a signup. That lets an experiment on your website be judged by what happened in your product.

**Pro tip**

Once PostHog or Google Analytics is connected, ask your agent to combine it with Sherpa's analytics. You get one journey, from the first page someone read to what they did in your product, which neither tool shows alone.

## Common questions

### Do I have to give up Google Analytics or PostHog to use Sherpa?

No. Connect either one under Connections and your agent can answer from it in the same chat as Sherpa's own analytics.

### Which source should I ask about?

Sherpa for everything on the website, PostHog for what people do in your product after they sign up, and Google Analytics for history from before you moved.

### Can a PostHog event be the goal of an experiment?

Yes. A PostHog or Google Analytics event can be a step in a funnel, and a funnel can be the goal of an A/B test. See [Funnels](https://www.withsherpa.ai/docs/funnels).

## Example prompts

Each one works as written in Claude or ChatGPT once Sherpa is connected. Swap in your own pages and dates.

### The request from the example

> Using our Google Analytics data, which landing pages brought the most visitors last month? Then answer the same question from Sherpa's own analytics and tell me where the two disagree.

Naming the source tells your agent which data to use. Asking both shows you how far to trust either number.

### The pricing to signup count

> From PostHog, how many visitors who landed on /pricing last month went on to sign up?

It joins the website to the product, which is the number most teams care about and rarely have.

### The long view

> Using Google Analytics, chart organic search visitors by month for the last year.

Google Analytics holds the history from before your website moved, so name it for anything older.

## For agents

Sherpa MCP tools for this job, in the order they are usually called. `get_analytics_schema`, `query_analytics`. Work inside a change, and only call submit_change when the person asks to publish. A person presses Publish. Every tool is described in the [MCP reference](https://www.withsherpa.ai/docs/mcp-reference).

## Next

[**Scripts and pixels** Add a tracking script, chat widget or ad pixel to your website.](https://www.withsherpa.ai/docs/scripts-and-pixels) [**Read your analytics** See everything Sherpa records about your website, what the dashboard shows and how much more your agent can pull out of it.](https://www.withsherpa.ai/docs/analytics-overview)
