Skip to content

Commit

Permalink
docs: fix incorrect syntax in cloud quick start
Browse files Browse the repository at this point in the history
  • Loading branch information
christianmat committed Dec 6, 2024
1 parent 674171a commit 98d06bf
Showing 1 changed file with 11 additions and 22 deletions.
33 changes: 11 additions & 22 deletions apps/docs/cloud-quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,40 +44,29 @@ The example uses the [Trench JavaScript client](https://github.com/trench-dev/tr
serverUrl: 'YOUR_SERVER_URL'
});
```
Optionally, you can identify a user with the `identify` method:

```javascript
trench.identify('user-id', {
email: '[email protected]',
// Add any other traits you want to associate with the user
})
```

</Step>

<Step title="Send a Sample Event">
Now you can send a sample event to Trench Cloud. Here is an example of how to send an event:

```javascript
trench.track({
userId: '550e8400-e29b-41d4-a716-446655440000',
event: 'ConnectedAccount',
properties: {
totalAccounts: 4,
country: 'Denmark'
}
}).then(response => {
console.log('Event sent successfully:', response);
}).catch(error => {
console.error('Error sending event:', error);
});
trench.track("Test Event");
```

This will send an event with the name `Test Event`.
</Step>

<Step title="Verify the Event">
You can verify that the event was received by querying the events endpoint. Use your private API key for this:

```bash
curl -i -X GET \
-H "Authorization: Bearer private-YOUR_PRIVATE_API_KEY" \
'YOUR_SERVER_URL/events?event=ConnectedAccount'
```

This will return a JSON response with the event that was just sent. Alternatively, you can verify the event was received in the `Events` tab of the Trench Cloud dashboard.

You can verify that the event was received by opening the `Events` tab in the Trench Cloud dashboard.
</Step>
</Steps>

Expand Down

0 comments on commit 98d06bf

Please sign in to comment.