Skip to main content

Overview

Turret’s event tracking captures user interactions along with free-form text metadata. The API analyzes this metadata to automatically group similar events into semantic clusters and track how users flow through different topics within conversations.

Request Body

Every event sent to Turret has the following structure:

Field Reference

Response

Every successful request returns the IDs used for the event:
Store these IDs and include them in subsequent requests to maintain session continuity. This is how Turret connects multiple messages into a conversation journey.

Authentication

All requests must include your API key in the X-API-Key header:
Never expose your API key in client-side code. Always make requests from your backend services.

Code Examples

Minimal Integration

The simplest integration - just send the message, Turret handles the rest:
Store the returned IDs and include them in subsequent messages:

Using Your Own IDs

If you already have conversation/user IDs, pass them directly:

cURL

JavaScript

Using fetch in Node.js:

Python

Using the requests library:

Multiple Metadata Keys

You can include additional context in your metadata:

Automatic Field Type Detection

Turret automatically analyzes your metadata fields and classifies them:
Field types are detected automatically when you first send events with new metadata keys. You can override these classifications in Settings → Metadata if needed. See Segmentation for more details.

Event Naming Best Practices

Choose descriptive, consistent names for your events:

Good Names

  • “user_prompt”
  • “search_query”
  • “chat_message”
  • “feedback_submitted”

Avoid

  • “Event1”, “Event2”
  • “user_action”
  • “something_happened”
  • Names that are too generic

How Clustering Works

When you send an event:
  1. Embedding Generation: Turret generates a vector embedding for the metadata value (e.g., the prompt text) using an embedding model.
  2. Semantic Clustering: Events are grouped into clusters based on embedding similarity. Similar prompts end up in the same cluster, even if they use different words:
    • “How do I reset my password?” and “I forgot my login credentials” → Same cluster
  3. Cluster Labeling: Clusters are automatically labeled with human-readable descriptions using an LLM (e.g., “Password Reset Requests”).

How Journey Tracking Works

When events share the same session_id, Turret tracks transitions between clusters:
  1. User asks about pricing (Cluster A)
  2. User asks about features (Cluster B)
  3. User asks about pricing again (Cluster A)
This creates a journey: A → B → A Turret provides insights like:
  • Starting topics: What do users ask about first?
  • Common follow-ups: After topic X, users often ask about Y
  • Back-and-forth patterns: Users bounce between topics A and B

Rate Limits

Turret has generous rate limits to accommodate high-volume applications:
  • Free trial: 250k total events (within 14 days)
  • Pro plan: 1,000,000 events per month
  • Business plan: 10,000,000 events per month
  • Enterprise: Custom limits
If you exceed your rate limit, you’ll receive a 429 Too Many Requests response.

Error Handling

Handle potential errors gracefully:

Common Use Cases

LLM Chatbot

Track each message a user sends to your AI chatbot:

Search Applications

Track search queries to understand what users are looking for:

Support Tickets

Track support conversations - use ticket ID as session_id: