Skip to content

Explore Google Analytics

GET
/api/v1/google-analytics/explore
curl --request GET \
--url 'https://digize.com/api/v1/google-analytics/explore?metrics=sessions&startDate=28daysAgo&endDate=yesterday&compare=previousPeriod&orderBy=sessions&order=desc&limit=100' \
--header 'x-api-key: <x-api-key>'

A GA4 report built to order: up to 10 metrics broken down by up to 9 dimensions, over any days GA4 has (28daysAgo to yesterday unless asked), against another range if asked, filtered by dimension values, sorted and cut to a limit. For what googleAnalytics.report doesn’t answer, such as landing pages by device, a campaign’s purchases, or a page’s engagement against the month before.

Needs the analytics:read permission.

metrics
required

GA4’s metric names. Rates (engagementRate, bounceRate, sessionKeyEventRate) are 0 to 1, durations seconds, revenue in the property’s currency; keyEvents are what GA4 used to call conversions; the item metrics count products and go with itemName.

Array<string>
>= 1 items <= 10 items
Allowed values: sessions totalUsers newUsers activeUsers engagedSessions engagementRate bounceRate averageSessionDuration userEngagementDuration screenPageViews screenPageViewsPerSession eventCount keyEvents sessionKeyEventRate addToCarts checkouts ecommercePurchases purchaseRevenue totalRevenue averagePurchaseRevenue firstTimePurchasers itemsViewed itemsAddedToCart itemsPurchased itemRevenue

GA4’s metric names. Rates (engagementRate, bounceRate, sessionKeyEventRate) are 0 to 1, durations seconds, revenue in the property’s currency; keyEvents are what GA4 used to call conversions; the item metrics count products and go with itemName.

dimensions

GA4’s dimension names to break the numbers down by: landingPage is a visit’s first page, pagePath any page viewed, sessionDefaultChannelGroup its channel (Organic Search, Paid Search, Direct…), deviceCategory desktop, mobile or tablet, date a day as 20261030.

Array<string>
default: <= 9 items
Allowed values: date isoYearIsoWeek yearMonth dayOfWeekName hour landingPage landingPagePlusQueryString pagePath pagePathPlusQueryString pageTitle hostName sessionDefaultChannelGroup sessionSource sessionMedium sessionSourceMedium sessionCampaignName firstUserDefaultChannelGroup deviceCategory operatingSystem browser country region city newVsReturning eventName itemName

GA4’s dimension names to break the numbers down by: landingPage is a visit’s first page, pagePath any page viewed, sessionDefaultChannelGroup its channel (Organic Search, Paid Search, Direct…), deviceCategory desktop, mobile or tablet, date a day as 20261030.

startDate

The first day: a date such as 2026-10-01, or today, yesterday or NdaysAgo, on the property’s clock.

string
default: 28daysAgo /^(\d{4}-\d{2}-\d{2}|today|yesterday|\d{1,4}daysAgo)$/

The first day: a date such as 2026-10-01, or today, yesterday or NdaysAgo, on the property’s clock.

endDate

The last day.

string
default: yesterday /^(\d{4}-\d{2}-\d{2}|today|yesterday|\d{1,4}daysAgo)$/

The last day.

compare

Compare with the same many days just before, or the same days 52 weeks earlier so weekdays line up.

string
Allowed values: previousPeriod previousYear

Compare with the same many days just before, or the same days 52 weeks earlier so weekdays line up.

compareStartDate

Or name the comparison’s first day…

string
/^(\d{4}-\d{2}-\d{2}|today|yesterday|\d{1,4}daysAgo)$/

Or name the comparison’s first day…

compareEndDate

…and its last.

string
/^(\d{4}-\d{2}-\d{2}|today|yesterday|\d{1,4}daysAgo)$/

…and its last.

filters

Only rows matching every one, ignoring case: “deviceCategory is mobile”, “landingPage contains /shop”, “sessionDefaultChannelGroup in Organic Search|Paid Search”. Any allowed dimension, in the report or not.

Array<string>
<= 5 items

Only rows matching every one, ignoring case: “deviceCategory is mobile”, “landingPage contains /shop”, “sessionDefaultChannelGroup in Organic Search|Paid Search”. Any allowed dimension, in the report or not.

orderBy

One of the report’s own metrics or dimensions. Left out, the first time dimension in order, or else the first metric, the biggest first.

string
Allowed values: sessions totalUsers newUsers activeUsers engagedSessions engagementRate bounceRate averageSessionDuration userEngagementDuration screenPageViews screenPageViewsPerSession eventCount keyEvents sessionKeyEventRate addToCarts checkouts ecommercePurchases purchaseRevenue totalRevenue averagePurchaseRevenue firstTimePurchasers itemsViewed itemsAddedToCart itemsPurchased itemRevenue date isoYearIsoWeek yearMonth dayOfWeekName hour landingPage landingPagePlusQueryString pagePath pagePathPlusQueryString pageTitle hostName sessionDefaultChannelGroup sessionSource sessionMedium sessionSourceMedium sessionCampaignName firstUserDefaultChannelGroup deviceCategory operatingSystem browser country region city newVsReturning eventName itemName

One of the report’s own metrics or dimensions. Left out, the first time dimension in order, or else the first metric, the biggest first.

order
string
Allowed values: desc asc
limit
integer
default: 100 >= 1 <= 500

Done

Media typeapplication/json
object
property
required
object
property
required
string
name
required
string
currency
required
string | null
timeZone
required

The property’s clock, which its days are on.

string
startDate
required
string
endDate
required
string
compare
required
Any of:
object
startDate
required
string
endDate
required
string
dimensions
required
Array<string>
metrics
required
Array<string>
rows
required
Array<object>
object
dimensions
required

Each dimension’s value, by its name.

object
key
additional properties
string
metrics
required

Each metric over the days, by its name.

object
key
additional properties
number
previous
required
Any of:
object
key
additional properties
number
totals
required

Each metric over every row, people counted once.

object
key
additional properties
number
previousTotals
required
Any of:
object
key
additional properties
number
more
required

Whether GA4 had more rows than the limit let through.

boolean
thresholded
required

Whether Google left rows out so nobody can be singled out.

boolean

Example generated

{
"property": {
"property": "example",
"name": "example",
"currency": "example",
"timeZone": "example"
},
"startDate": "example",
"endDate": "example",
"compare": {
"startDate": "example",
"endDate": "example"
},
"dimensions": [
"example"
],
"metrics": [
"example"
],
"rows": [
{
"dimensions": {
"additionalProperty": "example"
},
"metrics": {
"additionalProperty": 1
},
"previous": {
"additionalProperty": 1
}
}
],
"totals": {
"additionalProperty": 1
},
"previousTotals": {
"additionalProperty": 1
},
"more": true,
"thresholded": true
}

What was sent isn’t valid (invalid).

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

No key, or one that’s unknown, off or expired.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

The key doesn’t have the permission this needs.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

Nothing has that id (not_found).

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

Over the rate limit; see retry-after.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}