Selected text events allow you to track when a user selects text generated by your LLM application, indicating the response was useful enough to be copied and used elsewhere.
REST API Specification
Endpoint
POST /api/track_event
X-Auth-Token: Your LangWatch API key.
Request Body
Example
The text_length metric is mandatory and should reflect the length of the selected text. The selected_text field in event_details is optional if you also want to capture the actual text that was selected by the user. Last modified on March 25, 2026