PostHog 上线 Vercel Marketplace,支持功能开关与实验能力

1 分钟阅读
2026 年 2 月 10 日


PostHog 现已登陆 Vercel Marketplace,可作为功能开关(feature flags)、实验(experimentation)与 Analytics 提供方使用。
通过这一集成,你现在可以:
-
使用 Flags SDK 和 @flags-sdk/posthog 适配器,在代码中声明 flags
-
面向特定用户或用户分群实时切换功能
-
通过基于百分比的方式渐进发布变更
-
在全面发布前运行 A/B 测试,验证实际影响
该集成能帮助在 Vercel 上构建产品的团队更有信心地发布。你可以在生产环境中进行测试、降低发布风险,并基于真实用户行为做数据驱动决策——全部在现有的 Vercel 工作流内完成。
创建一个带有 identify 函数和 flag 检查逻辑的 flags.ts 文件:
flags.ts
import { postHogAdapter } from '@flags-sdk/posthog'import { flag, dedupe } from 'flags/next'import type { Identify } from 'flags'export const identify = dedupe(async () => ({ distinctId: 'user_distinct_id' // replace with real user ID})) satisfies Identify<{ distinctId: string }>export const myFlag = flag({ key: 'my-flag', adapter: postHogAdapter.isFeatureEnabled(), identify,})
创建一个 flags.ts 文件,包含一个简单的 identify 函数,以及一个用于检查你的 flag 的函数。
查看 PostHog template 了解该集成的更多信息。
原文链接:https://vercel.com/changelog/posthog-joins-the-vercel-marketplace

