Skip to content

Add dimension/metric filter and metadata flags to reports run#1

Open
sandiegodj wants to merge 1 commit intomasterfrom
feat/dimension-filter-metadata
Open

Add dimension/metric filter and metadata flags to reports run#1
sandiegodj wants to merge 1 commit intomasterfrom
feat/dimension-filter-metadata

Conversation

@sandiegodj
Copy link

@sandiegodj sandiegodj commented Feb 13, 2026

Summary

  • Adds --dimension-filter <json> and --metric-filter <json> flags to ga4 reports run, enabling server-side filtered queries through the CLI
  • Adds --include-metadata flag that wraps output as {rows, metadata, rowCount}, surfacing sampling info the API returns but the CLI was previously discarding
  • Expands RunReportResponse metadata type to include samplingMetadatas fields

These were the blockers for migrating the MDE calculator skill from analytics-mcp to ga4-cli. Without --dimension-filter, every query that needs "pagePath contains /pricing" or "eventName equals form_submit" was impossible through the CLI.

Test plan

  • 3 new tests added (dimension filter passthrough, andGroup structure, metadata envelope with sampling)
  • All 28 tests pass (npm test)
  • Manually verified with live GA4 queries against Embark property (342047065)
  • Confirmed --include-metadata output parses correctly when piped to mde_calculator.py check-sampling

🤖 Generated with Claude Code

…ports run

The CLI had dimensionFilter/metricFilter in its request interface but
never exposed them as flags, making filtered queries impossible. This
also adds --include-metadata to surface sampling info that the API
returns but the CLI was discarding.

- --dimension-filter <json>: parse and attach to request body
- --metric-filter <json>: same pattern for metric filters
- --include-metadata: wrap output as {rows, metadata, rowCount}
- Expand RunReportResponse.metadata to include samplingMetadatas
- JSON parse validation with clear error on invalid input
- 3 new tests: filter passthrough, andGroup structure, metadata envelope
- AGENTS.md updated with new flags and examples

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant