Learn business growth with Google Analytics 4 Forums Google Analytics 4 Issue with missing dates in GA4 API response when creating daily chart Reply To: Issue with missing dates in GA4 API response when creating daily chart

  • Alexander

    Member
    20 April 2023 at 8:32 am

    It seems from the Google Analytics 4 API documentation that the response body from the runPivotReport function does not directly contain date data. The API appears to assume that the user already knows the date ranges that were requested. Here’s the structure of the response body:

    `
    {
    “pivotHeaders”: [
    {
    object (PivotHeader)
    }
    ],
    “dimensionHeaders”: [
    {
    object (DimensionHeader)
    }
    ],
    “metricHeaders”: [
    {
    object (MetricHeader)
    }
    ],
    “rows”: [
    {
    object (Row)
    }
    ],
    “aggregates”: [
    {
    object (Row)
    }
    ],
    “metadata”: {
    object (ResponseMetaData)
    },
    “propertyQuota”: {
    object (PropertyQuota)
    },
    “kind”: string
    }
    `

    As you can see from this structure, there are no specific fields for the start or end dates of the date range.