Interface PostHogInterface
-
- All Implemented Interfaces:
public interface PostHogInterface
-
-
Method Summary
Modifier and Type Method Description abstract <T extends PostHogConfig> Unitsetup(T config)Setup the SDK abstract Unitclose()Closes the SDK abstract Unitidentify(String distinctId, Map<String, Object> userProperties, Map<String, Object> userPropertiesSetOnce)Identifies the user Docs https://posthog. Unitidentify(String distinctId)Identifies the user Docs https://posthog. Unitidentify(String distinctId, Map<String, Object> userProperties)Identifies the user Docs https://posthog. abstract Unitflush()Flushes all the events in the Queue right away abstract Unitdebug(Boolean enable)Enables or disables the debug mode Unitcapture(String distinctId, String event, PostHogCaptureOptions options)Captures events Unitcapture(String distinctId, String event)Captures events abstract BooleanisFeatureEnabled(String distinctId, String key, Boolean defaultValue, Map<String, String> groups, Map<String, Object> personProperties, Map<String, Map<String, Object>> groupProperties)Returns if a feature flag is enabled, the feature flag must be a Boolean Docs https://posthog.com/docs/feature-flags and https://posthog. BooleanisFeatureEnabled(String distinctId, String key)Returns if a feature flag is enabled, the feature flag must be a Boolean Docs https://posthog.com/docs/feature-flags and https://posthog. BooleanisFeatureEnabled(String distinctId, String key, Boolean defaultValue)Returns if a feature flag is enabled, the feature flag must be a Boolean Docs https://posthog.com/docs/feature-flags and https://posthog. BooleanisFeatureEnabled(String distinctId, String key, PostHogFeatureFlagOptions options)Returns if a feature flag is enabled, the feature flag must be a Boolean Docs https://posthog.com/docs/feature-flags and https://posthog. abstract ObjectgetFeatureFlag(String distinctId, String key, Object defaultValue, Map<String, String> groups, Map<String, Object> personProperties, Map<String, Map<String, Object>> groupProperties)Returns the feature flags variant if multi-variant, otherwise whether it is enabled or not Docs https://posthog.com/docs/feature-flags and https://posthog. ObjectgetFeatureFlag(String distinctId, String key)Returns the feature flags variant if multi-variant, otherwise whether it is enabled or not Docs https://posthog.com/docs/feature-flags and https://posthog. ObjectgetFeatureFlag(String distinctId, String key, PostHogFeatureFlagOptions options)Returns the feature flags variant if multi-variant, otherwise whether it is enabled or not Docs https://posthog.com/docs/feature-flags and https://posthog. ObjectgetFeatureFlag(String distinctId, String key, Object defaultValue)Returns if a feature flag is enabled, the feature flag must be a Boolean Docs https://posthog.com/docs/feature-flags and https://posthog. abstract ObjectgetFeatureFlagPayload(String distinctId, String key, Object defaultValue, Map<String, String> groups, Map<String, Object> personProperties, Map<String, Map<String, Object>> groupProperties)Returns the feature flag payload Docs https://posthog.com/docs/feature-flags and https://posthog. ObjectgetFeatureFlagPayload(String distinctId, String key)Returns the feature flag payload Docs https://posthog.com/docs/feature-flags and https://posthog. ObjectgetFeatureFlagPayload(String distinctId, String key, PostHogFeatureFlagOptions options)Returns the feature flag payload Docs https://posthog.com/docs/feature-flags and https://posthog. ObjectgetFeatureFlagPayload(String distinctId, String key, Object defaultValue)Returns the feature flag payload Docs https://posthog.com/docs/feature-flags and https://posthog. abstract FeatureFlagResultgetFeatureFlagResult(String distinctId, String key, Map<String, String> groups, Map<String, Object> personProperties, Map<String, Map<String, Object>> groupProperties, Boolean sendFeatureFlagEvent)Returns the feature flag result containing both value and payload. FeatureFlagResultgetFeatureFlagResult(String distinctId, String key)Returns the feature flag result containing both value and payload. FeatureFlagResultgetFeatureFlagResult(String distinctId, String key, PostHogFeatureFlagResultOptions options)Returns the feature flag result containing both value and payload. abstract Unitgroup(String distinctId, String type, String key, Map<String, Object> groupProperties)Creates a group Docs https://posthog. Unitgroup(String distinctId, String type, String key)Creates a group Docs https://posthog. abstract Unitalias(String distinctId, String alias)Creates an alias for the user Docs https://posthog. abstract UnitreloadFeatureFlags()Reloads feature flag definitions from the server for use with local evaluation. abstract UnitcaptureException(Throwable exception, String distinctId, Map<String, Object> properties)Captures an exception Docs https://posthog. UnitcaptureException(Throwable exception, String distinctId)Captures an exception Docs https://posthog. UnitcaptureException(Throwable exception, Map<String, Object> properties)Captures an exception Docs https://posthog. UnitcaptureException(Throwable exception)Captures an exception Docs https://posthog. -
-
Method Detail
-
setup
abstract <T extends PostHogConfig> Unit setup(T config)
Setup the SDK
- Parameters:
config- the SDK configuration
-
identify
abstract Unit identify(String distinctId, Map<String, Object> userProperties, Map<String, Object> userPropertiesSetOnce)
Identifies the user Docs https://posthog.com/docs/product-analytics/identify
- Parameters:
distinctId- the distinctIduserProperties- the user properties, set as a "$set" property, Docs https://posthog.userPropertiesSetOnce- the user properties to set only once, set as a "$set_once" property, Docs https://posthog.
-
identify
Unit identify(String distinctId)
Identifies the user Docs https://posthog.com/docs/product-analytics/identify
- Parameters:
distinctId- the distinctId
-
identify
Unit identify(String distinctId, Map<String, Object> userProperties)
Identifies the user Docs https://posthog.com/docs/product-analytics/identify
- Parameters:
distinctId- the distinctIduserProperties- the user properties, set as a "$set" property, Docs https://posthog.
-
capture
Unit capture(String distinctId, String event, PostHogCaptureOptions options)
Captures events
- Parameters:
distinctId- the distinctIdevent- the event nameoptions- the capture options containing properties, userProperties, userPropertiesSetOnce, groups, and appendFeatureFlags
-
capture
Unit capture(String distinctId, String event)
Captures events
- Parameters:
distinctId- the distinctIdevent- the event name
-
isFeatureEnabled
abstract Boolean isFeatureEnabled(String distinctId, String key, Boolean defaultValue, Map<String, String> groups, Map<String, Object> personProperties, Map<String, Map<String, Object>> groupProperties)
Returns if a feature flag is enabled, the feature flag must be a Boolean Docs https://posthog.com/docs/feature-flags and https://posthog.com/docs/experiments
- Parameters:
distinctId- the distinctIdkey- the KeydefaultValue- the default value if not found, false if not given
-
isFeatureEnabled
Boolean isFeatureEnabled(String distinctId, String key)
Returns if a feature flag is enabled, the feature flag must be a Boolean Docs https://posthog.com/docs/feature-flags and https://posthog.com/docs/experiments
- Parameters:
distinctId- the distinctIdkey- the Key
-
isFeatureEnabled
Boolean isFeatureEnabled(String distinctId, String key, Boolean defaultValue)
Returns if a feature flag is enabled, the feature flag must be a Boolean Docs https://posthog.com/docs/feature-flags and https://posthog.com/docs/experiments
- Parameters:
distinctId- the distinctIdkey- the KeydefaultValue- the default value if not found
-
isFeatureEnabled
Boolean isFeatureEnabled(String distinctId, String key, PostHogFeatureFlagOptions options)
Returns if a feature flag is enabled, the feature flag must be a Boolean Docs https://posthog.com/docs/feature-flags and https://posthog.com/docs/experiments
- Parameters:
distinctId- the distinctIdkey- the Keyoptions- the feature flag options containing defaultValue, groups, personProperties, and groupProperties
-
getFeatureFlag
abstract Object getFeatureFlag(String distinctId, String key, Object defaultValue, Map<String, String> groups, Map<String, Object> personProperties, Map<String, Map<String, Object>> groupProperties)
Returns the feature flags variant if multi-variant, otherwise whether it is enabled or not Docs https://posthog.com/docs/feature-flags and https://posthog.com/docs/experiments
- Parameters:
distinctId- the distinctIdkey- the KeydefaultValue- the default value if not found
-
getFeatureFlag
Object getFeatureFlag(String distinctId, String key)
Returns the feature flags variant if multi-variant, otherwise whether it is enabled or not Docs https://posthog.com/docs/feature-flags and https://posthog.com/docs/experiments
- Parameters:
distinctId- the distinctIdkey- the Key
-
getFeatureFlag
Object getFeatureFlag(String distinctId, String key, PostHogFeatureFlagOptions options)
Returns the feature flags variant if multi-variant, otherwise whether it is enabled or not Docs https://posthog.com/docs/feature-flags and https://posthog.com/docs/experiments
- Parameters:
distinctId- the distinctIdkey- the Keyoptions- the feature flag options containing defaultValue, groups, personProperties, and groupProperties
-
getFeatureFlag
Object getFeatureFlag(String distinctId, String key, Object defaultValue)
Returns if a feature flag is enabled, the feature flag must be a Boolean Docs https://posthog.com/docs/feature-flags and https://posthog.com/docs/experiments
- Parameters:
distinctId- the distinctIdkey- the KeydefaultValue- the default value if not found
-
getFeatureFlagPayload
abstract Object getFeatureFlagPayload(String distinctId, String key, Object defaultValue, Map<String, String> groups, Map<String, Object> personProperties, Map<String, Map<String, Object>> groupProperties)
Returns the feature flag payload Docs https://posthog.com/docs/feature-flags and https://posthog.com/docs/experiments
- Parameters:
distinctId- the distinctIdkey- the KeydefaultValue- the default value if not found
-
getFeatureFlagPayload
Object getFeatureFlagPayload(String distinctId, String key)
Returns the feature flag payload Docs https://posthog.com/docs/feature-flags and https://posthog.com/docs/experiments
- Parameters:
distinctId- the distinctIdkey- the Key
-
getFeatureFlagPayload
Object getFeatureFlagPayload(String distinctId, String key, PostHogFeatureFlagOptions options)
Returns the feature flag payload Docs https://posthog.com/docs/feature-flags and https://posthog.com/docs/experiments
- Parameters:
distinctId- the distinctIdkey- the Keyoptions- the feature flag options containing defaultValue, groups, personProperties, and groupProperties
-
getFeatureFlagPayload
Object getFeatureFlagPayload(String distinctId, String key, Object defaultValue)
Returns the feature flag payload Docs https://posthog.com/docs/feature-flags and https://posthog.com/docs/experiments
- Parameters:
distinctId- the distinctIdkey- the KeydefaultValue- the default value if not found
-
getFeatureFlagResult
abstract FeatureFlagResult getFeatureFlagResult(String distinctId, String key, Map<String, String> groups, Map<String, Object> personProperties, Map<String, Map<String, Object>> groupProperties, Boolean sendFeatureFlagEvent)
Returns the feature flag result containing both value and payload. Docs https://posthog.com/docs/feature-flags and https://posthog.com/docs/experiments
- Parameters:
distinctId- the distinctIdkey- the Keygroups- groups for group-based flagspersonProperties- person properties for flag evaluationgroupProperties- group properties for flag evaluationsendFeatureFlagEvent- whether to send the $feature_flag_called event, or null to use config default
-
getFeatureFlagResult
FeatureFlagResult getFeatureFlagResult(String distinctId, String key)
Returns the feature flag result containing both value and payload. Docs https://posthog.com/docs/feature-flags and https://posthog.com/docs/experiments
- Parameters:
distinctId- the distinctIdkey- the Key
-
getFeatureFlagResult
FeatureFlagResult getFeatureFlagResult(String distinctId, String key, PostHogFeatureFlagResultOptions options)
Returns the feature flag result containing both value and payload. Docs https://posthog.com/docs/feature-flags and https://posthog.com/docs/experiments
- Parameters:
distinctId- the distinctIdkey- the Keyoptions- the feature flag result options containing groups, personProperties, groupProperties, and sendFeatureFlagEvent
-
group
abstract Unit group(String distinctId, String type, String key, Map<String, Object> groupProperties)
Creates a group Docs https://posthog.com/docs/product-analytics/group-analytics
- Parameters:
distinctId- the distinctIdtype- the Group typekey- the Group keygroupProperties- the Group properties, set as a "$group_set" property, Docs https://posthog.
-
group
Unit group(String distinctId, String type, String key)
Creates a group Docs https://posthog.com/docs/product-analytics/group-analytics
- Parameters:
distinctId- the distinctIdtype- the Group typekey- the Group key
-
alias
abstract Unit alias(String distinctId, String alias)
Creates an alias for the user Docs https://posthog.com/docs/product-analytics/identify#alias-assigning-multiple-distinct-ids-to-the-same-user
- Parameters:
distinctId- the distinctIdalias- the alias
-
reloadFeatureFlags
abstract Unit reloadFeatureFlags()
Reloads feature flag definitions from the server for use with local evaluation. Note that feature flag definitions are automatically fetched on initialization and periodically refreshed, so this method only needs to be called if you want to force an immediate refresh. Docs https://posthog.com/docs/feature-flags/local-evaluation
-
captureException
abstract Unit captureException(Throwable exception, String distinctId, Map<String, Object> properties)
Captures an exception Docs https://posthog.com/docs/error-tracking
- Parameters:
exception- the exception to capturedistinctId- the distinctIdproperties- the exception properties to add to the event
-
captureException
Unit captureException(Throwable exception, String distinctId)
Captures an exception Docs https://posthog.com/docs/error-tracking
- Parameters:
exception- the exception to capturedistinctId- the distinctId
-
captureException
Unit captureException(Throwable exception, Map<String, Object> properties)
Captures an exception Docs https://posthog.com/docs/error-tracking
- Parameters:
exception- the exception to captureproperties- the exception properties to add to the event
-
captureException
Unit captureException(Throwable exception)
Captures an exception Docs https://posthog.com/docs/error-tracking
- Parameters:
exception- the exception to capture
-
-
-
-