Esc
Tracklytic
AnleitungenAPI-ReferenzSDKsChangelogTracklytic öffnen

Nutzerprofil aktualisieren

View as MarkdownThe page as plain text

Ein Profil anhand von Projekt und Nutzer-ID erstellen oder aktualisieren.

POST/v1/identify

Authentifizierung: API-Token.

Body

Feld Typ Erforderlich Bedeutung
project string Ja Projekt-Slug.
userId string Ja Stabile Nutzer-ID im Projekt.
properties object Ja Eigene Profileigenschaften.
avatar string oder null Nein Öffentliche HTTPS-URL, Base64-Bild oder null zum Entfernen.

PNG, JPEG und WebP bis 2 MiB werden unterstützt. HTTPS-URLs müssen öffentlich erreichbar sein, Port 443 verwenden und dürfen keine Zugangsdaten enthalten. Avatar weglassen, um ihn unverändert zu lassen.

Antwort

HTTP 201 mit {}, sowohl bei Erstellung als auch Aktualisierung. Verwende denselben userId in Events. Profile sind keine Tracklytic-Benutzerkonten.

Request

curl -X POST 'https://api.tracklytic.de/v1/identify' \
  -H "Authorization: Bearer $TRACKLYTIC_API_TOKEN" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "project": "my-project",
  "userId": "customer_123",
  "properties": {
    "name": "Elena Rossi",
    "plan": "pro"
  }
}'
const response = await fetch("https://api.tracklytic.de/v1/identify", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.TRACKLYTIC_API_TOKEN}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify(
    {
      "project": "my-project",
      "userId": "customer_123",
      "properties": {
        "name": "Elena Rossi",
        "plan": "pro"
      }
    }
  )
});

if (!response.ok) throw new Error(await response.text());
const result = await response.json();
import json
import os
from urllib.request import Request, urlopen

payload = {
  "project": "my-project",
  "userId": "customer_123",
  "properties": {
    "name": "Elena Rossi",
    "plan": "pro"
  }
}

request = Request(
    "https://api.tracklytic.de/v1/identify",
    method="POST",
    headers={
        "Authorization": "Bearer " + os.environ["TRACKLYTIC_API_TOKEN"],
        "Content-Type": "application/json"
    },
    data=json.dumps(payload).encode("utf-8")
)

with urlopen(request) as response:
    result = json.load(response)

Response

201
{}