import posthog

posthog.project_api_key = "phc_YOUR_API_KEY"
posthog.host = "https://us.posthog.com"

# イベントキャプチャ
posthog.capture(
    distinct_id="user-123",
    event="button_clicked",
    properties={"page": "home", "button": "signup"}
)

# フィーチャーフラグ確認
if posthog.feature_enabled("new-checkout-flow", "user-123"):
    print("新しいチェックアウトフローを表示")

# ユーザープロパティ設定
posthog.identify(
    distinct_id="user-123",
    properties={"plan": "pro", "country": "JP"}
)