Saasco logoSaasco logo
Saasco logoSaasco logo

Introduction

Quick StartWhat is Saasco?

Analytics

postQuery Sessions

CRM

Email Marketing

Knowledge

Support

Projects

Sessions

Query Sessions

The session-level counterpart to Query Events, grouping visits rather than individual events. Adds session-only metrics (pageViews, bounceRate, avgSessionSec) that cannot be derived from the event stream. Use this for traffic and engagement reporting, and Query Events for anything keyed on a specific action.

POST
/projects/{projectId}/analytics/query-sessions

Authorization

Authorization
AuthorizationBearer <token>

In: header

Path Parameters

projectIdrequiredstring

ID of the project to query.

Request Body

application/json

groupByrequiredstring

Dimension to aggregate by. One row comes back per distinct value. Use date or hour for a time series.

Value in: "projectId" | "date" | "hour" | "pathname" | "referringDomain" | "device" | "browser" | "location" | "utmSource" | "utmMedium" | "utmCampaign" | "utmTerm" | "utmContent" | "utmAdId"
subGroupBystring

Optional second dimension, giving one row per groupBy × subGroupBy pair.

Value in: "projectId" | "date" | "hour" | "pathname" | "referringDomain" | "device" | "browser" | "location" | "utmSource" | "utmMedium" | "utmCampaign" | "utmTerm" | "utmContent" | "utmAdId"
metricsrequiredarray<string>

Metrics to compute for each row. At least one is required.

dateFromstring

Start of the window as a YYYY-MM-DD date, inclusive. Interpreted in the project's configured timezone.

dateTostring

End of the window as a YYYY-MM-DD date, inclusive. Interpreted in the project's configured timezone.

locationstring

Only include sessions from this country name.

devicestring

Only include sessions from this device type, e.g. mobile.

browserstring

Only include sessions from this browser, e.g. Chrome.

referringDomainstring

Only include sessions from this referring domain.

utmSourcestring

Only include sessions tagged with this utm_source.

utmMediumstring

Only include sessions tagged with this utm_medium.

utmCampaignstring

Only include sessions tagged with this utm_campaign.

utmTermstring

Only include sessions tagged with this utm_term.

utmContentstring

Only include sessions tagged with this utm_content.

utmAdIdstring

Only include sessions attributed to this ad ID.

orderBystring

Column to sort by: either groupBy or one of the requested metrics.

orderDirstring

Sort direction. Ignored unless orderBy is set.

Value in: "ASC" | "DESC"
skipinteger

Number of rows to skip before collecting results.

limitinteger

Maximum number of rows to return.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://www.saasco.com/api/v2/projects/string/analytics/query-sessions" \  -H "Content-Type: application/json" \  -d '{    "groupBy": "projectId",    "metrics": [      "users"    ]  }'
{
  "meta": [
    {
      "name": "string",
      "type": "string"
    }
  ],
  "rows": 0,
  "statistics": {
    "bytes_read": 0,
    "elapsed": 0,
    "rows_read": 0
  },
  "usage": {
    "cost": 0,
    "duration": 0,
    "metricCount": 0
  },
  "data": [
    {
      "avgSessionSec": 0,
      "bounceRate": 0,
      "events": 0,
      "groupBy": "string",
      "pageViews": 0,
      "sessions": 0,
      "subGroupBy": "string",
      "users": 0
    }
  ]
}
{
  "code": "BAD_REQUEST",
  "message": "Invalid input data",
  "issues": []
}
{
  "code": "UNAUTHORIZED",
  "message": "Authorization not provided",
  "issues": []
}
{
  "code": "FORBIDDEN",
  "message": "Insufficient access",
  "issues": []
}
{
  "code": "INTERNAL_SERVER_ERROR",
  "message": "Internal server error",
  "issues": []
}

User Events

Returns one user's event history, newest first: the activity timeline for a single person. Events fired before they were identified are stitched in by anonymous ID, so the timeline reaches back past the `identify()` call. Social-proof popup events are excluded. Page through it with `cursor`, which is a row offset: pass the number of rows already received to get the next batch.

Get Funnel Steps

Runs a sequential funnel over the named events and returns the number of users reaching each step. Order is significant: a user counts at step N only if they fired steps 1 through N in the given order within the window. Users are counted by anonymous ID, so the same person on two devices counts twice.