Skip to content
Clics privacy-friendly cookieless web analytics documentation
Esc
navigateopen⌘Jpreview
On this page

List available Clics session filter values with the TypeScript SDK

Copy page

List session filter values

Discover the available country, device, browser, page, and referrer values before filtering Clics sessions with the TypeScript SDK.

Use clics.sessions.listSessionFilterValues to populate a Sessions filter picker, or to discover values before calling listSessions. It returns values that exist in the current analytics scope, together with their session and pageview counts.

What you need

Field Required Description
projectId Yes Project to inspect
field Yes One of country, device, browser, os, page_entry, page_exit, or referrer
dateRange No One of the nine presets; defaults to last7days
start and end No Custom yyyy-MM-dd or ISO8601 range; always pass both together
domain No One hostname, or localhost for development traffic
timezone No IANA timezone; defaults to UTC
limit No Maximum values to return; defaults to 200

You can also constrain the scope with the same session filters as listSessions: country, device, browser, os, pageEntry, pageExit, or referrer, each with an optional ...Op of is or is_not.

The field being requested is deliberately excluded from its own filter. For example, request field: "browser" with country: "US" to build a browser picker for US sessions. The requested field uses API-style values such as page_entry; the optional filtering properties remain SDK-style camelCase, such as pageEntry and pageEntryOp.

Example

const browsers = await clics.sessions.listSessionFilterValues({
  projectId: "proj_xxx",
  field: "browser",
  dateRange: "last30days",
  timezone: "Europe/Paris",
  country: "US,FR",
  countryOp: "is",
  limit: 20,
});

for (const browser of browsers.values) {
  console.log(browser.label, browser.sessions, browser.pageviews);
}

timezone makes period presets and date-only ranges follow that local calendar. Use the same timezone in listSessions so the picker and the results use the same scope.

What it returns

{
  values: Array<{
    value: string;    // value to send back to listSessions
    label: string;    // display label for a UI
    sessions: number; // matching sessions
    pageviews: number;
  }>;
  meta: { timezone: string };
}
Field Type Description
values[].value string Exact SDK filter value to send back to listSessions
values[].label string Human-readable value for a picker or report
values[].sessions number Matching session count in the current scope
values[].pageviews number Matching pageview count in the current scope
meta.timezone string IANA timezone applied to the period

Use "direct" as the referrer value for direct traffic. For a custom range, pass both start and end; they take precedence over dateRange.

Next step

Pass the selected value to listSessions, for example { browser: "Chrome", browserOp: "is" }.

Was this page helpful?