Analytics · Analytics

Run a Google Analytics (GA4) report

Runs a Google Analytics (GA4) report.

POSThttps://api.pozy.ai/v1/analytics/googleanalytics/report
runGoogleAnalyticsReport

Guides: Google Analytics, Platform insights

Request

Send your API key as Authorization: Bearer pz_live_.... Read-only keys cannot call it. Keys with the analytics resource group disabled get 403 resource_group_disabled. Authentication

Request body

application/json, required

  • accountIdstringrequired
  • dimensionsarray of string

    Up to 9 items.

  • metricsarray of stringrequired

    At least 1 item. Up to 10 items.

  • dimensionFilterobject
  • metricFilterobject
  • orderBysarray of object

    Up to 10 items.

  • limitinteger

    1 to 10000.

  • dateRangesarray of object

    At least 1 item. Up to 4 items.

    • startDatestringrequired
    • endDatestringrequired
    • namestring
  • offsetinteger

    At least 0.

  • keepEmptyRowsboolean
  • currencyCodestring

Example

curl -X POST "https://api.pozy.ai/v1/analytics/googleanalytics/report" \
  -H "Authorization: Bearer $POZY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "accountId": "696e0b682d0a31188e7a2ba9",
  "metrics": [
    "string"
  ],
  "dateRanges": [
    {
      "startDate": "string",
      "endDate": "string"
    }
  ],
  "offset": 1,
  "keepEmptyRows": true
}'

Response

200 on success

  • accountIdstring
  • propertyIdstring
  • dimensionHeadersarray of object
    • namestring
  • metricHeadersarray of object
    • namestring
    • typestring
  • rowsarray of object
    • dimensionValuesarray of object
      1 child field
      • valuestring
    • metricValuesarray of object
      1 child field
      • valuestring
  • rowCountinteger
  • metadataobject
  • propertyQuotaobject
200 response
{
  "accountId": "696e0b682d0a31188e7a2ba9",
  "propertyId": "67197e35a04da83e86751673",
  "dimensionHeaders": [
    {
      "name": "Acme"
    }
  ],
  "metricHeaders": [
    {
      "name": "Acme",
      "type": "string"
    }
  ],
  "rows": [
    {
      "dimensionValues": [
        {
          "value": "string"
        }
      ],
      "metricValues": [
        {
          "value": "string"
        }
      ]
    }
  ],
  "rowCount": 42,
  "metadata": {},
  "propertyQuota": {}
}

Errors

Errors use one shape: { error, type, code, param?, details? }. The ones you are most likely to see here:

400invalid_request_errorA parameter or body field is missing or invalid. param names it.
401authentication_errorThe API key is missing, revoked or expired.
403permission_errorThe key is read-only, scoped to other profiles, or has this resource group disabled.
429rate_limit_errorToo many requests this minute. Wait for Retry-After seconds.

Every code is listed in Errors.

More in Analytics