Learn business growth with Google Analytics 4 Forums Google Analytics 4 Google Analytics 4: How to Get the Most Out of the Minute Dimension

  • Google Analytics 4: How to Get the Most Out of the Minute Dimension

    Posted by Isabella on 21 July 2022 at 3:56 pm

    Hey there, I was looking at how to request a ‘minute’ from this guide: https://developers.google.com/analytics/devguides/reporting/data/v1/api-schema#dimensions. But when I tried to use this in the GA4 API, I got an error that said my request’s dimensions and metrics are not getting along and I should drop ‘minute’. Here’s the error I got:

    
    Error: InvalidArgument
    400 - "Please remove minute to make the request compatible. The request's dimensions & metrics are incompatible. To learn more, see https://ga-dev-tools.web.app/ga4/dimensions-metrics-explorer/"
    .
    .
    .
    "UNKNOWN:Error received from peer ipv6:%5B2800:3f0:4001:833::200a%5D:443 {grpc_message:"Please remove minute to make the request compatible. The request's dimensions & metrics are incompatible. To learn more, see https://ga-dev-tools.web.app/ga4/dimensions-metrics-explorer/", grpc_status:3, created_time:"2023-05-09T10:37:02.0337-03:00"}"
    

    And I was trying to do this:

    
    from google.analytics.data_v1beta import BetaAnalyticsDataClient
    from google.analytics.data_v1beta.types import (
        DateRange,
        Dimension,
        Metric,
        RunReportRequest,
    )
    
    def run_sample(property_id="YOUR-GA4-PROPERTY-ID"):
    
        client = BetaAnalyticsDataClient()
    
        request = RunReportRequest(
            property=f"properties/{property_id}",
            dimensions=[Dimension(name="minute")],
            metrics=[Metric(name="activeUsers")],
            date_ranges=[DateRange(start_date="2020-09-01", end_date="2020-09-15")],
        )
    
        response = client.run_report(request)
    
    run_sample("YOUR-GA4-PROPERTY-ID")
    

    Can anyone help?

    Luna replied 1 year ago 3 Members · 2 Replies
  • 2 Replies
  • Lucy

    Member
    5 December 2022 at 8:10 pm

    You’re encountering an error because the “minute” dimension and the “activeUsers” metric are not compatible. Some metrics can only be used with specific dimensions. “minute” is a dimension used to specify time, but “activeUsers” does not make sense within the scope of minutes because it generally measures over longer periods (e.g., sessions or days). You’ll need to modify your request so that the dimensions and metrics are compatible and make sense within the same scope. You can explore compatible dimensions and metrics on the GA DevTools website that your grpc_message linked to.

  • Luna

    Member
    24 December 2022 at 4:08 am

    The ‘minute’ dimension isn’t compatible with the ‘activeUsers’ metric in GA4 API. The dimensions and metrics need to match the data being requested. You can check the dimensions and metrics explorer link provided in your error message to see which dimensions and metrics can be combined.

Log in to reply.