googleapis / python-analytics-data

This library has moved to https://github.com/googleapis/google-cloud-python/tree/main/packages/google-analytics-data
Apache License 2.0
159 stars 36 forks source link

Multiple breakdown dimensions #353

Closed a-marzotto closed 1 year ago

a-marzotto commented 1 year ago

Environment details

Steps to reproduce

Attempting to add multiple dimensions as breakdown in funnel report. In run_funnel_report.py replace line of code: breakdown_dimension=Dimension(name="deviceCategory") with: breakdown_dimension=[Dimension(name="deviceCategory"),Dimension(name="countryId")]

Returns error: TypeError: Message must be initialized with a dict: google.analytics.data.v1alpha.FunnelBreakdown

Code example

request = RunFunnelReportRequest(
        property=f"properties/{property_id}",
        date_ranges=[DateRange(start_date="30daysAgo", end_date="today")],
        funnel_breakdown=FunnelBreakdown(
            breakdown_dimension=[Dimension(name="deviceCategory"),Dimension(name="countryId")]
        )
parthea commented 1 year ago

It appears that breakdown_dimension can only be 1 dimension. See the definition of funnelBreakdown here https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/runFunnelReport#request-body. dimensionFilter may be helpful as the definition for that field states Dimension filters allow you to ask for only specific dimension values in the report.

The example here may be helpful: https://developers.google.com/analytics/devguides/reporting/data/v1/basics#dimension_filters

This client library is automatically generated using the API surface defined in https://github.com/googleapis/googleapis/tree/master/google/analytics/data/v1alpha. For questions regarding the API itself, please use the support resources on this page.