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

Update a conversion funnel with the Clics TypeScript SDK

Copy page

Update a funnel

Update a conversion funnel with the Clics TypeScript SDK when your user journey or step filters change.

Updates an existing funnel. This is a partial update: omit fields you want to preserve.

Use it to rename a funnel, adjust its conversion window, or replace its ordered steps. A funnel stays in its original environment; envId cannot be changed after creation.

Parameters

Field Required Description
funnelId Yes Funnel to update
body.name No Updated display name
body.conversionWindow No New { value, unit } window
body.steps No Complete replacement steps array (minimum 2 steps)

If you include steps, it replaces the whole ordered list. Each replacement step must include its full name and filters. See Create a funnel for valid filters and units.

Signature

clics.funnels.updateFunnel(request, options?)

Example

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

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

const result = await clics.funnels.updateFunnel({
  funnelId: "funnel_xxx",
  body: {
    name: "Checkout — web",
  },
});

Replace the conversion window and the whole step sequence:

await clics.funnels.updateFunnel({
  funnelId: "funnel_xxx",
  body: {
    conversionWindow: { value: 3, unit: "days" },
    steps: [
      { name: "Cart", filters: [{ filterType: "page", operator: "is", values: ["/cart"] }] },
      { name: "Paid", filters: [{ filterType: "event", operator: "is", values: ["purchase"] }] },
    ],
  },
});

What it returns

The complete funnel after the update, including every existing field that was omitted from the request.

Field Type Description
id string Stable funnel ID
projectId string Parent project ID
envId "production" | "development" Original funnel environment; it cannot change here
name string Current Dashboard label
conversionWindow { value, unit } Current completion window
steps Array<{ name, filters }> Complete current ordered step list
createdAt number Original creation timestamp; it does not change on update

Notes

  • Omitted fields are preserved.
  • A practical pattern before a large change is getFunnel → modify locally → updateFunnel.
  • Historical raw events remain intact; future funnel calculation uses the updated definition.

API reference

See Update a funnel for request and response schemas, status codes, and error types.

Was this page helpful?