Class PostHogConfig

  • All Implemented Interfaces:

    
    public class PostHogConfig
    
                        

    The SDK Config

    • Method Detail

      • getHost

         final String getHost()

        The PostHog Host Defaults to https://us.i.posthog.com EU Host: https://eu.i.posthog.com

      • getDebug

         final Boolean getDebug()

        Logs the debug logs to the logger if enabled Defaults to false

      • setDebug

         final Unit setDebug(Boolean debug)

        Logs the debug logs to the logger if enabled Defaults to false

      • getSendFeatureFlagEvent

         final Boolean getSendFeatureFlagEvent()

        Send a $feature_flag_called event when a feature flag is used automatically Used by experiments

        Defaults to true

      • setSendFeatureFlagEvent

         final Unit setSendFeatureFlagEvent(Boolean sendFeatureFlagEvent)

        Send a $feature_flag_called event when a feature flag is used automatically Used by experiments

        Defaults to true

      • getPreloadFeatureFlags

         final Boolean getPreloadFeatureFlags()

        Preload feature flags automatically Docs https://posthog.com/docs/feature-flags and https://posthog.com/docs/experiments Defaults to true

      • setPreloadFeatureFlags

         final Unit setPreloadFeatureFlags(Boolean preloadFeatureFlags)

        Preload feature flags automatically Docs https://posthog.com/docs/feature-flags and https://posthog.com/docs/experiments Defaults to true

      • getRemoteConfig

         final Boolean getRemoteConfig()

        Preload PostHog remote config automatically Defaults to true

      • getFlushAt

         final Integer getFlushAt()

        Number of minimum events before they are sent over the wire Defaults to 20

      • setFlushAt

         final Unit setFlushAt(Integer flushAt)

        Number of minimum events before they are sent over the wire Defaults to 20

      • getMaxQueueSize

         final Integer getMaxQueueSize()

        Number of maximum events in memory and disk, when the maximum is exceed, the oldest event is deleted and the new one takes place Defaults to 1000

      • setMaxQueueSize

         final Unit setMaxQueueSize(Integer maxQueueSize)

        Number of maximum events in memory and disk, when the maximum is exceed, the oldest event is deleted and the new one takes place Defaults to 1000

      • getFlushIntervalSeconds

         final Integer getFlushIntervalSeconds()

        Interval in seconds for sending events over the wire The lower the number, most likely more battery is used Defaults to 30s

      • setFlushIntervalSeconds

         final Unit setFlushIntervalSeconds(Integer flushIntervalSeconds)

        Interval in seconds for sending events over the wire The lower the number, most likely more battery is used Defaults to 30s

      • getEncryption

         final PostHogEncryption getEncryption()

        Hook for encrypt and decrypt events Devices are sandbox so likely not needed Defaults to no encryption

      • setEncryption

         final Unit setEncryption(PostHogEncryption encryption)

        Hook for encrypt and decrypt events Devices are sandbox so likely not needed Defaults to no encryption

      • getOnFeatureFlags

         final PostHogOnFeatureFlags getOnFeatureFlags()

        Hook that is called when feature flag definitions are loaded. This is called immediately if local evaluation is not enabled. Defaults to no callback

      • setOnFeatureFlags

         final Unit setOnFeatureFlags(PostHogOnFeatureFlags onFeatureFlags)

        Hook that is called when feature flag definitions are loaded. This is called immediately if local evaluation is not enabled. Defaults to no callback

      • getProxy

         final Proxy getProxy()

        Hook that allows to sanitize the event properties The hook is called before the event is cached or sent over the wire

      • setProxy

         final Unit setProxy(Proxy proxy)

        Hook that allows to sanitize the event properties The hook is called before the event is cached or sent over the wire

      • setFeatureFlagCacheMaxAgeMs

         final Unit setFeatureFlagCacheMaxAgeMs(Integer featureFlagCacheMaxAgeMs)

        The maximum age of a feature flag cache record in memory in milliseconds Defaults to 5 minutes

      • getFeatureFlagCalledCacheSize

         final Integer getFeatureFlagCalledCacheSize()

        The maximum size of the feature flag called cache in memory. This cache prevents duplicate $feature_flag_called events from being sent by keeping track of per-user feature flag usage. Defaults to 1000

      • setFeatureFlagCalledCacheSize

         final Unit setFeatureFlagCalledCacheSize(Integer featureFlagCalledCacheSize)

        The maximum size of the feature flag called cache in memory. This cache prevents duplicate $feature_flag_called events from being sent by keeping track of per-user feature flag usage. Defaults to 1000

      • getLocalEvaluation

         final Boolean getLocalEvaluation()

        Enable local evaluation of feature flags When enabled, the SDK periodically fetches flag definitions and evaluates flags locally without making API calls for each flag check. Falls back to API if evaluation is inconclusive. Requires personalApiKey to be set. Defaults to false

      • setLocalEvaluation

         final Unit setLocalEvaluation(Boolean localEvaluation)

        Enable local evaluation of feature flags When enabled, the SDK periodically fetches flag definitions and evaluates flags locally without making API calls for each flag check. Falls back to API if evaluation is inconclusive. Requires personalApiKey to be set. Defaults to false

      • getPersonalApiKey

         final String getPersonalApiKey()

        Personal API key for local evaluation Required when localEvaluation is true. Defaults to null

      • setPersonalApiKey

         final Unit setPersonalApiKey(String personalApiKey)

        Personal API key for local evaluation Required when localEvaluation is true. Defaults to null

      • getPollIntervalSeconds

         final Integer getPollIntervalSeconds()

        Interval in seconds for polling feature flag definitions for local evaluation Defaults to 30 seconds

      • setPollIntervalSeconds

         final Unit setPollIntervalSeconds(Integer pollIntervalSeconds)

        Interval in seconds for polling feature flag definitions for local evaluation Defaults to 30 seconds

      • getEvaluationContexts

         final List<String> getEvaluationContexts()

        Evaluation contexts for feature flags List of contexts (e.g., "web", "mobile", "checkout") used to filter feature flag evaluations on the server side. Defaults to null

      • setEvaluationContexts

         final Unit setEvaluationContexts(List<String> evaluationContexts)

        Evaluation contexts for feature flags List of contexts (e.g., "web", "mobile", "checkout") used to filter feature flag evaluations on the server side. Defaults to null