Saasco logoSaasco logo
Saasco logoSaasco logo

Introduction

Quick StartWhat is Saasco?

Analytics

postQuery EventsgetLatest EventsgetUser Events

CRM

Email Marketing

Knowledge

Support

Projects

Events

Query Events

The general-purpose event reporting query. Pick a dimension to group by, the metrics to compute (users, sessions, events), and any filters, and it returns one aggregated row per group: a time series with groupBy: "date", a top-pages table with groupBy: "pathname", and so on. Dates are read in the project's configured timezone.

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

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" | "action" | "href" | "pathname" | "referrer" | "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" | "action" | "href" | "pathname" | "referrer" | "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 events from this country name.

devicestring

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

browserstring

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

referrerstring

Only include events with this exact referrer URL.

referringDomainstring

Only include events from this referring domain.

actionstring

Only include events with this action name, e.g. Page View.

utmSourcestring

Only include events tagged with this utm_source.

utmMediumstring

Only include events tagged with this utm_medium.

utmCampaignstring

Only include events tagged with this utm_campaign.

utmTermstring

Only include events tagged with this utm_term.

utmContentstring

Only include events tagged with this utm_content.

utmAdIdstring

Only include events attributed to this ad ID.

pathnamestring

Only include events on this path, e.g. /pricing.

hrefstring

Only include events on this full URL.

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-events" \  -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
  },
  "data": [
    {
      "events": 0,
      "groupBy": "string",
      "sessions": 0,
      "subGroupBy": "string",
      "users": 0
    }
  ],
  "rows_before_limit_at_least": 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": []
}

Delete User

Erases a user's stored identify properties for GDPR-style deletion requests. Scope is narrow and worth noting: it clears the identify record only. Tracked events stay, and the CRM contact is untouched (use Delete Contact for that). The delete runs as an asynchronous job, so the user can still surface in queries for a short window after this returns 200.

Latest Events

Returns the project's most recent events, newest first: the live activity feed. Each row carries the action, timestamp, page, referrer, and the visitor's device, browser, and country. Social-proof popup events are hidden unless you ask for them by `action`.