stubkit docs

Feature · Paywalls & targeting

Event triggers

Define rules that fire a paywall when your SDK reports a behavioral event. Each rule matches on the event name + optional conditions on event properties, optionally filters by audience, and enforces a per-user cooldown so the same paywall never shows twice in a window.

SDK usage

// When the user hits a free-tier limit, ask stubkit if a paywall should fire.
const result = await stubkit.track(
  'hit_export_limit',
  { count: 5, plan: 'free' },
  { userId: currentUser.id },
);
if (result.showPaywall) {
  renderPaywall(result.showPaywall);
}

How matching works

  1. Server looks up all active event rules for your app + the event name, sorted by priority DESC.
  2. Each rule's conditions.rules are evaluated against the properties you sent. Same operator set as audiences.
  3. If the rule has an audience_id, the user must also match the audience (country, platform, is_trial, etc.).
  4. Cooldown check: if the user has fired this rule within cooldown_seconds, skip — stored in KV with TTL.
  5. First rule that passes wins. show_paywall is returned with the offering config.

REST endpoints

  • POST /v1/events/track — SDK endpoint. Requires pk_live_ with track:events scope.
  • GET/POST /v1/admin/event-rules
  • PATCH/DELETE /v1/admin/event-rules/:id

Dashboard

app.stubkit.com/apps/{app_id}/event-triggers — rule list, full rule editor with event name, conditions, offering picker, audience picker, priority and cooldown preset.