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

List conversion goals with the Clics TypeScript SDK

Copy page

List goals

List conversion goals for a Clics project with the TypeScript SDK, scoped to production or development.

Returns all conversion goals for a project. Use this to audit existing goals, sync configuration from CI, or find goal IDs before updating.

Parameters

Field Required Description
projectId Yes Project to list goals for
envId No production (default) or development

Signature

clics.goals.listGoals(request, options?)

Example

import { Clics } from "@clicsdev/sdk";

const clics = new Clics({
  apiKey: process.env.CLICS_API_KEY!,
});

const result = await clics.goals.listGoals({
  projectId: "proj_xxx",
});

for (const goal of result.goals) {
  console.log(goal.displayName, goal.goalType);
}

List development goals:

const devGoals = await clics.goals.listGoals({
  projectId: "proj_xxx",
  envId: "development",
});

What it returns

A goals array. Every item contains:

Field Description
id Stable goal ID
projectId Parent project ID
envId production or development
displayName Label shown in Dashboard
goalType page, event, outbound, or scroll_depth
rule { pagePath }, { eventName }, { outboundUrl }, or { pagePath, scrollDepthThreshold }, depending on goalType

API reference

See List goals for request and response schemas, status codes, and error types.

Was this page helpful?