0.2.4 • Published 1 year ago

@ntitle-ai/sdk v0.2.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Feature Tracking State Model

1. High-Level States (Feature Lifecycle)

A feature flow typically involves the following core states:

Context FieldDescriptionExample Values
feature_nameThe feature being tracked"subscription_modal"
trigger_sourceWhat initiated the feature?"navigation_menu", "promo_banner"
modal_idIdentifier for modals (if applicable)"upgrade_options"
selected_optionIf an option was chosen, which one?"premium_plan", "basic_plan"
error_codeIf an error occurs, what was it?"500_INTERNAL_SERVER_ERROR"
interaction_typeWhat type of user action?"click", "input", "hover"

Understanding Sub-States

Each parent state can have multiple sub-states that provide important context about how or why a state transition occurred. Here's the logical purpose of each group of sub-states.

Feature Checked

Feature checks are a special case of events that are captured when the SDK checks to see if the user is entitled to a feature or has used up their feature allowance. You do not need to track these events manually as they are automatically captured when calling meterCheck or featureCheck.

  • entitled: Represents a check from FE or BE to see if the user is entitled to the feature
  • meter: Represents a check from FE or BE to see if the user has used up their feature allowance

Feature Initiated

  • user: Represents intentional, direct actions by the user
  • system: Represents automated or programmatic triggers of featuresoutside of user control

Feature Configuration

  • modal: Represents configuration that interrupts the main workflow with a focused interface
  • inline: Represents configuration that occurs within the natural flow of the interface

Feature Interaction

  • selected: Represents choosing from predefined options or making discrete choices
  • edited: Represents free-form modifications or custom input

Feature Progressed

  • advanced: Represents forward progress through a defined sequence
  • reversed: Represents backward movement through a defined sequence

Feature Completed

  • confirmed: Represents successful, intended completion of the feature flow
  • inaccessible: Represents completion blocked by business rules or permissions

Feature Abandoned

  • cancelled: Represents explicit, intentional abandonment
  • idled: Represents passive or timeout-based abandonment
  • closed: Represents interface-level abandonment
  • clicked_away: Represents indirect or navigation-based abandonment

Feature Paywalled

  • configured: Represents setup or customization prior to payment
  • plan_selected: Represents primary monetization choice
  • frequency_selected: Represents secondary monetization parameters

Feature Error

  • validation: Represents user-correctable input or logic errors
  • system: Represents technical failures outside of user control

These sub-states help categorize the specific manner in which a state change occurred, enabling more detailed analysis of user behavior and system performance. When tracking events, choose the sub-state that best describes the logical nature of the transition, rather than focusing on the specific UI implementation.

Parent StateSub-StateEvent NameExample Use Case
feature_initiateduserfeature_initiated.userUser clicks a button. The common case, used in most cases.
systemfeature_initiated.systemSystem pops a feature e.g., during onboarding.
feature_configurationmodalfeature_configuration.modalA modal loads to request further information or decision from the user.
inlinefeature_configuration.inlineA user is asked to provide more data or a decision.
feature_interactionselectedfeature_interaction.selectedUser chooses an option.
editedfeature_interaction.editedUser edits a form field.
feature_progressedadvancedfeature_progressed.advancedUser completes a wizard step.
reversedfeature_progressed.reversedUser goes back a step.
feature_completedconfirmedfeature_completed.confirmedForm submitted or confirmation button clicked.
inaccessiblefeature_completed.inaccessibleUser's plan or role does not allow them to use the feature.
feature_abandonedcancelledfeature_abandoned.cancelledUser hits cancel button and backs out of the flow.
idledfeature_abandoned.idledUser inactive for too long.
closedfeature_abandoned.closedUser closes a modal to back out of the flow.
clicked_awayfeature_abandoned.clicked_awayUser clicks away to back out of the flow.
feature_paywalledconfiguredfeature_paywalled.configuredUser selects a number of seats or usage level.
plan_selectedfeature_paywalled.plan_selectedUser selects from one of the plans.
frequency_selectedfeature_paywalled.frequency_selectedUser chooses between month or year.
feature_errorvalidationfeature_error.validationForm validation failed.
systemfeature_error.systemAPI call failed.

2. Contextual Metadata (System & Developer Provided)

To enrich events and make analysis easier, each event should include both system-generated and developer-provided context, which together provide a complete view of user behavior. System-generated data ensures consistency and captures environmental factors, while developer-provided context adds domain-specific insights that help interpret user intent.

System-Generated Context (Captured Automatically)

Context FieldDescriptionExample Values
session_idUnique identifier for the user's session"abc123"
timestampEvent timestamp"2025-02-21T12:30:00Z"
device_typeDevice category"mobile", "desktop"
browserBrowser type/version"Chrome 120", "Safari 17"
osOperating system"Windows 11", "iOS 17"
network_statusConnection quality"4G", "Wi-Fi"
latencyAPI response time (if applicable)250ms
dom_eventThe raw DOM event associated with the interaction{ type: "click", target: "#submit-button" }
interaction_typeExtracted from the DOM event"click", "input", "hover"

Developer-Provided Context (Captured from Application Logic)

Context FieldDescriptionExample Values
system_idUnique ID from your Db. This allows events to be tracked through your BE and other systems"user_789"
feature_nameThe feature being tracked. This does not have to be a valid Stripe feature"awesome_mode"
selected_optionIf an option was chosen, which one?"premium_plan", "basic_plan"
error_codeIf an error occurs, what was it?"500_INTERNAL_SERVER_ERROR"
0.2.4

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.2.1

1 year ago

0.1.0

1 year ago

0.1.15

1 year ago

0.1.13

1 year ago

0.1.12

1 year ago

0.1.11

1 year ago

0.1.10

1 year ago

0.1.9

1 year ago

0.0.1

1 year ago