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

Create a Clics project with the TypeScript SDK

Copy page

Create a project

Create a Clics project with the TypeScript SDK: set name, website domain, and localhost tracking options.

Creates a new project in your workspace. You need a project before you can install the tracker, define goals, or query stats.

After creation, use the returned id in your tracking snippet (data-project-id) and in subsequent SDK calls.

Parameters

Field Required Description
name Yes Display name for the dashboard
websiteUrl Yes Primary domain (e.g. example.com). Schemes, paths, and ports are stripped
allowLocalhost No Accept localhost/dev traffic. Default false

Signature

clics.projects.createProject(request, options?)

Example

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

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

const result = await clics.projects.createProject({
  name: "Acme Marketing",
  websiteUrl: "example.com",
  allowLocalhost: false,
});

console.log(result.id); // use in tracker snippet

What it returns

The newly created project. Keep id: it is required by every project-scoped SDK method and by the tracker snippet.

Field Type Description
id string Stable Clics project ID, for example proj_xxx
name string Dashboard display name
websiteUrl string Normalized primary website hostname
allowLocalhost boolean Whether localhost/development traffic is accepted
status "active" | "deleting" | "error" Current project lifecycle status
createdAt number Creation timestamp

Notes

  • Set allowLocalhost: true when you want to test against localhost before going live
  • One workspace can hold multiple projects (e.g. marketing site + docs site)

API reference

See Create a project for request and response schemas, status codes, and error types.

Was this page helpful?