Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.nippy.la/llms.txt

Use this file to discover all available pages before exploring further.

track() records a business event and evaluates whether any campaign rule should trigger a mechanic.

Usage

const result = await nippy.track({
  userId: 'user-123',
  campaignId: 'camp-abc',
  eventType: 'card.purchase.completed',
  properties: { value: 500 },
  occurredAt: new Date().toISOString()
})

Parameters

userId
string
required
User identifier from your system. Example: user-123.
campaignId
string
required
Campaign ID that should evaluate the event. Example: camp-abc.
eventType
string
required
Event type configured in the rule. Example: card.purchase.completed.
properties
object
default:"{}"
Event data used by rule conditions. Example: { "value": 500 }.
occurredAt
string
default:"request receipt time"
ISO 8601 timestamp for when the event occurred.

Response

triggered
array
Mechanics triggered by the event. Empty when no rule matched.
triggered[].spinId
string
ID of the triggered spin.
triggered[].campaignId
string
Campaign ID that triggered the spin.
triggered[].ruleId
string
Rule ID that triggered the spin.
track() does not return the spin result. The result arrives through the spin.completed webhook.