# Quickstart

Send your first event to Cohorly in a few minutes - grab your project token, fire one HTTP request, then instrument your app with an SDK.

## 1. Get your project token

Log in to the [Cohorly dashboard](https://cohorly.velloalabs.com/) and open
**Settings**. Every app you track is a **project**, and each project has a
UUID **token** that authenticates ingestion. Copy the token of the project
you want to send events to - or create a new project first.

The project token only allows *writing* events. It is safe to ship in
client-side code, like a Mixpanel token.

## 2. Send your first event

Every ingestion request is authed by the project token. Send it in the
`X-Cohorly-Token` header:

```bash
curl -X POST https://cohorly-service.velloalabs.com/track \
  -H "Content-Type: application/json" \
  -H "X-Cohorly-Token: YOUR_PROJECT_TOKEN" \
  -d '{
    "event": "Signed Up",
    "properties": { "distinct_id": "user_123", "plan": "pro" }
  }'
```

```ts
await fetch("https://cohorly-service.velloalabs.com/track", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "X-Cohorly-Token": "YOUR_PROJECT_TOKEN",
  },
  body: JSON.stringify({
    event: "Signed Up",
    properties: { distinct_id: "user_123", plan: "pro" },
  }),
});
```

```python
import requests

requests.post(
    "https://cohorly-service.velloalabs.com/track",
    headers={"X-Cohorly-Token": "YOUR_PROJECT_TOKEN"},
    json={
        "event": "Signed Up",
        "properties": {"distinct_id": "user_123", "plan": "pro"},
    },
)
```

```go
package main

import (
	"bytes"
	"encoding/json"
	"net/http"
)

func main() {
	body, _ := json.Marshal(map[string]any{
		"event": "Signed Up",
		"properties": map[string]any{
			"distinct_id": "user_123",
			"plan":        "pro",
		},
	})

	req, _ := http.NewRequest(
		"POST",
		"https://cohorly-service.velloalabs.com/track",
		bytes.NewReader(body),
	)
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("X-Cohorly-Token", "YOUR_PROJECT_TOKEN")

	http.DefaultClient.Do(req)
}
```

A successful call returns:

```json
{ "status": 1, "inserted": 1 }
```

Refresh the dashboard and the `Signed Up` event will appear in your project.

## 3. Instrument your app

For real apps, use an SDK - it handles batching, retries, anonymous ids, and
identity merging for you:

```bash
# SDKs wrap this same call - useful if you'd rather not add a dependency
curl -X POST https://cohorly-service.velloalabs.com/track \
  -H "Content-Type: application/json" \
  -H "X-Cohorly-Token: YOUR_PROJECT_TOKEN" \
  -d '{
    "event": "Signed Up",
    "properties": { "distinct_id": "user_123", "plan": "pro" }
  }'
```

```ts
// npm install @cohorly/web
import { init, track } from "@cohorly/web";

init({ token: "YOUR_PROJECT_TOKEN" });

track("Signed Up", { plan: "pro" });
```

```swift
// Swift Package: https://github.com/Gitarcitano/cohorly-swift
import Cohorly

let cohorly = Cohorly.initialize(token: "YOUR_PROJECT_TOKEN")

cohorly.track("Signed Up", properties: ["plan": "pro"])
```

```kotlin
// implementation("com.github.cohorly-io.cohorly-android:cohorly-android:v0.1.0")
import com.cohorly.android.Cohorly

val cohorly = Cohorly.getInstance(context, "YOUR_PROJECT_TOKEN")

cohorly.track("Signed Up", mapOf("plan" to "pro"))
```

```python
# pip install cohorly
from cohorly import Cohorly

ch = Cohorly("YOUR_PROJECT_TOKEN", api_host="https://cohorly-service.velloalabs.com")
ch.track("user_123", "Signed Up", {"plan": "pro"})
```

```go
// go get github.com/cohorly-io/cohorly-go
package main

import (
	"context"

	cohorly "github.com/cohorly-io/cohorly-go"
)

func main() {
	client := cohorly.NewClient("YOUR_PROJECT_TOKEN")
	ctx := context.Background()
	client.Track(ctx, []*cohorly.Event{
		client.NewEvent("Signed Up", "user_123", map[string]any{"plan": "pro"}),
	})
}
```

See the SDK guides. Client SDKs cover [Web](/sdks/web),
[React](/sdks/react), [Next.js](/sdks/nextjs),
[React Native](/sdks/react-native), [iOS](/sdks/ios), and
[Android](/sdks/android). Server SDKs cover [Node.js](/sdks/node),
[NestJS](/sdks/nest), [Python](/sdks/python), [PHP](/sdks/php), and
[Go](/sdks/go).

## 4. Identify your users

SDKs start each visitor with an anonymous `distinct_id`. When the user logs
in, call `identify()` with your real user id so pre-login and post-login
activity merge into one profile:

```ts
await cohorly.identify("user_123");
cohorly.people.set({ plan: "pro", name: "Ada" });
```

From here, explore [the HTTP API](/api/ingestion) if you need to send events
from a backend, or the [Query API](/api/queries) to pull segmentation,
funnel, and retention results into your own tools.
