Skip to main content
Glama
ZLeventer

Google Analytics MCP Server

ga4_landing_page_performance

Analyze top landing pages by sessions, engagement, and conversions. Optionally filter by channel like Organic Search or Paid Search to evaluate performance.

Instructions

Top landing pages by sessions/engagement/conversions. Optional channel filter (e.g. 'Organic Search', 'Paid Search').

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
start_dateNoStart date: YYYY-MM-DD, NdaysAgo, yesterday, or today28daysAgo
end_dateNoEnd date: YYYY-MM-DD, NdaysAgo, yesterday, or todayyesterday
property_idNoOverride GA4_PROPERTY_ID env var for this call
limitNoMax rows to return
channelNoOptional sessionDefaultChannelGroup filter, e.g. 'Organic Search', 'Paid Search'

Implementation Reference

  • src/index.ts:91-98 (registration)
    Registration of the 'ga4_landing_page_performance' tool with the MCP server, including its description and schema reference.
    server.tool(
      "ga4_landing_page_performance",
      "Top landing pages by sessions/engagement/conversions. Optional channel filter (e.g. 'Organic Search', 'Paid Search').",
      landingPageSchema,
      async (args) => {
        try { return ok(await landingPagePerformance(args)); } catch (e) { return err(e); }
      }
    );
  • Zod schema for landing_page_performance: date range params with optional channel filter.
    export const landingPageSchema = {
      ...dateRange,
      channel: z.string().optional().describe("Optional sessionDefaultChannelGroup filter, e.g. 'Organic Search', 'Paid Search'"),
    };
  • Handler function that queries GA4 for top landing pages by sessions/engagement/conversions, with optional channel group filter.
    export async function landingPagePerformance(args: z.infer<z.ZodObject<typeof landingPageSchema>>) {
      const [res] = await getClient().runReport({
        property: getProperty(args.property_id),
        dateRanges: toDateRange(args.start_date, args.end_date),
        dimensions: [{ name: "landingPage" }, { name: "sessionDefaultChannelGroup" }],
        metrics: [
          { name: "sessions" },
          { name: "totalUsers" },
          { name: "engagementRate" },
          { name: "averageSessionDuration" },
          { name: "conversions" },
          { name: "keyEvents" },
        ],
        dimensionFilter: args.channel
          ? { filter: { fieldName: "sessionDefaultChannelGroup", stringFilter: { value: args.channel } } }
          : undefined,
        orderBys: [{ metric: { metricName: "sessions" }, desc: true }],
        limit: args.limit as unknown as number,
      });
      return formatReport(res);
    }
  • Helper function formatReport transforms GA4 API response into a clean rows/rowCount format used by the handler.
    function formatReport(res: any) {
      const rows = (res.rows ?? []).map((r: any) => {
        const out: Record<string, string | number> = {};
        (res.dimensionHeaders ?? []).forEach((h: any, i: number) => {
          out[h.name] = r.dimensionValues?.[i]?.value ?? "";
        });
        (res.metricHeaders ?? []).forEach((h: any, i: number) => {
          const v = r.metricValues?.[i]?.value ?? "0";
          const n = Number(v);
          out[h.name] = Number.isFinite(n) ? n : v;
        });
        return out;
      });
      return { rowCount: res.rowCount ?? rows.length, rows };
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the burden. It states the tool returns top landing pages by specified metrics and mentions an optional filter. However, it does not disclose whether data is historical, any rate limits, permission needs, or response format. The schema covers parameters, but the description adds limited behavioral context beyond its core function.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence followed by a parenthetical example. It is front-loaded with the core purpose ('Top landing pages by sessions/engagement/conversions') and wastes no words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema, the description hints at the return type (top landing pages with metrics) but does not specify exact columns or ranking details. For a simple listing tool, it is largely complete, but could be slightly improved by noting it returns a ranked list.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so baseline is 3. The description reiterates the channel filter with examples, adding minimal new information beyond the schema's parameter descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool returns top landing pages with key metrics (sessions, engagement, conversions) and mentions an optional channel filter. This effectively distinguishes it from sibling tools that focus on other dimensions like campaigns or channels.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for landing page analysis with optional channel filtering but provides no explicit guidance on when to use this tool versus alternatives like ga4_channel_performance or ga4_campaign_performance, given the sibling list.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ZLeventer/google-analytics-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server