Skip to main content

customerInsights

Requires permission analytics:sales:read.

Analytics for one customer over a date range, for the Insights tab of the customer record. A customer outside your book is refused with the same not-found a missing one gets. Needs the sales analytics read permission.

Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.

Example:

query CustomerInsights($partnerId: ID!, $range: AnalyticsRangeInput!) {
customerInsights(partnerId: $partnerId, range: $range) {
partnerId
cadence {
daysSinceLastOrder
enough
expectedNextOrderAt
historyOrderCount
longestGapDays
medianGapDays
}
}
}

Variables:

{
"partnerId": "id",
"range": {
"from": "2025-01-15T00:00:00Z",
"to": "2025-01-15T00:00:00Z"
}
}

Response:

{
"data": {
"customerInsights": {
"partnerId": "id",
"cadence": {
"daysSinceLastOrder": 0,
"enough": true,
"expectedNextOrderAt": "2025-01-15T00:00:00Z",
"historyOrderCount": 0,
"longestGapDays": 0,
"medianGapDays": 0
}
}
}
}
customerInsights(
partnerId: ID!
range: AnalyticsRangeInput!
): CustomerInsights!

Arguments​

customerInsights.partnerId ● ID! non-null scalar​

The ID of the customer.

customerInsights.range ● AnalyticsRangeInput! non-null input​

The date range and, optionally, the visibility scope.

Type​

CustomerInsights object​

The customer's analytics, behind the Insights tab of the partner record.