Skip to content

Commit

Permalink
docs: track needs try (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziodemaria authored May 29, 2024
1 parent 62d98a8 commit 0983035
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,15 @@ let messageValue = messageFlag.value
### Tracking events
The Confidence instance offers APIs to track events, which are uploaded to the Confidence backend:
```swift
confidence.track(eventName: "MyEvent", data: ["field": ConfidenceValue(string("value"))])
try confidence.track(eventName: "MyEvent", data: ["field": ConfidenceValue(string("value"))])
```

The SDK takes care of storing events in case of offline and retries in case of transient failures.

It's also possible to set context data to be appended to all tracked events:
Note that the data struct can't contain the key `context`, as that is reserved for entries set via `putContext` (see below):
violating this rule will cause the track function to throw an error.

To set context data to be appended to all tracked events:
```swift
confidence.putContext(context: ["os_version": ConfidenceValue(string: "17.0")])
```
Expand Down

0 comments on commit 0983035

Please sign in to comment.