You should implement this each time you create a feature within Kana to ensure
your user’s usage of a feature is accurately recorded.
Prerequisites
You will need to ensure you have details on both:- The user who has used the feature
- The feature which the user has used
id
of both.
Both theid
for a User and a Feature are defined by you upon creation in Kana.
You can find the identifiers for both in the Dashboard, or by using the features and users queries to pull all respective records and grab the id
from the one you need.
Code Sample
Basic
Node.js
Example
Node.js
This should always take place after the feature has been successfully
used. Make the call when there is no possibility of error and the action
related to the feature has taken place. This will avoid any accidental
recording of usage when nothing has yet happened. You can always provide a
negative
delta
in a subsequent call to revert this if needed (more in
recordUsage).Next Steps
Congratulations 🎉 You’ve now successfully tracked your user’s usage of a
feature.
messages
feature, your users may be able to send messages via your UI and through an API call - both should be tracked.
As we now have details on how much of a feature a user has used, you can:
- Fetch insights on a user’s current feature usage from our API
- Block usage based on if a user has no more remaining allowance
- Subscribe a user to a new package based on their feature usage