Team
Launch LogCancel Flows
Quick Start GuideFurther ConfigurationCustom StylingMulti-Language SupportEmail-Verified Cancel FlowA/B TestingCancel Flow TestingPause WallFailed Payment Recovery
Payment RecoveryCampaign CustomizationFailed Payment WallReactivations
ReactivationsCampaign Customization GuideCustomer Health
Customer HealthData Integrations
Data APIWebhooksEvent TrackingBilling Providers
Payment Provider OverviewSlackStripeChargebeePaddle ClassicPaddle BillingBraintreeZuoraSupport
FAQsEvent Tracking
Event tracking products are difficult to test in the field and are filled with feature bloat. Our new event tracking tool lets you easily capture your products key-value metrics on a per customer basis. We’ll stitch together your event data with your customer subscription data for you, to give you a comprehensive view of your customers.
Customer Events
Events are created through a simple HTTP request.
Server Side
For sending server side events, include your Churnkey API key as a header, as shown below. Get your API key and App ID from Churnkey | Account.
const headers = {
"x-ck-api-key": "YOUR_CHURNKEY_API_KEY",
"x-ck-app": "YOUR_CHURNKEY_APP_ID",
}
const eventBody = {
"event": "Post Created",
"customerId": "cus_abc", // from billing provider e.g. Stripe
////////////////////////
// OPTIONAL ITEMS BELOW
////////////////////////
"uid": "user_xyz", // unique id of the customer e.g. your database id
"eventDate": '2022-05-01', // use for backfilling data, default is now
"eventData": {
"postType": "image"
},
////////////////////////
// FOR B2B PRODUCTS
////////////////////////
"user": {
"uid": "user_unique_id", // e.g. your database id for the user
}
}
axios.post("https://api.churnkey.co/v1/api/events/new", eventBody, headers)
A Quick Note on Naming Convention
To keep event naming consistent across your application, we recommend using an object-action convention, capitalized and with a regular space.
- “Product Clicked”
- “Application Opened”
- “Account Created”
- “User Registered”
Server Side Bulk Create
Ideal for backfilling data for training Churnkey customer health models. You can create up to 100 events in one API request using our bulk event endpoint. Please note that, unlike with single event creation, you cannot include customer and user data updates with the bulk event endpoint.
const headers = {
'x-ck-api-key': 'YOUR_CHURNKEY_API_KEY',
'x-ck-app': 'YOUR_CHURNKEY_APP_ID',
};
const events = [
{
// ...events as defined above, including event, eventDate, and customerId or uid
}
];
axios.post('https://api.churnkey.co/v1/api/events/bulk', events, headers);
Client Side
Customer Attributes
In addition to events, you can update customer data. This can be done by including a customerData
property in the create (single) event endpoint, or by sending an explicit request to events/customer-update
.
You must include at least one of uid
or customerId
. For B2B products, you can also pass in a user
property as shown below to update user data records.
const headers = {
'x-ck-api-key': 'YOUR_CHURNKEY_API_KEY',
'x-ck-app': 'YOUR_CHURNKEY_APP_ID',
};
const dataUpdate = {
uid: 'unique_id', // unique id of the customer e.g. your database id
customerId: 'cus_xyz', // from billing provider e.g. Stripe
customerData: {
numSeats: 7,
name: 'Acme, Inc.',
},
////////////////////////
// FOR B2B PRODUCTS
////////////////////////
user: {
uid: 'user_unique_id', // e.g. your database id for the user
data: {
name: 'John Henry',
email: '[email protected]',
},
},
};
axios.post('https://api.churnkey.co/v1/api/events/customer-update', dataUpdate, headers);