feat: add support for funnel reports#54
feat: add support for funnel reports#54cagnusmarlsen wants to merge 7 commits intogoogleanalytics:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
8becde3 to
b46f025
Compare
b46f025 to
0db3192
Compare
jradcliff
left a comment
There was a problem hiding this comment.
Thank you so much for this PR! I added a few comments and suggestions.
- Josh, Google Analytics team
| """Run a Google Analytics Data API funnel report. | ||
|
|
There was a problem hiding this comment.
| """Run a Google Analytics Data API funnel report. | |
| """Run a Google Analytics Data API funnel report. | |
| See the funnel report guide at | |
| https://developers.google.com/analytics/devguides/reporting/data/v1/funnels | |
| for details and examples. | |
There was a problem hiding this comment.
Yh data analysis programing method
| """ | ||
|
|
||
|
|
||
| def _run_funnel_report_description() -> str: |
There was a problem hiding this comment.
Could you move this file into a funnel.py file, similar to how we separate out runReport into core.py, run_realtime_report into realtime.py, and get_custom_dimensions_and_metrics, etc. into metadata.py?
| Example: | ||
| [ | ||
| { | ||
| "name": "Page View", | ||
| "filter_expression": { | ||
| "funnel_field_filter": { | ||
| "field_name": "eventName", | ||
| "string_filter": { | ||
| "match_type": "EXACT", | ||
| "value": "page_view" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "name": "Sign Up", | ||
| "event": "sign_up" | ||
| } | ||
| ] |
There was a problem hiding this comment.
Please move the JSON examples into separate methods that you call here, similar to what we're doing with date range hints, etc. for runReport:
This offers a few advantages:
- It keeps this docstring reasonably short.
- In the methods that return JSON, you can use the client library to generate the JSON so you know that it's well-formed. This will also make maintenance easier if the API objects evolve and change.
|
Hi Josh, |
|
@cagnusmarlsen If you can resolve the conflicts, I'll get this merged. |
| ), | ||
| data_v1alpha.FunnelFilterExpression( | ||
| funnel_field_filter=data_v1alpha.FunnelFieldFilter( | ||
| field_name="pagePath", |
There was a problem hiding this comment.
Hi! I use the funnel report function you created! But meet this problem:
{"error": "Failed to execute tool 'run_funnel_report': 400 Field 'pagePath' is not currently supported inside segments & funnel steps. For a list of valid dimensions and metrics, see https://developers.google.com/analytics/devguides/reporting/data/v1/exploration-api-schema "}"
I think you can use
`field_name="pageLocation",
string_filter=data_v1alpha.StringFilter(
match_type=data_v1alpha.StringFilter.MatchType.CONTAINS,
value=step_dict["page_path"],`
It will also change the logic from EXACT to CONTAINS....but can get the data
|
Would be great to merge this PR, seems like almost done ? |
|
Hey, I've been meaning to get to this for a while. I'll resolve the
conflicts over the weekend and we can hopefully get this merged after that!
…On Fri, 27 Mar 2026 at 4:14 PM, Michael DeRazon ***@***.***> wrote:
*mderazon* left a comment (googleanalytics/google-analytics-mcp#54)
<#54?email_source=notifications&email_token=AV4QW5EAFCTO3NLBMJWTFM34SZLQHA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMJUGE3TEMRVGQ3KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJNLQOJPWG33NNVSW45C7N5YGK3S7MNWGSY3L#issuecomment-4141722546>
Would be great to merge this PR, seems like almost done ?
@cagnusmarlsen <https://github.com/cagnusmarlsen> if you can't make it I
can try
—
Reply to this email directly, view it on GitHub
<#54?email_source=notifications&email_token=AV4QW5EAFCTO3NLBMJWTFM34SZLQHA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMJUGE3TEMRVGQ3KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJNLQOJPWG33NNVSW45C7N5YGK3S7MNWGSY3L#issuecomment-4141722546>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AV4QW5BZXBAZQZDHRHM7FFT4SZLQHAVCNFSM6AAAAACFMJOV4SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DCNBRG4ZDENJUGY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
Thanks @cagnusmarlsen I created a new PR #127 based on your work to resolve the conflicts let's wait for @matt-landers / team to check it out |
|
Thanks you every for sorporting the google service |
This PR aims to add support for generating funnel reports using the Google Analytics MCP server. It adds a
run_funnel_reporttool that uses the runFunnelReport method to generate funnel reports based on user queries.