5.33.0
Minor Changes
-
#3476
f8bc02fThanks @dmarticus! - AddevaluateFlags()and a newflagsoption oncapture()so a single/flagsrequest powers both flag branching and event enrichment per incoming request:const flags = await posthog.evaluateFlags(distinctId, { personProperties: { plan: 'enterprise' } }) if (flags.isEnabled('new-dashboard')) { renderNewDashboard() } posthog.capture({ distinctId, event: 'page_viewed', flags })
The returned
FeatureFlagEvaluationssnapshot exposesisEnabled(),getFlag(),getFlagPayload()for branching, plusonlyAccessed()andonly([keys])for filtering which flags get attached to a captured event. PassflagKeys: [...]toevaluateFlags()to scope the underlying/flagsrequest itself.captureException()/captureExceptionImmediate()accept aflagsargument so$exceptionevents carry the same flag context as the rest of your request's events.Deprecates
isFeatureEnabled(),getFeatureFlag(),getFeatureFlagPayload(), andcapture({ sendFeatureFlags }). They continue to work but now log a deduped[PostHog] ... is deprecatedwarning the first time they're used. Removal is planned for the next major version. (2026-05-02)