Get Started
Sending events
You can send user events to Trench via the REST API or using the Javascript SDK.
REST API
curl \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_API_KEY' \
'YOUR_TRENCH_URL/api/event' \
-d '
{
"type": "payment",
"data": {
"card": {
"fingerprint": "f2xvb823k",
"brand": "visa",
"country": "US",
"last4": "4242",
},
"user": {
"id": "45912",
"name": "John Doe",
"email": "john@email.com"
},
...
}
SDK
Install: npm install @trytrench/sdk
trench.initialize(
"https://your-trench-url.com",
"SESSION_ID",
"CLIENT_API_KEY"
);
trench.pageview();