-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: fix incorrect syntax in cloud quick start
- Loading branch information
1 parent
674171a
commit 98d06bf
Showing
1 changed file
with
11 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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> | ||
|
||
|