Skip to main content
userTourKit
@tour-kit/adoptionHooks

useFunnelData

Derive a current-state adoption funnel from useAdoptionStats — feed straight into AdoptionFunnel.

domidex01Published

useFunnelData is a convenience selector that projects the current user's adoption state — read via useAdoptionStats — into a FunnelStep[] ready to hand to <AdoptionFunnel>. Must be used inside <AdoptionProvider>.

Current-state, not historical. This hook describes the current user's progress at this moment. It does NOT support date-ranged cohort funnels. For aggregated multi-user funnels, compute the data in your analytics pipeline and pass it directly to <AdoptionFunnel steps={data} />.

Usage

import {
  AdoptionFunnel,
  AdoptionProvider,
  useFunnelData,
} from '@tour-kit/adoption'

function ActivationFunnel() {
  const steps = useFunnelData({
    featureIds: ['view-pricing', 'start-trial', 'invite-team'],
    labels: {
      'view-pricing': 'Viewed Pricing',
      'start-trial': 'Started Trial',
      'invite-team': 'Invited Team',
    },
  })
  return <AdoptionFunnel steps={steps} title="Activation funnel" />
}

<AdoptionProvider features={features}>
  <ActivationFunnel />
</AdoptionProvider>

Input

Prop

Type

Output

Returns FunnelStep[] directly — one step per featureIds entry, in input order. Pass straight to <AdoptionFunnel steps={...}>.

Mapping Semantics

For each featureIds[i], the hook reads the matching FeatureWithUsage from useAdoptionStats() and produces:

  • entered = usage.useCount — number of times the current user has touched the feature.
  • completed = usage.useCount when usage.status === 'adopted', else 0 — 100% per-user conversion once adopted; 0% before.

Unknown feature IDs (no matching feature in the provider) get entered: 0, completed: 0.

See Also