Kana can track when users use your features based on incoming track events from Segment. This will reduce the complexity of you having to integrate with Kana directly (in particular removing the need for the recordUsage operation) and provide you with actionable day-zero insights into your customers feature usage against your pricing and packaging.

Sending track events to Kana

You can send in track events from any source in Segment. Different sources will require differently formatted payloads. You can see a full list of sources here.

Here’s an example using the Segment client-side Javascript library (Analytics JS):

analytics.track("Message Sent", {
  featureId: "messages",
  delta: 1,
});

Kana will parse all properties in Track events for mapping rules. However, Kana considers the following properties to be special:

FieldRequired?Description
properties.featureIdOptionalUsed to map events to features directly. Should correspond to the id of a feature in Kana. Defaults to the any mapping rules if not present.
properties.deltaOptionalUsed to record how much of a feature someone has used. Defaults to 1.

Are anonymous events supported?

No - events sent in without a userId (aka. anonymous events) will be dropped and responded to with a 400 Bad Request error.

What if certain track events don’t map to usage of a feature?

All events will be sent from your source to Kana and stored there - no matter whether these will be used to record feature usage or not. Events which could not map to features are exposed within Kana (see more in mapping rules). Any rules created afterwards will retroactively apply to these events, meaning events will reprocess against these new rules in an attempt to map them to features. If there are events you do not want to send to Kana (as they will never be used to record feature usage) then it’s recommended that you filter these events from sending.

How are events mapped to features?

There are two ways to map Segment events to Kana features:

  • Providing a properties.featureId field within a Segment event

  • Setting rules to map events to features within the Kana dashboard

Mapping Rules

Setting rules to map events to feature usage is a no-code solution whereby you won’t have to edit existing Segment events to include additional properties and therefore don’t need to muddy the data sent to other Segment destinations.

Kana will look at incoming events and process them alongside the rules you have defined to attribute them to features. If they match, feature usage with a delta of 1 will be recorded.

These rules can be created on the Segment Integration page within the Kana dashboard. They can be set based on the name and properties of a track event with multiple AND conditions if required.

Create new mapping rules

How do I reprocess events which didn’t previously match any features?

Any rules created after events have been sent in will retroactively apply to all events which did not match beforehand, meaning they will be reprocessed against these new rules in an attempt to map them to features. Feature usage will then be recorded if they match and the event will not be reprocessed again.