Skip to main content

analytics

Returns aggregate metrics and ranked dimensions for a site or imported Google Analytics property. Use analyticsDimension for one dimension or analyticsOverTime for its series. Supply a preset or window within available history; ranking defaults to descending page views for pages and visitors otherwise, with per-dimension cursors. Missing metrics resolve to null. Requires web analytics view access.

analytics(
sourceId: Int!
sourceType: AnalyticsSource!
searchTerm: String
startAt: Int
endAt: Int
presetDate: String
orderBy: OrderColumn
orderDir: OrderDir
cursor: AnalyticsCursorArg
numSegments: Int
granularity: TimeUnit
): Analytics

Arguments​

analytics.sourceId ● Int! non-null scalar​

Site ID from sites for SITE, or property ID from gaProperties for GA_PROPERTY.

analytics.sourceType ● AnalyticsSource! non-null enum​

SITE selects Crazy Egg data; GA_PROPERTY selects imported Google Analytics data.

analytics.searchTerm ● String scalar​

Optional case-insensitive substring filter on every dimension's raw values (page domain plus path, referrer domain, country or language code); aggregate totals ignore it.

analytics.startAt ● Int scalar​

Unix seconds for the window start. Supply with endAt when no preset is given; site dates use UTC and GA dates use the property's time zone.

analytics.endAt ● Int scalar​

Unix seconds. SITE aggregates exclude this instant; dimension rows include its UTC date. GA includes this local date. Supply with startAt unless presetDate is used.

analytics.presetDate ● String scalar​

Case-insensitive preset that overrides startAt/endAt: today, yesterday, recent (today plus six prior days), last 7 days, last 30 days (both end yesterday), this month, or last month; others error.

analytics.orderBy ● OrderColumn enum​

Defaults to PAGE_VIEWS for pages and VISITORS otherwise. Pages accept NAME, PAGE_VIEWS, or AVG_TIME_ON_PAGE; other columns fall back to PAGE_VIEWS.

analytics.orderDir ● OrderDir enum​

Ranking direction, default DESC. Metric ties use ascending names, with domain and path ordering for pages.

analytics.cursor ● AnalyticsCursorArg input​

Per-dimension boundaries from analytics.nextCursor; omit for the first request.

analytics.numSegments ● Int scalar​

Top time-series count, default 5, with remaining values grouped as others. Used by analyticsOverTime; ranked-row queries do not use it.

analytics.granularity ● TimeUnit enum​

Bucket size, default DAY. Site dates use UTC; GA dates use the property's time zone.

Type​

Analytics object​

Metrics and dimension payload returned by analytics and analyticsOverTime. Fields absent from the returned payload resolve to null.