-
Notifications
You must be signed in to change notification settings - Fork 30
Closed
Description
package main
import (
"github.com/posthog/posthog-go"
)
func main() {
client, _ := posthog.NewWithConfig("my-secret", posthog.Config{Endpoint: "https://us.i.posthog.com"})
defer client.Close()
isMyFlagEnabledForUser, err := client.IsFeatureEnabled(
FeatureFlagPayload{
Key: 'my-flag',
DistinctId: "distinct-id",
})
if isMyFlagEnabledForUser {
// Do something differently for this user
}
}
-
FeatureFlagPayload would be posthog.FeatureFlagPayload
posthog.FeatureFlagPayload{ -
Key: "my-flag", // double quotes DistinctId: "distinct-id",})
-
client.IsFeatureEnabled doesn't return boolean, it returns interface and error
if isMyFlagEnabledForUser {
// Do something differently for this user
}
Metadata
Metadata
Assignees
Labels
No labels