Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ request and response fields, and offers both synchronous and asynchronous client

## Installation and Setup

1. Add this dependency to your project's build file:
1. Add `schematichq` to your project's build file:

```bash
pip install schematichq
Expand Down Expand Up @@ -106,6 +106,17 @@ client.track(

This call is non-blocking and there is no response to check.

If you want to record large numbers of the same event at once, or perhaps measure usage in terms of a unit like tokens or memory, you can optionally specify a quantity for your event:

```python
client.track(
event="some-action",
user={"user_id": "your-user-id"},
company={"id": "your-company-id"},
quantity=10,
)
```

### Creating and updating companies

Although it is faster to create companies and users via identify events, if you need to handle a response, you can use the companies API to upsert companies. Because you use your own identifiers to identify companies, rather than a Schematic company ID, creating and updating companies are both done via the same upsert operation:
Expand Down
2 changes: 2 additions & 0 deletions src/schematic/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,14 @@ def track(
company: Optional[Dict[str, str]] = None,
user: Optional[Dict[str, str]] = None,
traits: Optional[Dict[str, Any]] = None,
quantity: Optional[int] = None,
) -> None:
self._enqueue_event(
"track",
EventBodyTrack(
company=company,
event=event,
quantity=quantity,
traits=traits,
user=user,
),
Expand Down
Loading