posthog-js 1.310.2 → 1.312.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.es5.js.map +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.full.no-external.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.js.map +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/array.no-external.js.map +1 -1
- package/dist/customizations.full.js +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.d.ts +43 -0
- package/dist/module.full.d.ts +43 -0
- package/dist/module.full.js +1 -1
- package/dist/module.full.js.map +1 -1
- package/dist/module.full.no-external.d.ts +43 -0
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.full.no-external.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/module.no-external.d.ts +43 -0
- package/dist/module.no-external.js +1 -1
- package/dist/module.no-external.js.map +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/dist/src/page-view.d.ts +4 -0
- package/dist/src/posthog-core.d.ts +39 -0
- package/dist/surveys-preview.d.ts +43 -0
- package/lib/package.json +1 -1
- package/lib/src/page-view.d.ts +4 -0
- package/lib/src/page-view.js +29 -0
- package/lib/src/page-view.js.map +1 -1
- package/lib/src/posthog-core.d.ts +39 -0
- package/lib/src/posthog-core.js +83 -8
- package/lib/src/posthog-core.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"posthog-core.js","sourceRoot":"","sources":["../../src/posthog-core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAw+GA,8CAyDC;AAED,wCAMC;AAziHD,6CAA2C;AAC3C,oDAA6B;AA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ConsentManager, ConsentStatus } from './consent'\nimport {\n ALIAS_ID_KEY,\n COOKIELESS_MODE_FLAG_PROPERTY,\n COOKIELESS_SENTINEL_VALUE,\n ENABLE_PERSON_PROCESSING,\n FLAG_CALL_REPORTED,\n PEOPLE_DISTINCT_ID_KEY,\n SURVEYS_REQUEST_TIMEOUT_MS,\n USER_STATE,\n} from './constants'\nimport { DeadClicksAutocapture, isDeadClicksEnabledForAutocapture } from './extensions/dead-clicks-autocapture'\nimport { ExceptionObserver } from './extensions/exception-autocapture'\nimport { HistoryAutocapture } from './extensions/history-autocapture'\nimport { setupSegmentIntegration } from './extensions/segment-integration'\nimport { SentryIntegration, sentryIntegration, SentryIntegrationOptions } from './extensions/sentry-integration'\nimport { Toolbar } from './extensions/toolbar'\nimport { TracingHeaders } from './extensions/tracing-headers'\nimport { WebVitalsAutocapture } from './extensions/web-vitals'\nimport { Heatmaps } from './heatmaps'\nimport { PageViewManager } from './page-view'\nimport { PostHogExceptions } from './posthog-exceptions'\nimport { PostHogFeatureFlags } from './posthog-featureflags'\nimport { PostHogPersistence } from './posthog-persistence'\nimport { PostHogProductTours } from './posthog-product-tours'\nimport { PostHogSurveys } from './posthog-surveys'\nimport { PostHogConversations } from './extensions/conversations/posthog-conversations'\nimport {\n DisplaySurveyOptions,\n SurveyCallback,\n SurveyEventName,\n SurveyEventProperties,\n SurveyRenderReason,\n} from './posthog-surveys-types'\nimport { RateLimiter } from './rate-limiter'\nimport { RemoteConfigLoader } from './remote-config'\nimport { extendURLParams, request, SUPPORTS_REQUEST } from './request'\nimport { DEFAULT_FLUSH_INTERVAL_MS, RequestQueue } from './request-queue'\nimport { RetryQueue } from './retry-queue'\nimport { ScrollManager } from './scroll-manager'\nimport { SessionPropsManager } from './session-props'\nimport { SessionIdManager } from './sessionid'\nimport { SiteApps } from './site-apps'\nimport { localStore } from './storage'\nimport {\n CaptureOptions,\n CaptureResult,\n Compression,\n ConfigDefaults,\n EarlyAccessFeatureCallback,\n EarlyAccessFeatureStage,\n EventName,\n ExceptionAutoCaptureConfig,\n FeatureFlagsCallback,\n JsonType,\n OverrideConfig,\n PostHogConfig,\n Properties,\n Property,\n QueuedRequestWithOptions,\n RemoteConfig,\n RequestCallback,\n SessionIdChangedCallback,\n SnippetArrayItem,\n ToolbarParams,\n} from './types'\nimport {\n _copyAndTruncateStrings,\n addEventListener,\n each,\n eachArray,\n extend,\n isCrossDomainCookie,\n migrateConfigField,\n safewrapClass,\n} from './utils'\nimport { isLikelyBot } from './utils/blocked-uas'\nimport { getEventProperties } from './utils/event-utils'\nimport { assignableWindow, document, location, navigator, userAgent, window } from './utils/globals'\nimport { logger } from './utils/logger'\nimport { getPersonPropertiesHash } from './utils/property-utils'\nimport { RequestRouter, RequestRouterRegion } from './utils/request-router'\nimport { SimpleEventEmitter } from './utils/simple-event-emitter'\nimport {\n DEFAULT_DISPLAY_SURVEY_OPTIONS,\n getSurveyInteractionProperty,\n setSurveySeenOnLocalStorage,\n} from './utils/survey-utils'\nimport {\n isEmptyString,\n isFunction,\n isKnownUnsafeEditableEvent,\n isNullish,\n isNumber,\n isString,\n isUndefined,\n includes,\n isDistinctIdStringLike,\n isArray,\n isEmptyObject,\n isObject,\n isBoolean,\n} from '@posthog/core'\nimport { uuidv7 } from './uuidv7'\nimport { WebExperiments } from './web-experiments'\nimport { ExternalIntegrations } from './extensions/external-integration'\nimport { SessionRecording } from './extensions/replay/session-recording'\n\n/*\nSIMPLE STYLE GUIDE:\n\nUse TypeScript accessibility modifiers, e.g. private/protected\n\nIf something is not part of the public interface:\n* prefix it with _ to allow mangling\n* prefix it with __ to disable mangling, but signal that it is internal\n\nGlobals should be all caps\n*/\n\n/* posthog.init is called with `Partial<PostHogConfig>`\n * and we want to ensure that only valid keys are passed to the config object.\n * TypeScript does not enforce that the object passed does not have extra keys.\n * So someone can call with { bootstrap: { distinctId: '123'} }\n * which is not a valid key. They should have passed distinctID (upper case D).\n * That's a really tricky mistake to spot.\n * The OnlyValidKeys type ensures that only keys that are valid in the PostHogConfig type are allowed.\n */\ntype OnlyValidKeys<T, Shape> = T extends Shape ? (Exclude<keyof T, keyof Shape> extends never ? T : never) : never\n\nconst instances: Record<string, PostHog> = {}\n\n// some globals for comparisons\nconst __NOOP = () => {}\n\nconst PRIMARY_INSTANCE_NAME = 'posthog'\n\n/*\n * Dynamic... constants? Is that an oxymoron?\n */\n// http://hacks.mozilla.org/2009/07/cross-site-xmlhttprequest-with-cors/\n// https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#withCredentials\n\n// IE<10 does not support cross-origin XHR's but script tags\n// with defer won't block window.onload; ENQUEUE_REQUESTS\n// should only be true for Opera<12\nlet ENQUEUE_REQUESTS = !SUPPORTS_REQUEST && userAgent?.indexOf('MSIE') === -1 && userAgent?.indexOf('Mozilla') === -1\n\nconst defaultsThatVaryByConfig = (\n defaults?: ConfigDefaults\n): Pick<PostHogConfig, 'rageclick' | 'capture_pageview' | 'session_recording'> => ({\n rageclick: defaults && defaults >= '2025-11-30' ? { content_ignorelist: true } : true,\n capture_pageview: defaults && defaults >= '2025-05-24' ? 'history_change' : true,\n session_recording: defaults && defaults >= '2025-11-30' ? { strictMinimumDuration: true } : {},\n})\n\n// NOTE: Remember to update `types.ts` when changing a default value\n// to guarantee documentation is up to date, make sure to also update our website docs\n// NOTE²: This shouldn't ever change because we try very hard to be backwards-compatible\nexport const defaultConfig = (defaults?: ConfigDefaults): PostHogConfig => ({\n api_host: 'https://us.i.posthog.com',\n flags_api_host: null,\n ui_host: null,\n token: '',\n autocapture: true,\n cross_subdomain_cookie: isCrossDomainCookie(document?.location),\n persistence: 'localStorage+cookie', // up to 1.92.0 this was 'cookie'. It's easy to migrate as 'localStorage+cookie' will migrate data from cookie storage\n persistence_name: '',\n loaded: __NOOP,\n save_campaign_params: true,\n custom_campaign_params: [],\n custom_blocked_useragents: [],\n save_referrer: true,\n capture_pageleave: 'if_capture_pageview', // We'll only capture pageleave events if capture_pageview is also true\n defaults: defaults ?? 'unset',\n __preview_deferred_init_extensions: false, // Opt-in only for now\n debug: (location && isString(location?.search) && location.search.indexOf('__posthog_debug=true') !== -1) || false,\n cookie_expiration: 365,\n upgrade: false,\n disable_session_recording: false,\n disable_persistence: false,\n disable_web_experiments: true, // disabled in beta.\n disable_surveys: false,\n disable_surveys_automatic_display: false,\n disable_conversations: false,\n disable_product_tours: true,\n disable_external_dependency_loading: false,\n enable_recording_console_log: undefined, // When undefined, it falls back to the server-side setting\n secure_cookie: window?.location?.protocol === 'https:',\n ip: false,\n opt_out_capturing_by_default: false,\n opt_out_persistence_by_default: false,\n opt_out_useragent_filter: false,\n opt_out_capturing_persistence_type: 'localStorage',\n consent_persistence_name: null,\n opt_out_capturing_cookie_prefix: null,\n opt_in_site_apps: false,\n property_denylist: [],\n respect_dnt: false,\n sanitize_properties: null,\n request_headers: {}, // { header: value, header2: value }\n request_batching: true,\n properties_string_max_length: 65535,\n mask_all_element_attributes: false,\n mask_all_text: false,\n mask_personal_data_properties: false,\n custom_personal_data_properties: [],\n advanced_disable_flags: false,\n advanced_disable_decide: false,\n advanced_disable_feature_flags: false,\n advanced_disable_feature_flags_on_first_load: false,\n advanced_only_evaluate_survey_feature_flags: false,\n advanced_enable_surveys: false,\n advanced_disable_toolbar_metrics: false,\n feature_flag_request_timeout_ms: 3000,\n surveys_request_timeout_ms: SURVEYS_REQUEST_TIMEOUT_MS,\n on_request_error: (res) => {\n const error = 'Bad HTTP status: ' + res.statusCode + ' ' + res.text\n logger.error(error)\n },\n get_device_id: (uuid) => uuid,\n capture_performance: undefined,\n name: 'posthog',\n bootstrap: {},\n disable_compression: false,\n session_idle_timeout_seconds: 30 * 60, // 30 minutes\n person_profiles: 'identified_only',\n before_send: undefined,\n request_queue_config: { flush_interval_ms: DEFAULT_FLUSH_INTERVAL_MS },\n error_tracking: {},\n\n // Used for internal testing\n _onCapture: __NOOP,\n\n // make the default be lazy loading replay\n __preview_eager_load_replay: false,\n\n ...defaultsThatVaryByConfig(defaults),\n})\n\nexport const configRenames = (origConfig: Partial<PostHogConfig>): Partial<PostHogConfig> => {\n const renames: Partial<PostHogConfig> = {}\n if (!isUndefined(origConfig.process_person)) {\n renames.person_profiles = origConfig.process_person\n }\n if (!isUndefined(origConfig.xhr_headers)) {\n renames.request_headers = origConfig.xhr_headers\n }\n if (!isUndefined(origConfig.cookie_name)) {\n renames.persistence_name = origConfig.cookie_name\n }\n if (!isUndefined(origConfig.disable_cookie)) {\n renames.disable_persistence = origConfig.disable_cookie\n }\n if (!isUndefined(origConfig.store_google)) {\n renames.save_campaign_params = origConfig.store_google\n }\n if (!isUndefined(origConfig.verbose)) {\n renames.debug = origConfig.verbose\n }\n // on_xhr_error is not present, as the type is different to on_request_error\n\n // the original config takes priority over the renames\n const newConfig = extend({}, renames, origConfig)\n\n // merge property_blacklist into property_denylist\n if (isArray(origConfig.property_blacklist)) {\n if (isUndefined(origConfig.property_denylist)) {\n newConfig.property_denylist = origConfig.property_blacklist\n } else if (isArray(origConfig.property_denylist)) {\n newConfig.property_denylist = [...origConfig.property_blacklist, ...origConfig.property_denylist]\n } else {\n logger.error('Invalid value for property_denylist config: ' + origConfig.property_denylist)\n }\n }\n\n return newConfig\n}\n\nclass DeprecatedWebPerformanceObserver {\n get _forceAllowLocalhost(): boolean {\n return this.__forceAllowLocalhost\n }\n\n set _forceAllowLocalhost(value: boolean) {\n logger.error(\n 'WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`'\n )\n this.__forceAllowLocalhost = value\n }\n\n private __forceAllowLocalhost: boolean = false\n}\n\n/**\n *\n * This is the SDK reference for the PostHog JavaScript Web SDK.\n * You can learn more about example usage in the\n * [JavaScript Web SDK documentation](/docs/libraries/js).\n * You can also follow [framework specific guides](/docs/frameworks)\n * to integrate PostHog into your project.\n *\n * This SDK is designed for browser environments.\n * Use the PostHog [Node.js SDK](/docs/libraries/node) for server-side usage.\n *\n * @constructor\n */\nexport class PostHog {\n __loaded: boolean\n config: PostHogConfig\n _originalUserConfig?: Partial<PostHogConfig>\n\n rateLimiter: RateLimiter\n scrollManager: ScrollManager\n pageViewManager: PageViewManager\n featureFlags: PostHogFeatureFlags\n surveys: PostHogSurveys\n conversations: PostHogConversations\n experiments: WebExperiments\n toolbar: Toolbar\n exceptions: PostHogExceptions\n consent: ConsentManager\n\n // These are instance-specific state created after initialisation\n persistence?: PostHogPersistence\n sessionPersistence?: PostHogPersistence\n sessionManager?: SessionIdManager\n sessionPropsManager?: SessionPropsManager\n requestRouter: RequestRouter\n siteApps?: SiteApps\n autocapture?: Autocapture\n heatmaps?: Heatmaps\n webVitalsAutocapture?: WebVitalsAutocapture\n exceptionObserver?: ExceptionObserver\n deadClicksAutocapture?: DeadClicksAutocapture\n historyAutocapture?: HistoryAutocapture\n productTours?: PostHogProductTours\n\n _requestQueue?: RequestQueue\n _retryQueue?: RetryQueue\n sessionRecording?: SessionRecording\n externalIntegrations?: ExternalIntegrations\n webPerformance = new DeprecatedWebPerformanceObserver()\n\n _initialPageviewCaptured: boolean\n _visibilityStateListener: (() => void) | null\n _personProcessingSetOncePropertiesSent: boolean = false\n _triggered_notifs: any\n compression?: Compression\n __request_queue: QueuedRequestWithOptions[]\n _pendingRemoteConfig?: RemoteConfig\n analyticsDefaultEndpoint: string\n version = Config.LIB_VERSION\n _initialPersonProfilesConfig: 'always' | 'never' | 'identified_only' | null\n _cachedPersonProperties: string | null\n\n SentryIntegration: typeof SentryIntegration\n sentryIntegration: (options?: SentryIntegrationOptions) => ReturnType<typeof sentryIntegration>\n\n private _internalEventEmitter = new SimpleEventEmitter()\n\n // Legacy property to support existing usage - this isn't technically correct but it's what it has always been - a proxy for flags being loaded\n /** @deprecated Use `flagsEndpointWasHit` instead. We migrated to using a new feature flag endpoint and the new method is more semantically accurate */\n public get decideEndpointWasHit(): boolean {\n return this.featureFlags?.hasLoadedFlags ?? false\n }\n\n public get flagsEndpointWasHit(): boolean {\n return this.featureFlags?.hasLoadedFlags ?? false\n }\n\n /** DEPRECATED: We keep this to support existing usage but now one should just call .setPersonProperties */\n people: {\n set: (prop: string | Properties, to?: string, callback?: RequestCallback) => void\n set_once: (prop: string | Properties, to?: string, callback?: RequestCallback) => void\n }\n\n constructor() {\n this.config = defaultConfig()\n\n this.SentryIntegration = SentryIntegration\n this.sentryIntegration = (options?: SentryIntegrationOptions) => sentryIntegration(this, options)\n this.__request_queue = []\n this.__loaded = false\n this.analyticsDefaultEndpoint = '/e/'\n this._initialPageviewCaptured = false\n this._visibilityStateListener = null\n this._initialPersonProfilesConfig = null\n this._cachedPersonProperties = null\n this.featureFlags = new PostHogFeatureFlags(this)\n this.toolbar = new Toolbar(this)\n this.scrollManager = new ScrollManager(this)\n this.pageViewManager = new PageViewManager(this)\n this.surveys = new PostHogSurveys(this)\n this.conversations = new PostHogConversations(this)\n this.experiments = new WebExperiments(this)\n this.exceptions = new PostHogExceptions(this)\n this.rateLimiter = new RateLimiter(this)\n this.requestRouter = new RequestRouter(this)\n this.consent = new ConsentManager(this)\n this.externalIntegrations = new ExternalIntegrations(this)\n // NOTE: See the property definition for deprecation notice\n this.people = {\n set: (prop: string | Properties, to?: string, callback?: RequestCallback) => {\n const setProps = isString(prop) ? { [prop]: to } : prop\n this.setPersonProperties(setProps)\n callback?.({} as any)\n },\n set_once: (prop: string | Properties, to?: string, callback?: RequestCallback) => {\n const setProps = isString(prop) ? { [prop]: to } : prop\n this.setPersonProperties(undefined, setProps)\n callback?.({} as any)\n },\n }\n\n this.on('eventCaptured', (data) => logger.info(`send \"${data?.event}\"`, data))\n }\n\n // Initialization methods\n\n /**\n * Initializes a new instance of the PostHog capturing object.\n *\n * @remarks\n * All new instances are added to the main posthog object as sub properties (such as\n * `posthog.library_name`) and also returned by this function. [Learn more about configuration options](https://github.com/posthog/posthog-js/blob/6e0e873/src/posthog-core.js#L57-L91)\n *\n * @example\n * ```js\n * // basic initialization\n * posthog.init('<ph_project_api_key>', {\n * api_host: '<ph_client_api_host>'\n * })\n * ```\n *\n * @example\n * ```js\n * // multiple instances\n * posthog.init('<ph_project_api_key>', {}, 'project1')\n * posthog.init('<ph_project_api_key>', {}, 'project2')\n * ```\n *\n * @public\n *\n * @param token - Your PostHog API token\n * @param config - A dictionary of config options to override\n * @param name - The name for the new posthog instance that you want created\n *\n * {@label Initialization}\n *\n * @returns The newly initialized PostHog instance\n */\n init(\n token: string,\n config?: OnlyValidKeys<Partial<PostHogConfig>, Partial<PostHogConfig>>,\n name?: string\n ): PostHog {\n if (!name || name === PRIMARY_INSTANCE_NAME) {\n // This means we are initializing the primary instance (i.e. this)\n return this._init(token, config, name)\n } else {\n const namedPosthog = instances[name] ?? new PostHog()\n namedPosthog._init(token, config, name)\n instances[name] = namedPosthog\n\n // Add as a property to the primary instance (this isn't type-safe but it is how it was always done)\n ;(instances[PRIMARY_INSTANCE_NAME] as any)[name] = namedPosthog\n\n return namedPosthog\n }\n }\n\n // posthog._init(token:string, config:object, name:string)\n //\n // This function sets up the current instance of the posthog\n // library. The difference between this method and the init(...)\n // method is this one initializes the actual instance, whereas the\n // init(...) method sets up a new library and calls _init on it.\n //\n // Note that there are operations that can be asynchronous, so we\n // accept a callback that is called when all the asynchronous work\n // is done. Note that we do not use promises because we want to be\n // IE11 compatible. We could use polyfills, which would make the\n // code a bit cleaner, but will add some overhead.\n //\n _init(token: string, config: Partial<PostHogConfig> = {}, name?: string): PostHog {\n if (isUndefined(token) || isEmptyString(token)) {\n logger.critical(\n 'PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()'\n )\n return this\n }\n\n if (this.__loaded) {\n // need to be able to log before having processed debug config\n // eslint-disable-next-line no-console\n console.warn('[PostHog.js]', 'You have already initialized PostHog! Re-initializing is a no-op')\n return this\n }\n\n this.__loaded = true\n this.config = {} as PostHogConfig // will be set right below\n config.debug = this._checkLocalStorageForDebug(config.debug)\n this._originalUserConfig = config // Store original user config for migration\n\n this._triggered_notifs = []\n\n if (config.person_profiles) {\n this._initialPersonProfilesConfig = config.person_profiles\n }\n\n this.set_config(\n extend({}, defaultConfig(config.defaults), configRenames(config), {\n name: name,\n token: token,\n })\n )\n\n if (this.config.on_xhr_error) {\n logger.error('on_xhr_error is deprecated. Use on_request_error instead')\n }\n\n this.compression = config.disable_compression ? undefined : Compression.GZipJS\n\n const persistenceDisabled = this._is_persistence_disabled()\n\n this.persistence = new PostHogPersistence(this.config, persistenceDisabled)\n this.sessionPersistence =\n this.config.persistence === 'sessionStorage' || this.config.persistence === 'memory'\n ? this.persistence\n : new PostHogPersistence({ ...this.config, persistence: 'sessionStorage' }, persistenceDisabled)\n\n // should I store the initial person profiles config in persistence?\n const initialPersistenceProps = { ...this.persistence.props }\n const initialSessionProps = { ...this.sessionPersistence.props }\n\n this.register({ $initialization_time: new Date().toISOString() })\n\n this._requestQueue = new RequestQueue(\n (req) => this._send_retriable_request(req),\n this.config.request_queue_config\n )\n this._retryQueue = new RetryQueue(this)\n this.__request_queue = []\n\n const startInCookielessMode =\n this.config.cookieless_mode === 'always' ||\n (this.config.cookieless_mode === 'on_reject' && this.consent.isExplicitlyOptedOut())\n\n if (!startInCookielessMode) {\n this.sessionManager = new SessionIdManager(this)\n this.sessionPropsManager = new SessionPropsManager(this, this.sessionManager, this.persistence)\n }\n\n // Conditionally defer extension initialization based on config\n if (this.config.__preview_deferred_init_extensions) {\n // EXPERIMENTAL: Defer non-critical extension initialization to next tick\n // This reduces main thread blocking during init\n // while keeping critical path (persistence, sessions, capture) synchronous\n logger.info('Deferring extension initialization to improve startup performance')\n setTimeout(() => {\n this._initExtensions(startInCookielessMode)\n }, 0)\n } else {\n // Legacy synchronous initialization (default for now)\n logger.info('Initializing extensions synchronously')\n this._initExtensions(startInCookielessMode)\n }\n\n // if any instance on the page has debug = true, we set the\n // global debug to be true\n Config.DEBUG = Config.DEBUG || this.config.debug\n if (Config.DEBUG) {\n logger.info('Starting in debug mode', {\n this: this,\n config,\n thisC: { ...this.config },\n p: initialPersistenceProps,\n s: initialSessionProps,\n })\n }\n\n // isUndefined doesn't provide typehint here so wouldn't reduce bundle as we'd need to assign\n // eslint-disable-next-line posthog-js/no-direct-undefined-check\n if (config.bootstrap?.distinctID !== undefined) {\n const uuid = this.config.get_device_id(uuidv7())\n const deviceID = config.bootstrap?.isIdentifiedID ? uuid : config.bootstrap.distinctID\n this.persistence.set_property(USER_STATE, config.bootstrap?.isIdentifiedID ? 'identified' : 'anonymous')\n this.register({\n distinct_id: config.bootstrap.distinctID,\n $device_id: deviceID,\n })\n }\n\n if (this._hasBootstrappedFeatureFlags()) {\n const activeFlags = Object.keys(config.bootstrap?.featureFlags || {})\n .filter((flag) => !!config.bootstrap?.featureFlags?.[flag])\n .reduce((res: Record<string, string | boolean>, key) => {\n res[key] = config.bootstrap?.featureFlags?.[key] || false\n return res\n }, {})\n const featureFlagPayloads = Object.keys(config.bootstrap?.featureFlagPayloads || {})\n .filter((key) => activeFlags[key])\n .reduce((res: Record<string, JsonType>, key) => {\n if (config.bootstrap?.featureFlagPayloads?.[key]) {\n res[key] = config.bootstrap?.featureFlagPayloads?.[key]\n }\n return res\n }, {})\n\n this.featureFlags.receivedFeatureFlags({ featureFlags: activeFlags, featureFlagPayloads })\n }\n\n if (startInCookielessMode) {\n this.register_once(\n {\n distinct_id: COOKIELESS_SENTINEL_VALUE,\n $device_id: null,\n },\n ''\n )\n } else if (!this.get_distinct_id()) {\n // There is no need to set the distinct id\n // or the device id if something was already stored\n // in the persistence\n const uuid = this.config.get_device_id(uuidv7())\n\n this.register_once(\n {\n distinct_id: uuid,\n $device_id: uuid,\n },\n ''\n )\n // distinct id == $device_id is a proxy for anonymous user\n this.persistence.set_property(USER_STATE, 'anonymous')\n }\n // Set up event handler for pageleave\n // Use `onpagehide` if available, see https://calendar.perfplanet.com/2020/beaconing-in-practice/#beaconing-reliability-avoiding-abandons\n //\n // Not making it passive to try and force the browser to handle this before the page is unloaded\n addEventListener(window, 'onpagehide' in self ? 'pagehide' : 'unload', this._handle_unload.bind(this), {\n passive: false,\n })\n\n this.toolbar.maybeLoadToolbar()\n\n // We want to avoid promises for IE11 compatibility, so we use callbacks here\n if (config.segment) {\n setupSegmentIntegration(this, () => this._loaded())\n } else {\n this._loaded()\n }\n\n if (isFunction(this.config._onCapture) && this.config._onCapture !== __NOOP) {\n logger.warn('onCapture is deprecated. Please use `before_send` instead')\n this.on('eventCaptured', (data) => this.config._onCapture(data.event, data))\n }\n\n if (this.config.ip) {\n logger.warn(\n 'The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or \"Discard IP data\" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'\n )\n }\n\n return this\n }\n\n private _initExtensions(startInCookielessMode: boolean): void {\n // we don't support IE11 anymore, so performance.now is safe\n // eslint-disable-next-line compat/compat\n const initStartTime = performance.now()\n\n this.historyAutocapture = new HistoryAutocapture(this)\n this.historyAutocapture.startIfEnabled()\n\n // Build queue of extension initialization tasks\n const initTasks: Array<() => void> = []\n\n initTasks.push(() => {\n new TracingHeaders(this).startIfEnabledOrStop()\n })\n\n initTasks.push(() => {\n this.siteApps = new SiteApps(this)\n this.siteApps?.init()\n })\n\n if (!startInCookielessMode) {\n initTasks.push(() => {\n this.sessionRecording = new SessionRecording(this)\n this.sessionRecording.startIfEnabledOrStop()\n })\n }\n\n if (!this.config.disable_scroll_properties) {\n initTasks.push(() => {\n this.scrollManager.startMeasuringScrollPosition()\n })\n }\n\n initTasks.push(() => {\n this.autocapture = new Autocapture(this)\n this.autocapture.startIfEnabled()\n })\n\n initTasks.push(() => {\n this.surveys.loadIfEnabled()\n })\n\n initTasks.push(() => {\n this.conversations.loadIfEnabled()\n })\n\n initTasks.push(() => {\n this.productTours = new PostHogProductTours(this)\n this.productTours.loadIfEnabled()\n })\n\n initTasks.push(() => {\n this.heatmaps = new Heatmaps(this)\n this.heatmaps.startIfEnabled()\n })\n\n initTasks.push(() => {\n this.webVitalsAutocapture = new WebVitalsAutocapture(this)\n })\n\n initTasks.push(() => {\n this.exceptionObserver = new ExceptionObserver(this)\n this.exceptionObserver.startIfEnabledOrStop()\n })\n\n initTasks.push(() => {\n this.deadClicksAutocapture = new DeadClicksAutocapture(this, isDeadClicksEnabledForAutocapture)\n this.deadClicksAutocapture.startIfEnabled()\n })\n\n // Replay any pending remote config that arrived before extensions were ready\n initTasks.push(() => {\n if (this._pendingRemoteConfig) {\n const config = this._pendingRemoteConfig\n this._pendingRemoteConfig = undefined // Clear before replaying to avoid re-storing\n this._onRemoteConfig(config)\n }\n })\n\n // Process tasks with time-slicing to avoid blocking\n this._processInitTaskQueue(initTasks, initStartTime)\n }\n\n private _processInitTaskQueue(queue: Array<() => void>, initStartTime: number): void {\n const TIME_BUDGET_MS = 30 // Respect frame budget (~60fps = 16ms, but we're already deferred)\n\n while (queue.length > 0) {\n // Only time-slice if deferred init is enabled, otherwise run synchronously\n if (this.config.__preview_deferred_init_extensions) {\n // we don't support IE11 anymore, so performance.now is safe\n // eslint-disable-next-line compat/compat\n const elapsed = performance.now() - initStartTime\n\n // Check if we've exceeded our time budget\n if (elapsed >= TIME_BUDGET_MS && queue.length > 0) {\n // Yield to browser, then continue processing\n setTimeout(() => {\n this._processInitTaskQueue(queue, initStartTime)\n }, 0)\n return\n }\n }\n\n // Process next task\n const task = queue.shift()\n if (task) {\n try {\n task()\n } catch (error) {\n logger.error('Error initializing extension:', error)\n }\n }\n }\n\n // All tasks complete - record timing for both sync and deferred modes\n // we don't support IE11 anymore, so performance.now is safe\n // eslint-disable-next-line compat/compat\n const taskInitTiming = Math.round(performance.now() - initStartTime)\n this.register_for_session({\n $sdk_debug_extensions_init_method: this.config.__preview_deferred_init_extensions\n ? 'deferred'\n : 'synchronous',\n $sdk_debug_extensions_init_time_ms: taskInitTiming,\n })\n if (this.config.__preview_deferred_init_extensions) {\n logger.info(`PostHog extensions initialized (${taskInitTiming}ms)`)\n }\n }\n\n _onRemoteConfig(config: RemoteConfig) {\n if (!(document && document.body)) {\n logger.info('document not ready yet, trying again in 500 milliseconds...')\n setTimeout(() => {\n this._onRemoteConfig(config)\n }, 500)\n return\n }\n\n // Store config in case extensions aren't initialized yet (only needed for deferred init)\n if (this.config.__preview_deferred_init_extensions) {\n this._pendingRemoteConfig = config\n }\n\n this.compression = undefined\n if (config.supportedCompression && !this.config.disable_compression) {\n this.compression = includes(config['supportedCompression'], Compression.GZipJS)\n ? Compression.GZipJS\n : includes(config['supportedCompression'], Compression.Base64)\n ? Compression.Base64\n : undefined\n }\n\n if (config.analytics?.endpoint) {\n this.analyticsDefaultEndpoint = config.analytics.endpoint\n }\n\n this.set_config({\n person_profiles: this._initialPersonProfilesConfig ? this._initialPersonProfilesConfig : 'identified_only',\n })\n\n this.siteApps?.onRemoteConfig(config)\n this.sessionRecording?.onRemoteConfig(config)\n this.autocapture?.onRemoteConfig(config)\n this.heatmaps?.onRemoteConfig(config)\n this.surveys.onRemoteConfig(config)\n this.conversations.onRemoteConfig(config)\n this.productTours?.onRemoteConfig(config)\n this.webVitalsAutocapture?.onRemoteConfig(config)\n this.exceptionObserver?.onRemoteConfig(config)\n this.exceptions.onRemoteConfig(config)\n this.deadClicksAutocapture?.onRemoteConfig(config)\n }\n\n _loaded(): void {\n try {\n this.config.loaded(this)\n } catch (err) {\n logger.critical('`loaded` function failed', err)\n }\n\n this._start_queue_if_opted_in()\n\n // this happens after \"loaded\" so a user can call identify or any other things before the pageview fires\n if (this.config.capture_pageview) {\n // NOTE: We want to fire this on the next tick as the previous implementation had this side effect\n // and some clients may rely on it\n setTimeout(() => {\n if (this.consent.isOptedIn() || this.config.cookieless_mode === 'always') {\n this._captureInitialPageview()\n }\n }, 1)\n }\n\n new RemoteConfigLoader(this).load()\n this.featureFlags.flags()\n }\n\n _start_queue_if_opted_in(): void {\n if (this.is_capturing()) {\n if (this.config.request_batching) {\n this._requestQueue?.enable()\n }\n }\n }\n\n _dom_loaded(): void {\n if (this.is_capturing()) {\n eachArray(this.__request_queue, (item) => this._send_retriable_request(item))\n }\n\n this.__request_queue = []\n this._start_queue_if_opted_in()\n }\n\n _handle_unload(): void {\n this.surveys.handlePageUnload()\n\n if (!this.config.request_batching) {\n if (this._shouldCapturePageleave()) {\n this.capture('$pageleave', null, { transport: 'sendBeacon' })\n }\n return\n }\n\n if (this._shouldCapturePageleave()) {\n this.capture('$pageleave')\n }\n\n this._requestQueue?.unload()\n this._retryQueue?.unload()\n }\n\n _send_request(options: QueuedRequestWithOptions): void {\n if (!this.__loaded) {\n return\n }\n\n if (ENQUEUE_REQUESTS) {\n this.__request_queue.push(options)\n return\n }\n\n if (this.rateLimiter.isServerRateLimited(options.batchKey)) {\n return\n }\n\n options.transport = options.transport || this.config.api_transport\n options.url = extendURLParams(options.url, {\n // Whether to detect ip info or not\n ip: this.config.ip ? 1 : 0,\n })\n options.headers = {\n ...this.config.request_headers,\n ...options.headers,\n }\n options.compression = options.compression === 'best-available' ? this.compression : options.compression\n options.disableXHRCredentials = this.config.__preview_disable_xhr_credentials\n if (this.config.__preview_disable_beacon) {\n options.disableTransport = ['sendBeacon']\n }\n\n // Specially useful if you're doing SSR with NextJS\n // Users must be careful when tweaking `cache` because they might get out-of-date feature flags\n options.fetchOptions = options.fetchOptions || this.config.fetch_options\n\n request({\n ...options,\n callback: (response) => {\n this.rateLimiter.checkForLimiting(response)\n\n if (response.statusCode >= 400) {\n this.config.on_request_error?.(response)\n }\n\n options.callback?.(response)\n },\n })\n }\n\n _send_retriable_request(options: QueuedRequestWithOptions): void {\n if (this._retryQueue) {\n this._retryQueue.retriableRequest(options)\n } else {\n this._send_request(options)\n }\n }\n\n /**\n * _execute_array() deals with processing any posthog function\n * calls that were called before the PostHog library were loaded\n * (and are thus stored in an array so they can be called later)\n *\n * Note: we fire off all the posthog function calls && user defined\n * functions BEFORE we fire off posthog capturing calls. This is so\n * identify/register/set_config calls can properly modify early\n * capturing calls.\n *\n * @param {Array} array\n */\n _execute_array(array: SnippetArrayItem[]): void {\n let fn_name\n const alias_calls: SnippetArrayItem[] = []\n const other_calls: SnippetArrayItem[] = []\n const capturing_calls: SnippetArrayItem[] = []\n eachArray(array, (item) => {\n if (item) {\n fn_name = item[0]\n if (isArray(fn_name)) {\n capturing_calls.push(item) // chained call e.g. posthog.get_group().set()\n } else if (isFunction(item)) {\n ;(item as any).call(this)\n } else if (isArray(item) && fn_name === 'alias') {\n alias_calls.push(item)\n } else if (isArray(item) && fn_name.indexOf('capture') !== -1 && isFunction((this as any)[fn_name])) {\n capturing_calls.push(item)\n } else {\n other_calls.push(item)\n }\n }\n })\n\n const execute = function (calls: SnippetArrayItem[], thisArg: any) {\n eachArray(\n calls,\n function (item) {\n if (isArray(item[0])) {\n // chained call\n let caller = thisArg\n each(item, function (call) {\n caller = caller[call[0]].apply(caller, call.slice(1))\n })\n } else {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this[item[0]].apply(this, item.slice(1))\n }\n },\n thisArg\n )\n }\n\n execute(alias_calls, this)\n execute(other_calls, this)\n execute(capturing_calls, this)\n }\n\n _hasBootstrappedFeatureFlags(): boolean {\n return (\n (this.config.bootstrap?.featureFlags && Object.keys(this.config.bootstrap?.featureFlags).length > 0) ||\n false\n )\n }\n\n /**\n * push() keeps the standard async-array-push\n * behavior around after the lib is loaded.\n * This is only useful for external integrations that\n * do not wish to rely on our convenience methods\n * (created in the snippet).\n *\n * @example\n * ```js\n * posthog.push(['register', { a: 'b' }]);\n * ```\n *\n * @param {Array} item A [function_name, args...] array to be executed\n */\n push(item: SnippetArrayItem): void {\n this._execute_array([item])\n }\n\n /**\n * Captures an event with optional properties and configuration.\n *\n * @remarks\n * You can capture arbitrary object-like values as events. [Learn about capture best practices](/docs/product-analytics/capture-events)\n *\n * @example\n * ```js\n * // basic event capture\n * posthog.capture('cta-button-clicked', {\n * button_name: 'Get Started',\n * page: 'homepage'\n * })\n * ```\n *\n * {@label Capture}\n *\n * @public\n *\n * @param event_name - The name of the event (e.g., 'Sign Up', 'Button Click', 'Purchase')\n * @param properties - Properties to include with the event describing the user or event details\n * @param options - Optional configuration for the capture request\n *\n * @returns The capture result containing event data, or undefined if capture failed\n */\n capture(\n event_name: EventName,\n properties?: Properties | null,\n options?: CaptureOptions\n ): CaptureResult | undefined {\n // While developing, a developer might purposefully _not_ call init(),\n // in this case, we would like capture to be a noop.\n if (!this.__loaded || !this.persistence || !this.sessionPersistence || !this._requestQueue) {\n logger.uninitializedWarning('posthog.capture')\n return\n }\n\n if (!this.is_capturing()) {\n return\n }\n\n // typing doesn't prevent interesting data\n if (isUndefined(event_name) || !isString(event_name)) {\n logger.error('No event name provided to posthog.capture')\n return\n }\n\n const isBot = !this.config.opt_out_useragent_filter && this._is_bot()\n const shouldDropBotEvent = isBot && !this.config.__preview_capture_bot_pageviews\n\n // We drop bot events unless the preview flag to send bot pageviews is enabled\n // or the user has explicitly opted out of useragent filtering\n if (shouldDropBotEvent) {\n return\n }\n\n const clientRateLimitContext = !options?.skip_client_rate_limiting\n ? this.rateLimiter.clientRateLimitContext()\n : undefined\n\n if (clientRateLimitContext?.isRateLimited) {\n logger.critical('This capture call is ignored due to client rate limiting.')\n return\n }\n\n if (properties?.$current_url && !isString(properties?.$current_url)) {\n logger.error(\n 'Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value.'\n )\n delete properties?.$current_url\n }\n\n // update persistence\n this.sessionPersistence.update_search_keyword()\n\n // The initial campaign/referrer props need to be stored in the regular persistence, as they are there to mimic\n // the person-initial props. The non-initial versions are stored in the sessionPersistence, as they are sent\n // with every event and used by the session table to create session-initial props.\n if (this.config.save_campaign_params) {\n this.sessionPersistence.update_campaign_params()\n }\n if (this.config.save_referrer) {\n this.sessionPersistence.update_referrer_info()\n }\n\n if (this.config.save_campaign_params || this.config.save_referrer) {\n this.persistence.set_initial_person_info()\n }\n\n const systemTime = new Date()\n const timestamp = options?.timestamp || systemTime\n\n const uuid = uuidv7()\n let data: CaptureResult = {\n uuid,\n event: event_name,\n properties: this.calculateEventProperties(event_name, properties || {}, timestamp, uuid),\n }\n\n // Route pageviews to $bot_pageview when bot detected and preview flag enabled\n if (event_name === '$pageview' && this.config.__preview_capture_bot_pageviews && isBot) {\n data.event = '$bot_pageview'\n // While it's obvious that a $bot_pageview is (likely) from a bot, we explicitly set $browser_type\n // to make it easy to filter and test bot pageviews in the product\n data.properties.$browser_type = 'bot'\n }\n\n if (clientRateLimitContext) {\n data.properties['$lib_rate_limit_remaining_tokens'] = clientRateLimitContext.remainingTokens\n }\n\n const setProperties = options?.$set\n if (setProperties) {\n data.$set = options?.$set\n }\n // $groupidentify doesn't process person $set_once on the server, so don't mark\n // initial person props as sent. This ensures they're included with subsequent\n // $identify calls.\n const markSetOnceAsSent = event_name !== '$groupidentify'\n const setOnceProperties = this._calculate_set_once_properties(options?.$set_once, markSetOnceAsSent)\n if (setOnceProperties) {\n data.$set_once = setOnceProperties\n }\n\n data = _copyAndTruncateStrings(data, options?._noTruncate ? null : this.config.properties_string_max_length)\n data.timestamp = timestamp\n if (!isUndefined(options?.timestamp)) {\n data.properties['$event_time_override_provided'] = true\n data.properties['$event_time_override_system_time'] = systemTime\n }\n\n if (event_name === SurveyEventName.DISMISSED || event_name === SurveyEventName.SENT) {\n const surveyId = properties?.[SurveyEventProperties.SURVEY_ID]\n const surveyIteration = properties?.[SurveyEventProperties.SURVEY_ITERATION]\n setSurveySeenOnLocalStorage({ id: surveyId, current_iteration: surveyIteration })\n data.$set = {\n ...data.$set,\n [getSurveyInteractionProperty(\n { id: surveyId, current_iteration: surveyIteration },\n event_name === SurveyEventName.SENT ? 'responded' : 'dismissed'\n )]: true,\n }\n }\n\n // Top-level $set overriding values from the one from properties is taken from the plugin-server normalizeEvent\n // This doesn't handle $set_once, because posthog-people doesn't either\n const finalSet = { ...data.properties['$set'], ...data['$set'] }\n if (!isEmptyObject(finalSet)) {\n this.setPersonPropertiesForFlags(finalSet)\n }\n\n if (!isNullish(this.config.before_send)) {\n const beforeSendResult = this._runBeforeSend(data)\n if (!beforeSendResult) {\n return\n } else {\n data = beforeSendResult\n }\n }\n\n this._internalEventEmitter.emit('eventCaptured', data)\n\n const requestOptions: QueuedRequestWithOptions = {\n method: 'POST',\n url: options?._url ?? this.requestRouter.endpointFor('api', this.analyticsDefaultEndpoint),\n data,\n compression: 'best-available',\n batchKey: options?._batchKey,\n }\n\n if (this.config.request_batching && (!options || options?._batchKey) && !options?.send_instantly) {\n this._requestQueue.enqueue(requestOptions)\n } else {\n this._send_retriable_request(requestOptions)\n }\n\n return data\n }\n\n _addCaptureHook(callback: (eventName: string, eventPayload?: CaptureResult) => void): () => void {\n return this.on('eventCaptured', (data) => callback(data.event, data))\n }\n\n /**\n * This method is used internally to calculate the event properties before sending it to PostHog. It can also be\n * used by integrations (e.g. Segment) to enrich events with PostHog properties before sending them to Segment,\n * which is required for some PostHog products to work correctly. (e.g. to have a correct $session_id property).\n *\n * @param {String} eventName The name of the event. This can be anything the user does - 'Button Click', 'Sign Up', '$pageview', etc.\n * @param {Object} eventProperties The properties to include with the event.\n * @param {Date} [timestamp] The timestamp of the event, e.g. for calculating time on page. If not set, it'll automatically be set to the current time.\n * @param {String} [uuid] The uuid of the event, e.g. for storing the $pageview ID.\n * @param {Boolean} [readOnly] Set this if you do not intend to actually send the event, and therefore do not want to update internal state e.g. session timeout\n *\n * @internal\n */\n public calculateEventProperties(\n eventName: string,\n eventProperties: Properties,\n timestamp?: Date,\n uuid?: string,\n readOnly?: boolean\n ): Properties {\n timestamp = timestamp || new Date()\n if (!this.persistence || !this.sessionPersistence) {\n return eventProperties\n }\n\n // set defaults\n const startTimestamp = readOnly ? undefined : this.persistence.remove_event_timer(eventName)\n let properties = { ...eventProperties }\n properties['token'] = this.config.token\n properties['$config_defaults'] = this.config.defaults\n\n if (\n this.config.cookieless_mode == 'always' ||\n (this.config.cookieless_mode == 'on_reject' && this.consent.isExplicitlyOptedOut())\n ) {\n // Set a flag to tell the plugin server to use cookieless server hash mode\n properties[COOKIELESS_MODE_FLAG_PROPERTY] = true\n }\n\n if (eventName === '$snapshot') {\n const persistenceProps = { ...this.persistence.properties(), ...this.sessionPersistence.properties() }\n properties['distinct_id'] = persistenceProps.distinct_id\n if (\n // we spotted one customer that was managing to send `false` for ~9k events a day\n !(isString(properties['distinct_id']) || isNumber(properties['distinct_id'])) ||\n isEmptyString(properties['distinct_id'])\n ) {\n logger.error('Invalid distinct_id for replay event. This indicates a bug in your implementation')\n }\n return properties\n }\n\n const infoProperties = getEventProperties(\n this.config.mask_personal_data_properties,\n this.config.custom_personal_data_properties\n )\n\n if (this.sessionManager) {\n const { sessionId, windowId } = this.sessionManager.checkAndGetSessionAndWindowId(\n readOnly,\n timestamp.getTime()\n )\n properties['$session_id'] = sessionId\n properties['$window_id'] = windowId\n }\n if (this.sessionPropsManager) {\n extend(properties, this.sessionPropsManager.getSessionProps())\n }\n\n try {\n if (this.sessionRecording) {\n extend(properties, this.sessionRecording.sdkDebugProperties)\n }\n properties['$sdk_debug_retry_queue_size'] = this._retryQueue?.length\n } catch (e: any) {\n properties['$sdk_debug_error_capturing_properties'] = String(e)\n }\n\n if (this.requestRouter.region === RequestRouterRegion.CUSTOM) {\n properties['$lib_custom_api_host'] = this.config.api_host\n }\n\n let pageviewProperties: Record<string, any>\n if (eventName === '$pageview' && !readOnly) {\n pageviewProperties = this.pageViewManager.doPageView(timestamp, uuid)\n } else if (eventName === '$pageleave' && !readOnly) {\n pageviewProperties = this.pageViewManager.doPageLeave(timestamp)\n } else {\n pageviewProperties = this.pageViewManager.doEvent()\n }\n properties = extend(properties, pageviewProperties)\n\n if (eventName === '$pageview' && document) {\n properties['title'] = document.title\n }\n\n // set $duration if time_event was previously called for this event\n if (!isUndefined(startTimestamp)) {\n const duration_in_ms = timestamp.getTime() - startTimestamp\n properties['$duration'] = parseFloat((duration_in_ms / 1000).toFixed(3))\n }\n\n // this is only added when this.config.opt_out_useragent_filter is true,\n // or it would always add \"browser\"\n if (userAgent && this.config.opt_out_useragent_filter) {\n properties['$browser_type'] = this._is_bot() ? 'bot' : 'browser'\n }\n\n // note: extend writes to the first object, so lets make sure we\n // don't write to the persistence properties object and info\n // properties object by passing in a new object\n\n // update properties with pageview info and super-properties\n properties = extend(\n {},\n infoProperties,\n this.persistence.properties(),\n this.sessionPersistence.properties(),\n properties\n )\n\n properties['$is_identified'] = this._isIdentified()\n\n if (isArray(this.config.property_denylist)) {\n each(this.config.property_denylist, function (denylisted_prop) {\n delete properties[denylisted_prop]\n })\n } else {\n logger.error(\n 'Invalid value for property_denylist config: ' +\n this.config.property_denylist +\n ' or property_blacklist config: ' +\n this.config.property_blacklist\n )\n }\n\n const sanitize_properties = this.config.sanitize_properties\n if (sanitize_properties) {\n logger.error('sanitize_properties is deprecated. Use before_send instead')\n properties = sanitize_properties(properties, eventName)\n }\n\n // add person processing flag as very last step, so it cannot be overridden\n const hasPersonProcessing = this._hasPersonProcessing()\n properties['$process_person_profile'] = hasPersonProcessing\n // if the event has person processing, ensure that all future events will too, even if the setting changes\n if (hasPersonProcessing && !readOnly) {\n this._requirePersonProcessing('_calculate_event_properties')\n }\n\n return properties\n }\n\n /** @deprecated - deprecated in 1.241.0, use `calculateEventProperties` instead */\n _calculate_event_properties = this.calculateEventProperties.bind(this)\n\n /**\n * Add additional set_once properties to the event when creating a person profile. This allows us to create the\n * profile with mostly-accurate properties, despite earlier events not setting them. We do this by storing them in\n * persistence.\n * @param dataSetOnce\n * @param markAsSent - if true, marks the properties as sent so they won't be included in future events.\n * Set to false for events like $groupidentify where the server doesn't process person props.\n */\n _calculate_set_once_properties(dataSetOnce?: Properties, markAsSent: boolean = true): Properties | undefined {\n if (!this.persistence || !this._hasPersonProcessing()) {\n return dataSetOnce\n }\n\n if (this._personProcessingSetOncePropertiesSent) {\n // We only need to send these properties once. Sending them with later events would be redundant and would\n // just require extra work on the server to process them.\n return dataSetOnce\n }\n // if we're an identified person, send initial params with every event\n const initialProps = this.persistence.get_initial_props()\n const sessionProps = this.sessionPropsManager?.getSetOnceProps()\n let setOnceProperties = extend({}, initialProps, sessionProps || {}, dataSetOnce || {})\n const sanitize_properties = this.config.sanitize_properties\n if (sanitize_properties) {\n logger.error('sanitize_properties is deprecated. Use before_send instead')\n setOnceProperties = sanitize_properties(setOnceProperties, '$set_once')\n }\n if (markAsSent) {\n this._personProcessingSetOncePropertiesSent = true\n }\n if (isEmptyObject(setOnceProperties)) {\n return undefined\n }\n return setOnceProperties\n }\n\n /**\n * Registers super properties that are included with all events.\n *\n * @remarks\n * Super properties are stored in persistence and automatically added to every event you capture.\n * These values will overwrite any existing super properties with the same keys.\n *\n * @example\n * ```js\n * // register a single property\n * posthog.register({ plan: 'premium' })\n * ```\n *\n * {@label Capture}\n *\n * @example\n * ```js\n * // register multiple properties\n * posthog.register({\n * email: 'user@example.com',\n * account_type: 'business',\n * signup_date: '2023-01-15'\n * })\n * ```\n *\n * @example\n * ```js\n * // register with custom expiration\n * posthog.register({ campaign: 'summer_sale' }, 7) // expires in 7 days\n * ```\n *\n * @public\n *\n * @param {Object} properties properties to store about the user\n * @param {Number} [days] How many days since the user's last visit to store the super properties\n */\n register(properties: Properties, days?: number): void {\n this.persistence?.register(properties, days)\n }\n\n /**\n * Registers super properties only if they haven't been set before.\n *\n * @remarks\n * Unlike `register()`, this method will not overwrite existing super properties.\n * Use this for properties that should only be set once, like signup date or initial referrer.\n *\n * {@label Capture}\n *\n * @example\n * ```js\n * // register once-only properties\n * posthog.register_once({\n * first_login_date: new Date().toISOString(),\n * initial_referrer: document.referrer\n * })\n * ```\n *\n * @example\n * ```js\n * // override existing value if it matches default\n * posthog.register_once(\n * { user_type: 'premium' },\n * 'unknown' // overwrite if current value is 'unknown'\n * )\n * ```\n *\n * @public\n *\n * @param {Object} properties An associative array of properties to store about the user\n * @param {*} [default_value] Value to override if already set in super properties (ex: 'False') Default: 'None'\n * @param {Number} [days] How many days since the users last visit to store the super properties\n */\n register_once(properties: Properties, default_value?: Property, days?: number): void {\n this.persistence?.register_once(properties, default_value, days)\n }\n\n /**\n * Registers super properties for the current session only.\n *\n * @remarks\n * Session super properties are automatically added to all events during the current browser session.\n * Unlike regular super properties, these are cleared when the session ends and are stored in sessionStorage.\n *\n * {@label Capture}\n *\n * @example\n * ```js\n * // register session-specific properties\n * posthog.register_for_session({\n * current_page_type: 'checkout',\n * ab_test_variant: 'control'\n * })\n * ```\n *\n * @example\n * ```js\n * // register properties for user flow tracking\n * posthog.register_for_session({\n * selected_plan: 'pro',\n * completed_steps: 3,\n * flow_id: 'signup_flow_v2'\n * })\n * ```\n *\n * @public\n *\n * @param {Object} properties An associative array of properties to store about the user\n */\n register_for_session(properties: Properties): void {\n this.sessionPersistence?.register(properties)\n }\n\n /**\n * Removes a super property from persistent storage.\n *\n * @remarks\n * This will stop the property from being automatically included in future events.\n * The property will be permanently removed from the user's profile.\n *\n * {@label Capture}\n *\n * @example\n * ```js\n * // remove a super property\n * posthog.unregister('plan_type')\n * ```\n *\n * @public\n *\n * @param {String} property The name of the super property to remove\n */\n unregister(property: string): void {\n this.persistence?.unregister(property)\n }\n\n /**\n * Removes a session super property from the current session.\n *\n * @remarks\n * This will stop the property from being automatically included in future events for this session.\n * The property is removed from sessionStorage.\n *\n * {@label Capture}\n *\n * @example\n * ```js\n * // remove a session property\n * posthog.unregister_for_session('current_flow')\n * ```\n *\n * @public\n *\n * @param {String} property The name of the session super property to remove\n */\n unregister_for_session(property: string): void {\n this.sessionPersistence?.unregister(property)\n }\n\n _register_single(prop: string, value: Property) {\n this.register({ [prop]: value })\n }\n\n /**\n * Gets the value of a feature flag for the current user.\n *\n * @remarks\n * Returns the feature flag value which can be a boolean, string, or undefined.\n * Supports multivariate flags that can return custom string values.\n *\n * {@label Feature flags}\n *\n * @example\n * ```js\n * // check boolean flag\n * if (posthog.getFeatureFlag('new-feature')) {\n * // show new feature\n * }\n * ```\n *\n * @example\n * ```js\n * // check multivariate flag\n * const variant = posthog.getFeatureFlag('button-color')\n * if (variant === 'red') {\n * // show red button\n * }\n * ```\n *\n * @public\n *\n * @param {Object|String} prop Key of the feature flag.\n * @param {Object|String} options (optional) If {send_event: false}, we won't send an $feature_flag_call event to PostHog.\n */\n getFeatureFlag(key: string, options?: { send_event?: boolean }): boolean | string | undefined {\n return this.featureFlags.getFeatureFlag(key, options)\n }\n\n /**\n * Get feature flag payload value matching key for user (supports multivariate flags).\n *\n * {@label Feature flags}\n *\n * @example\n * ```js\n * if(posthog.getFeatureFlag('beta-feature') === 'some-value') {\n * const someValue = posthog.getFeatureFlagPayload('beta-feature')\n * // do something\n * }\n * ```\n *\n * @public\n *\n * @param {Object|String} prop Key of the feature flag.\n */\n getFeatureFlagPayload(key: string): JsonType {\n const payload = this.featureFlags.getFeatureFlagPayload(key)\n try {\n return JSON.parse(payload as any)\n } catch {\n return payload\n }\n }\n\n /**\n * Checks if a feature flag is enabled for the current user.\n *\n * @remarks\n * Returns true if the flag is enabled, false if disabled, or undefined if not found.\n * This is a convenience method that treats any truthy value as enabled.\n *\n * {@label Feature flags}\n *\n * @example\n * ```js\n * // simple feature flag check\n * if (posthog.isFeatureEnabled('new-checkout')) {\n * showNewCheckout()\n * }\n * ```\n *\n * @example\n * ```js\n * // disable event tracking\n * if (posthog.isFeatureEnabled('feature', { send_event: false })) {\n * // flag checked without sending $feature_flag_call event\n * }\n * ```\n *\n * @public\n *\n * @param {Object|String} prop Key of the feature flag.\n * @param {Object|String} options (optional) If {send_event: false}, we won't send an $feature_flag_call event to PostHog.\n */\n isFeatureEnabled(key: string, options?: { send_event: boolean }): boolean | undefined {\n return this.featureFlags.isFeatureEnabled(key, options)\n }\n\n /**\n * Feature flag values are cached. If something has changed with your user and you'd like to refetch their flag values, call this method.\n *\n * {@label Feature flags}\n *\n * @example\n * ```js\n * posthog.reloadFeatureFlags()\n * ```\n *\n * @public\n */\n reloadFeatureFlags(): void {\n this.featureFlags.reloadFeatureFlags()\n }\n\n /**\n * Opt the user in or out of an early access feature. [Learn more in the docs](/docs/feature-flags/early-access-feature-management#option-2-custom-implementation)\n *\n * {@label Feature flags}\n *\n * @example\n * ```js\n * const toggleBeta = (betaKey) => {\n * if (activeBetas.some(\n * beta => beta.flagKey === betaKey\n * )) {\n * posthog.updateEarlyAccessFeatureEnrollment(\n * betaKey,\n * false\n * )\n * setActiveBetas(\n * prevActiveBetas => prevActiveBetas.filter(\n * item => item.flagKey !== betaKey\n * )\n * );\n * return\n * }\n *\n * posthog.updateEarlyAccessFeatureEnrollment(\n * betaKey,\n * true\n * )\n * setInactiveBetas(\n * prevInactiveBetas => prevInactiveBetas.filter(\n * item => item.flagKey !== betaKey\n * )\n * );\n * }\n *\n * const registerInterest = (featureKey) => {\n * posthog.updateEarlyAccessFeatureEnrollment(\n * featureKey,\n * true\n * )\n * // Update UI to show user has registered\n * }\n * ```\n *\n * @public\n *\n * @param {String} key The key of the feature flag to update.\n * @param {Boolean} isEnrolled Whether the user is enrolled in the feature.\n * @param {String} [stage] The stage of the feature flag to update.\n */\n updateEarlyAccessFeatureEnrollment(key: string, isEnrolled: boolean, stage?: string): void {\n this.featureFlags.updateEarlyAccessFeatureEnrollment(key, isEnrolled, stage)\n }\n\n /**\n * Get the list of early access features. To check enrollment status, use `isFeatureEnabled`. [Learn more in the docs](/docs/feature-flags/early-access-feature-management#option-2-custom-implementation)\n *\n * {@label Feature flags}\n *\n * @example\n * ```js\n * const posthog = usePostHog()\n * const activeFlags = useActiveFeatureFlags()\n *\n * const [activeBetas, setActiveBetas] = useState([])\n * const [inactiveBetas, setInactiveBetas] = useState([])\n * const [comingSoonFeatures, setComingSoonFeatures] = useState([])\n *\n * useEffect(() => {\n * posthog.getEarlyAccessFeatures((features) => {\n * // Filter features by stage\n * const betaFeatures = features.filter(feature => feature.stage === 'beta')\n * const conceptFeatures = features.filter(feature => feature.stage === 'concept')\n *\n * setComingSoonFeatures(conceptFeatures)\n *\n * if (!activeFlags || activeFlags.length === 0) {\n * setInactiveBetas(betaFeatures)\n * return\n * }\n *\n * const activeBetas = betaFeatures.filter(\n * beta => activeFlags.includes(beta.flagKey)\n * );\n * const inactiveBetas = betaFeatures.filter(\n * beta => !activeFlags.includes(beta.flagKey)\n * );\n * setActiveBetas(activeBetas)\n * setInactiveBetas(inactiveBetas)\n * }, true, ['concept', 'beta'])\n * }, [activeFlags])\n * ```\n *\n * @public\n *\n * @param {Function} callback The callback function will be called when the early access features are loaded.\n * @param {Boolean} [force_reload] Whether to force a reload of the early access features.\n * @param {String[]} [stages] The stages of the early access features to load.\n */\n getEarlyAccessFeatures(\n callback: EarlyAccessFeatureCallback,\n force_reload = false,\n stages?: EarlyAccessFeatureStage[]\n ): void {\n return this.featureFlags.getEarlyAccessFeatures(callback, force_reload, stages)\n }\n\n /**\n * Exposes a set of events that PostHog will emit.\n * e.g. `eventCaptured` is emitted immediately before trying to send an event\n *\n * Unlike `onFeatureFlags` and `onSessionId` these are not called when the\n * listener is registered, the first callback will be the next event\n * _after_ registering a listener\n *\n * {@label Capture}\n *\n * @example\n * ```js\n * posthog.on('eventCaptured', (event) => {\n * console.log(event)\n * })\n * ```\n *\n * @public\n *\n * @param {String} event The event to listen for.\n * @param {Function} cb The callback function to call when the event is emitted.\n * @returns {Function} A function that can be called to unsubscribe the listener.\n */\n on(event: 'eventCaptured', cb: (...args: any[]) => void): () => void {\n return this._internalEventEmitter.on(event, cb)\n }\n\n /**\n * Register an event listener that runs when feature flags become available or when they change.\n * If there are flags, the listener is called immediately in addition to being called on future changes.\n * Note that this is not called only when we fetch feature flags from the server, but also when they change in the browser.\n *\n * {@label Feature flags}\n *\n * @example\n * ```js\n * posthog.onFeatureFlags(function(featureFlags, featureFlagsVariants, { errorsLoading }) {\n * // do something\n * })\n * ```\n *\n * @param callback - The callback function will be called once the feature flags are ready or when they are updated.\n * It'll return a list of feature flags enabled for the user, the variants,\n * and also a context object indicating whether we succeeded to fetch the flags or not.\n * @returns A function that can be called to unsubscribe the listener. Used by `useEffect` when the component unmounts.\n */\n onFeatureFlags(callback: FeatureFlagsCallback): () => void {\n return this.featureFlags.onFeatureFlags(callback)\n }\n\n /**\n * Register an event listener that runs when surveys are loaded.\n *\n * Callback parameters:\n * - surveys: Survey[]: An array containing all survey objects fetched from PostHog using the getSurveys method\n * - context: { isLoaded: boolean, error?: string }: An object indicating if the surveys were loaded successfully\n *\n * {@label Surveys}\n *\n * @example\n * ```js\n * posthog.onSurveysLoaded((surveys, context) => { // do something })\n * ```\n *\n *\n * @param {Function} callback The callback function will be called when surveys are loaded or updated.\n * @returns {Function} A function that can be called to unsubscribe the listener.\n */\n onSurveysLoaded(callback: SurveyCallback): () => void {\n return this.surveys.onSurveysLoaded(callback)\n }\n\n /**\n * Register an event listener that runs whenever the session id or window id change.\n * If there is already a session id, the listener is called immediately in addition to being called on future changes.\n *\n * Can be used, for example, to sync the PostHog session id with a backend session.\n *\n * {@label Identification}\n *\n * @example\n * ```js\n * posthog.onSessionId(function(sessionId, windowId) { // do something })\n * ```\n *\n * @param {Function} [callback] The callback function will be called once a session id is present or when it or the window id are updated.\n * @returns {Function} A function that can be called to unsubscribe the listener. E.g. Used by `useEffect` when the component unmounts.\n */\n onSessionId(callback: SessionIdChangedCallback): () => void {\n return this.sessionManager?.onSessionId(callback) ?? (() => {})\n }\n\n /**\n * Get list of all surveys.\n *\n * {@label Surveys}\n *\n * @example\n * ```js\n * function callback(surveys, context) {\n * // do something\n * }\n *\n * posthog.getSurveys(callback, false)\n * ```\n *\n * @public\n *\n * @param {Function} [callback] Function that receives the array of surveys\n * @param {Boolean} [forceReload] Optional boolean to force an API call for updated surveys\n */\n getSurveys(callback: SurveyCallback, forceReload = false): void {\n this.surveys.getSurveys(callback, forceReload)\n }\n\n /**\n * Get surveys that should be enabled for the current user. See [fetching surveys documentation](/docs/surveys/implementing-custom-surveys#fetching-surveys-manually) for more details.\n *\n * {@label Surveys}\n *\n * @example\n * ```js\n * posthog.getActiveMatchingSurveys((surveys) => {\n * // do something\n * })\n * ```\n *\n * @public\n *\n * @param {Function} [callback] The callback function will be called when the surveys are loaded or updated.\n * @param {Boolean} [forceReload] Whether to force a reload of the surveys.\n */\n getActiveMatchingSurveys(callback: SurveyCallback, forceReload = false): void {\n this.surveys.getActiveMatchingSurveys(callback, forceReload)\n }\n\n /**\n * Although we recommend using popover surveys and display conditions,\n * if you want to show surveys programmatically without setting up all\n * the extra logic needed for API surveys, you can render surveys\n * programmatically with the renderSurvey method.\n *\n * This takes a survey ID and an HTML selector to render an unstyled survey.\n *\n * {@label Surveys}\n *\n * @example\n * ```js\n * posthog.renderSurvey(coolSurveyID, '#survey-container')\n * ```\n *\n * @deprecated Use displaySurvey instead - it's more complete and also supports popover surveys.\n *\n * @public\n *\n * @param {String} surveyId The ID of the survey to render.\n * @param {String} selector The selector of the HTML element to render the survey on.\n */\n renderSurvey(surveyId: string, selector: string): void {\n this.surveys.renderSurvey(surveyId, selector)\n }\n\n /**\n * Display a survey programmatically as either a popover or inline element.\n *\n * @param {string} surveyId - The survey ID to display\n * @param {DisplaySurveyOptions} options - Display configuration\n *\n * @example\n * ```js\n * // Display as popover (respects all conditions defined in the dashboard)\n * posthog.displaySurvey('survey-id-123')\n * ```\n *\n * @example\n * ```js\n * // Display inline in a specific element\n * posthog.displaySurvey('survey-id-123', {\n * displayType: DisplaySurveyType.Inline,\n * selector: '#survey-container'\n * })\n * ```\n *\n * @example\n * ```js\n * // Force display ignoring conditions and delays\n * posthog.displaySurvey('survey-id-123', {\n * displayType: DisplaySurveyType.Popover,\n * ignoreConditions: true,\n * ignoreDelay: true\n * })\n * ```\n *\n * {@label Surveys}\n */\n displaySurvey(surveyId: string, options: DisplaySurveyOptions = DEFAULT_DISPLAY_SURVEY_OPTIONS): void {\n this.surveys.displaySurvey(surveyId, options)\n }\n\n /**\n * Cancels a pending survey that is waiting to be displayed (e.g., due to a popup delay).\n *\n * {@label Surveys}\n */\n cancelPendingSurvey(surveyId: string): void {\n this.surveys.cancelPendingSurvey(surveyId)\n }\n\n /**\n * Checks the feature flags associated with this Survey to see if the survey can be rendered.\n * This method is deprecated because it's synchronous and won't return the correct result if surveys are not loaded.\n * Use `canRenderSurveyAsync` instead.\n *\n * {@label Surveys}\n *\n *\n * @deprecated\n *\n * @param surveyId The ID of the survey to check.\n * @returns A SurveyRenderReason object indicating if the survey can be rendered.\n */\n canRenderSurvey(surveyId: string): SurveyRenderReason | null {\n return this.surveys.canRenderSurvey(surveyId)\n }\n\n /**\n * Checks the feature flags associated with this Survey to see if the survey can be rendered.\n *\n * {@label Surveys}\n *\n * @example\n * ```js\n * posthog.canRenderSurveyAsync(surveyId).then((result) => {\n * if (result.visible) {\n * // Survey can be rendered\n * console.log('Survey can be rendered')\n * } else {\n * // Survey cannot be rendered\n * console.log('Survey cannot be rendered:', result.disabledReason)\n * }\n * })\n * ```\n *\n * @public\n *\n * @param surveyId The ID of the survey to check.\n * @param forceReload If true, the survey will be reloaded from the server, Default: false\n * @returns A SurveyRenderReason object indicating if the survey can be rendered.\n */\n canRenderSurveyAsync(surveyId: string, forceReload = false): Promise<SurveyRenderReason> {\n return this.surveys.canRenderSurveyAsync(surveyId, forceReload)\n }\n\n /**\n * Associates a user with a unique identifier instead of an auto-generated ID.\n * Learn more about [identifying users](/docs/product-analytics/identify)\n *\n * {@label Identification}\n *\n * @remarks\n * By default, PostHog assigns each user a randomly generated `distinct_id`. Use this method to\n * replace that ID with your own unique identifier (like a user ID from your database).\n *\n * @example\n * ```js\n * // basic identification\n * posthog.identify('user_12345')\n * ```\n *\n * @example\n * ```js\n * // identify with user properties\n * posthog.identify('user_12345', {\n * email: 'user@example.com',\n * plan: 'premium'\n * })\n * ```\n *\n * @example\n * ```js\n * // identify with set and set_once properties\n * posthog.identify('user_12345',\n * { last_login: new Date() }, // updates every time\n * { signup_date: new Date() } // sets only once\n * )\n * ```\n *\n * @public\n *\n * @param {String} [new_distinct_id] A string that uniquely identifies a user. If not provided, the distinct_id currently in the persistent store (cookie or localStorage) will be used.\n * @param {Object} [userPropertiesToSet] Optional: An associative array of properties to store about the user. Note: For feature flag evaluations, if the same key is present in the userPropertiesToSetOnce,\n * it will be overwritten by the value in userPropertiesToSet.\n * @param {Object} [userPropertiesToSetOnce] Optional: An associative array of properties to store about the user. If property is previously set, this does not override that value.\n */\n identify(new_distinct_id?: string, userPropertiesToSet?: Properties, userPropertiesToSetOnce?: Properties): void {\n if (!this.__loaded || !this.persistence) {\n return logger.uninitializedWarning('posthog.identify')\n }\n if (isNumber(new_distinct_id)) {\n new_distinct_id = (new_distinct_id as number).toString()\n logger.warn(\n 'The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.'\n )\n }\n\n //if the new_distinct_id has not been set ignore the identify event\n if (!new_distinct_id) {\n logger.error('Unique user id has not been set in posthog.identify')\n return\n }\n\n if (isDistinctIdStringLike(new_distinct_id)) {\n logger.critical(\n `The string \"${new_distinct_id}\" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`\n )\n return\n }\n if (new_distinct_id === COOKIELESS_SENTINEL_VALUE) {\n logger.critical(\n `The string \"${COOKIELESS_SENTINEL_VALUE}\" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`\n )\n return\n }\n\n if (!this._requirePersonProcessing('posthog.identify')) {\n return\n }\n\n const previous_distinct_id = this.get_distinct_id()\n this.register({ $user_id: new_distinct_id })\n\n if (!this.get_property('$device_id')) {\n // The persisted distinct id might not actually be a device id at all\n // it might be a distinct id of the user from before\n const device_id = previous_distinct_id\n this.register_once(\n {\n $had_persisted_distinct_id: true,\n $device_id: device_id,\n },\n ''\n )\n }\n\n // if the previous distinct id had an alias stored, then we clear it\n if (new_distinct_id !== previous_distinct_id && new_distinct_id !== this.get_property(ALIAS_ID_KEY)) {\n this.unregister(ALIAS_ID_KEY)\n this.register({ distinct_id: new_distinct_id })\n }\n\n const isKnownAnonymous = (this.persistence.get_property(USER_STATE) || 'anonymous') === 'anonymous'\n\n // send an $identify event any time the distinct_id is changing and the old ID is an anonymous ID\n // - logic on the server will determine whether or not to do anything with it.\n if (new_distinct_id !== previous_distinct_id && isKnownAnonymous) {\n this.persistence.set_property(USER_STATE, 'identified')\n\n // Update current user properties\n this.setPersonPropertiesForFlags(\n { ...(userPropertiesToSetOnce || {}), ...(userPropertiesToSet || {}) },\n false\n )\n\n this.capture(\n '$identify',\n {\n distinct_id: new_distinct_id,\n $anon_distinct_id: previous_distinct_id,\n },\n { $set: userPropertiesToSet || {}, $set_once: userPropertiesToSetOnce || {} }\n )\n\n this._cachedPersonProperties = getPersonPropertiesHash(\n new_distinct_id,\n userPropertiesToSet,\n userPropertiesToSetOnce\n )\n\n // let the reload feature flag request know to send this previous distinct id\n // for flag consistency\n this.featureFlags.setAnonymousDistinctId(previous_distinct_id)\n } else if (userPropertiesToSet || userPropertiesToSetOnce) {\n // If the distinct_id is not changing, but we have user properties to set, we can check if they have changed\n // and if so, send a $set event\n\n this.setPersonProperties(userPropertiesToSet, userPropertiesToSetOnce)\n }\n\n // Reload active feature flags if the user identity changes.\n // Note we don't reload this on property changes as these get processed async\n if (new_distinct_id !== previous_distinct_id) {\n this.reloadFeatureFlags()\n // also clear any stored flag calls\n this.unregister(FLAG_CALL_REPORTED)\n }\n }\n\n /**\n * Sets properties on the person profile associated with the current `distinct_id`.\n * Learn more about [identifying users](/docs/product-analytics/identify)\n *\n * {@label Identification}\n *\n * @remarks\n * Updates user properties that are stored with the person profile in PostHog.\n * If `person_profiles` is set to `identified_only` and no profile exists, this will create one.\n *\n * @example\n * ```js\n * // set user properties\n * posthog.setPersonProperties({\n * email: 'user@example.com',\n * plan: 'premium'\n * })\n * ```\n *\n * @example\n * ```js\n * // set properties\n * posthog.setPersonProperties(\n * { name: 'Max Hedgehog' }, // $set properties\n * { initial_url: '/blog' } // $set_once properties\n * )\n * ```\n *\n * @public\n *\n * @param {Object} [userPropertiesToSet] Optional: An associative array of properties to store about the user. Note: For feature flag evaluations, if the same key is present in the userPropertiesToSetOnce,\n * it will be overwritten by the value in userPropertiesToSet.\n * @param {Object} [userPropertiesToSetOnce] Optional: An associative array of properties to store about the user. If property is previously set, this does not override that value.\n */\n setPersonProperties(userPropertiesToSet?: Properties, userPropertiesToSetOnce?: Properties): void {\n if (!userPropertiesToSet && !userPropertiesToSetOnce) {\n return\n }\n\n if (!this._requirePersonProcessing('posthog.setPersonProperties')) {\n return\n }\n\n const hash = getPersonPropertiesHash(this.get_distinct_id(), userPropertiesToSet, userPropertiesToSetOnce)\n\n // if exactly this $set call has been sent before, don't send it again - determine based on hash of properties\n if (this._cachedPersonProperties === hash) {\n logger.info('A duplicate setPersonProperties call was made with the same properties. It has been ignored.')\n return\n }\n\n // Update current user properties\n this.setPersonPropertiesForFlags({ ...(userPropertiesToSetOnce || {}), ...(userPropertiesToSet || {}) })\n\n this.capture('$set', { $set: userPropertiesToSet || {}, $set_once: userPropertiesToSetOnce || {} })\n\n this._cachedPersonProperties = hash\n }\n\n /**\n * Associates the user with a group for group-based analytics.\n * Learn more about [groups](/docs/product-analytics/group-analytics)\n *\n * {@label Identification}\n *\n * @remarks\n * Groups allow you to analyze users collectively (e.g., by organization, team, or account).\n * This sets the group association for all subsequent events and reloads feature flags.\n *\n * @example\n * ```js\n * // associate user with an organization\n * posthog.group('organization', 'org_12345', {\n * name: 'Acme Corp',\n * plan: 'enterprise'\n * })\n * ```\n *\n * @example\n * ```js\n * // associate with multiple group types\n * posthog.group('organization', 'org_12345')\n * posthog.group('team', 'team_67890')\n * ```\n *\n * @public\n *\n * @param {String} groupType Group type (example: 'organization')\n * @param {String} groupKey Group key (example: 'org::5')\n * @param {Object} groupPropertiesToSet Optional properties to set for group\n */\n group(groupType: string, groupKey: string, groupPropertiesToSet?: Properties): void {\n if (!groupType || !groupKey) {\n logger.error('posthog.group requires a group type and group key')\n return\n }\n\n const existingGroups = this.getGroups()\n\n // if group key changes, remove stored group properties\n if (existingGroups[groupType] !== groupKey) {\n this.resetGroupPropertiesForFlags(groupType)\n }\n\n this.register({ $groups: { ...existingGroups, [groupType]: groupKey } })\n\n if (groupPropertiesToSet) {\n this.capture('$groupidentify', {\n $group_type: groupType,\n $group_key: groupKey,\n $group_set: groupPropertiesToSet,\n })\n this.setGroupPropertiesForFlags({ [groupType]: groupPropertiesToSet })\n }\n\n // If groups change and no properties change, reload feature flags.\n // The property change reload case is handled in setGroupPropertiesForFlags.\n if (existingGroups[groupType] !== groupKey && !groupPropertiesToSet) {\n this.reloadFeatureFlags()\n }\n }\n\n /**\n * Resets only the group properties of the user currently logged in.\n * Learn more about [groups](/docs/product-analytics/group-analytics)\n *\n * {@label Identification}\n *\n * @example\n * ```js\n * posthog.resetGroups()\n * ```\n *\n * @public\n */\n resetGroups(): void {\n this.register({ $groups: {} })\n this.resetGroupPropertiesForFlags()\n\n // If groups changed, reload feature flags.\n this.reloadFeatureFlags()\n }\n\n /**\n * Sometimes, you might want to evaluate feature flags using properties that haven't been ingested yet,\n * or were set incorrectly earlier. You can do so by setting properties the flag depends on with these calls:\n *\n * {@label Feature flags}\n *\n * @example\n * ```js\n * // Set properties\n * posthog.setPersonPropertiesForFlags({'property1': 'value', property2: 'value2'})\n * ```\n *\n * @example\n * ```js\n * // Set properties without reloading\n * posthog.setPersonPropertiesForFlags({'property1': 'value', property2: 'value2'}, false)\n * ```\n *\n * @public\n *\n * @param {Object} properties The properties to override.\n * @param {Boolean} [reloadFeatureFlags] Whether to reload feature flags.\n */\n setPersonPropertiesForFlags(properties: Properties, reloadFeatureFlags = true): void {\n this.featureFlags.setPersonPropertiesForFlags(properties, reloadFeatureFlags)\n }\n\n /**\n * Resets the person properties for feature flags.\n *\n * {@label Feature flags}\n *\n * @public\n *\n * @example\n * ```js\n * posthog.resetPersonPropertiesForFlags()\n * ```\n */\n resetPersonPropertiesForFlags(): void {\n this.featureFlags.resetPersonPropertiesForFlags()\n }\n\n /**\n * Set override group properties for feature flags.\n * This is used when dealing with new groups / where you don't want to wait for ingestion\n * to update properties.\n * Takes in an object, the key of which is the group type.\n *\n * {@label Feature flags}\n *\n * @public\n *\n * @example\n * ```js\n * // Set properties with reload\n * posthog.setGroupPropertiesForFlags({'organization': { name: 'CYZ', employees: '11' } })\n * ```\n *\n * @example\n * ```js\n * // Set properties without reload\n * posthog.setGroupPropertiesForFlags({'organization': { name: 'CYZ', employees: '11' } }, false)\n * ```\n *\n * @param {Object} properties The properties to override, the key of which is the group type.\n * @param {Boolean} [reloadFeatureFlags] Whether to reload feature flags.\n */\n setGroupPropertiesForFlags(properties: { [type: string]: Properties }, reloadFeatureFlags = true): void {\n if (!this._requirePersonProcessing('posthog.setGroupPropertiesForFlags')) {\n return\n }\n this.featureFlags.setGroupPropertiesForFlags(properties, reloadFeatureFlags)\n }\n\n /**\n * Resets the group properties for feature flags.\n *\n * {@label Feature flags}\n *\n * @public\n *\n * @example\n * ```js\n * posthog.resetGroupPropertiesForFlags()\n * ```\n */\n resetGroupPropertiesForFlags(group_type?: string): void {\n this.featureFlags.resetGroupPropertiesForFlags(group_type)\n }\n\n /**\n * Resets all user data and starts a fresh session.\n *\n * ⚠️ **Warning**: Only call this when a user logs out. Calling at the wrong time can cause split sessions.\n *\n * This clears:\n * - Session ID and super properties\n * - User identification (sets new random distinct_id)\n * - Cached data and consent settings\n *\n * {@label Identification}\n * @example\n * ```js\n * // reset on user logout\n * function logout() {\n * posthog.reset()\n * // redirect to login page\n * }\n * ```\n *\n * @example\n * ```js\n * // reset and generate new device ID\n * posthog.reset(true) // also resets device_id\n * ```\n *\n * @public\n */\n reset(reset_device_id?: boolean): void {\n logger.info('reset')\n if (!this.__loaded) {\n return logger.uninitializedWarning('posthog.reset')\n }\n const device_id = this.get_property('$device_id')\n this.consent.reset()\n this.persistence?.clear()\n this.sessionPersistence?.clear()\n this.surveys.reset()\n this.featureFlags.reset()\n this.persistence?.set_property(USER_STATE, 'anonymous')\n this.sessionManager?.resetSessionId()\n this._cachedPersonProperties = null\n if (this.config.cookieless_mode === 'always') {\n this.register_once(\n {\n distinct_id: COOKIELESS_SENTINEL_VALUE,\n $device_id: null,\n },\n ''\n )\n } else {\n const uuid = this.config.get_device_id(uuidv7())\n this.register_once(\n {\n distinct_id: uuid,\n $device_id: reset_device_id ? uuid : device_id,\n },\n ''\n )\n }\n\n this.register(\n {\n $last_posthog_reset: new Date().toISOString(),\n },\n 1\n )\n }\n\n /**\n * Returns the current distinct ID for the user.\n *\n * @remarks\n * This is either the auto-generated ID or the ID set via `identify()`.\n * The distinct ID is used to associate events with users in PostHog.\n *\n * {@label Identification}\n *\n * @example\n * ```js\n * // get the current user ID\n * const userId = posthog.get_distinct_id()\n * console.log('Current user:', userId)\n * ```\n *\n * @example\n * ```js\n * // use in loaded callback\n * posthog.init('token', {\n * loaded: (posthog) => {\n * const id = posthog.get_distinct_id()\n * // use the ID\n * }\n * })\n * ```\n *\n * @public\n *\n * @returns The current distinct ID\n */\n get_distinct_id(): string {\n return this.get_property('distinct_id')\n }\n\n /**\n * Returns the current groups.\n *\n * {@label Identification}\n *\n * @public\n *\n * @returns The current groups\n */\n getGroups(): Record<string, any> {\n return this.get_property('$groups') || {}\n }\n\n /**\n * Returns the current session_id.\n *\n * @remarks\n * This should only be used for informative purposes.\n * Any actual internal use case for the session_id should be handled by the sessionManager.\n *\n * @public\n *\n * @returns The stored session ID for the current session. This may be an empty string if the client is not yet fully initialized.\n */\n get_session_id(): string {\n return this.sessionManager?.checkAndGetSessionAndWindowId(true).sessionId ?? ''\n }\n\n /**\n * Returns the Replay url for the current session.\n *\n * {@label Session replay}\n *\n * @public\n *\n * @example\n * ```js\n * // basic usage\n * posthog.get_session_replay_url()\n *\n * @example\n * ```js\n * // timestamp\n * posthog.get_session_replay_url({ withTimestamp: true })\n * ```\n *\n * @example\n * ```js\n * // timestamp and lookback\n * posthog.get_session_replay_url({\n * withTimestamp: true,\n * timestampLookBack: 30 // look back 30 seconds\n * })\n * ```\n *\n * @param options Options for the url\n * @param options.withTimestamp Whether to include the timestamp in the url (defaults to false)\n * @param options.timestampLookBack How many seconds to look back for the timestamp (defaults to 10)\n */\n get_session_replay_url(options?: { withTimestamp?: boolean; timestampLookBack?: number }): string {\n if (!this.sessionManager) {\n return ''\n }\n const { sessionId, sessionStartTimestamp } = this.sessionManager.checkAndGetSessionAndWindowId(true)\n let url = this.requestRouter.endpointFor('ui', `/project/${this.config.token}/replay/${sessionId}`)\n if (options?.withTimestamp && sessionStartTimestamp) {\n const LOOK_BACK = options.timestampLookBack ?? 10\n if (!sessionStartTimestamp) {\n return url\n }\n const recordingStartTime = Math.max(\n Math.floor((new Date().getTime() - sessionStartTimestamp) / 1000) - LOOK_BACK,\n 0\n )\n url += `?t=${recordingStartTime}`\n }\n\n return url\n }\n\n /**\n * Creates an alias linking two distinct user identifiers. Learn more about [identifying users](/docs/product-analytics/identify)\n *\n * {@label Identification}\n *\n * @remarks\n * PostHog will use this to link two distinct_ids going forward (not retroactively).\n * Call this when a user signs up to connect their anonymous session with their account.\n *\n *\n * @example\n * ```js\n * // link anonymous user to account on signup\n * posthog.alias('user_12345')\n * ```\n *\n * @example\n * ```js\n * // explicit alias with original ID\n * posthog.alias('user_12345', 'anonymous_abc123')\n * ```\n *\n * @public\n *\n * @param {String} alias A unique identifier that you want to use for this user in the future.\n * @param {String} [original] The current identifier being used for this user.\n */\n alias(alias: string, original?: string): CaptureResult | void | number {\n // If the $people_distinct_id key exists in persistence, there has been a previous\n // posthog.people.identify() call made for this user. It is VERY BAD to make an alias with\n // this ID, as it will duplicate users.\n if (alias === this.get_property(PEOPLE_DISTINCT_ID_KEY)) {\n logger.critical('Attempting to create alias for existing People user - aborting.')\n return -2\n }\n if (!this._requirePersonProcessing('posthog.alias')) {\n return\n }\n\n if (isUndefined(original)) {\n original = this.get_distinct_id()\n }\n if (alias !== original) {\n this._register_single(ALIAS_ID_KEY, alias)\n return this.capture('$create_alias', { alias: alias, distinct_id: original })\n } else {\n logger.warn('alias matches current distinct_id - skipping api call.')\n this.identify(alias)\n return -1\n }\n }\n\n /**\n * Updates the configuration of the PostHog instance.\n *\n * {@label Initialization}\n *\n * @public\n *\n * @param {Partial<PostHogConfig>} config A dictionary of new configuration values to update\n */\n set_config(config: Partial<PostHogConfig>): void {\n const oldConfig = { ...this.config }\n if (isObject(config)) {\n extend(this.config, configRenames(config))\n\n const isPersistenceDisabled = this._is_persistence_disabled()\n this.persistence?.update_config(this.config, oldConfig, isPersistenceDisabled)\n this.sessionPersistence =\n this.config.persistence === 'sessionStorage' || this.config.persistence === 'memory'\n ? this.persistence\n : new PostHogPersistence({ ...this.config, persistence: 'sessionStorage' }, isPersistenceDisabled)\n\n const debugConfigFromLocalStorage = this._checkLocalStorageForDebug(this.config.debug)\n if (isBoolean(debugConfigFromLocalStorage)) {\n this.config.debug = debugConfigFromLocalStorage\n }\n\n if (isBoolean(this.config.debug)) {\n if (this.config.debug) {\n Config.DEBUG = true\n localStore._is_supported() && localStore._set('ph_debug', 'true')\n logger.info('set_config', {\n config,\n oldConfig,\n newConfig: { ...this.config },\n })\n } else {\n Config.DEBUG = false\n localStore._is_supported() && localStore._remove('ph_debug')\n }\n }\n\n this.exceptionObserver?.onConfigChange()\n\n this.sessionRecording?.startIfEnabledOrStop()\n this.autocapture?.startIfEnabled()\n this.heatmaps?.startIfEnabled()\n this.exceptionObserver?.startIfEnabledOrStop()\n this.surveys.loadIfEnabled()\n this._sync_opt_out_with_persistence()\n this.externalIntegrations?.startIfEnabledOrStop()\n }\n }\n\n /**\n * turns session recording on, and updates the config option `disable_session_recording` to false\n *\n * {@label Session replay}\n *\n * @public\n *\n * @example\n * ```js\n * // Start and ignore controls\n * posthog.startSessionRecording(true)\n * ```\n *\n * @example\n * ```js\n * // Start and override controls\n * posthog.startSessionRecording({\n * // you don't have to send all of these\n * sampling: true || false,\n * linked_flag: true || false,\n * url_trigger: true || false,\n * event_trigger: true || false\n * })\n * ```\n *\n * @param override.sampling - optional boolean to override the default sampling behavior - ensures the next session recording to start will not be skipped by sampling config.\n * @param override.linked_flag - optional boolean to override the default linked_flag behavior - ensures the next session recording to start will not be skipped by linked_flag config.\n * @param override.url_trigger - optional boolean to override the default url_trigger behavior - ensures the next session recording to start will not be skipped by url_trigger config.\n * @param override.event_trigger - optional boolean to override the default event_trigger behavior - ensures the next session recording to start will not be skipped by event_trigger config.\n * @param override - optional boolean to override the default sampling behavior - ensures the next session recording to start will not be skipped by sampling or linked_flag config. `true` is shorthand for { sampling: true, linked_flag: true }\n */\n startSessionRecording(\n override?: { sampling?: boolean; linked_flag?: boolean; url_trigger?: true; event_trigger?: true } | true\n ): void {\n const overrideAll = override === true\n const overrideConfig: OverrideConfig = {\n sampling: overrideAll || !!override?.sampling,\n linked_flag: overrideAll || !!override?.linked_flag,\n url_trigger: overrideAll || !!override?.url_trigger,\n event_trigger: overrideAll || !!override?.event_trigger,\n }\n\n if (Object.values(overrideConfig).some(Boolean)) {\n // allow the session id check to rotate session id if necessary\n this.sessionManager?.checkAndGetSessionAndWindowId()\n\n if (overrideConfig.sampling) {\n this.sessionRecording?.overrideSampling()\n }\n\n if (overrideConfig.linked_flag) {\n this.sessionRecording?.overrideLinkedFlag()\n }\n\n if (overrideConfig.url_trigger) {\n this.sessionRecording?.overrideTrigger('url')\n }\n\n if (overrideConfig.event_trigger) {\n this.sessionRecording?.overrideTrigger('event')\n }\n }\n\n this.set_config({ disable_session_recording: false })\n }\n\n /**\n * turns session recording off, and updates the config option\n * disable_session_recording to true\n *\n * {@label Session replay}\n *\n * @public\n *\n * @example\n * ```js\n * // Stop session recording\n * posthog.stopSessionRecording()\n * ```\n */\n stopSessionRecording(): void {\n this.set_config({ disable_session_recording: true })\n }\n\n /**\n * returns a boolean indicating whether session recording\n * is currently running\n *\n * {@label Session replay}\n *\n * @public\n *\n * @example\n * ```js\n * // Stop session recording if it's running\n * if (posthog.sessionRecordingStarted()) {\n * posthog.stopSessionRecording()\n * }\n * ```\n */\n sessionRecordingStarted(): boolean {\n return !!this.sessionRecording?.started\n }\n\n /**\n * Capture a caught exception manually\n *\n * {@label Error tracking}\n *\n * @public\n *\n * @example\n * ```js\n * // Capture a caught exception\n * try {\n * // something that might throw\n * } catch (error) {\n * posthog.captureException(error)\n * }\n * ```\n *\n * @example\n * ```js\n * // With additional properties\n * posthog.captureException(error, {\n * customProperty: 'value',\n * anotherProperty: ['I', 'can be a list'],\n * ...\n * })\n * ```\n *\n * @param {Error} error The error to capture\n * @param {Object} [additionalProperties] Any additional properties to add to the error event\n * @returns {CaptureResult} The result of the capture\n */\n captureException(error: unknown, additionalProperties?: Properties): CaptureResult | undefined {\n const syntheticException = new Error('PostHog syntheticException')\n const errorToProperties = this.exceptions.buildProperties(error, {\n handled: true,\n syntheticException,\n })\n return this.exceptions.sendExceptionEvent({\n ...errorToProperties,\n ...additionalProperties,\n })\n }\n\n /**\n * turns exception autocapture on, and updates the config option `capture_exceptions` to the provided config (or `true`)\n *\n * {@label Error tracking}\n *\n * @public\n *\n * @example\n * ```js\n * // Start with default exception autocapture rules. No-op if already enabled\n * posthog.startExceptionAutocapture()\n * ```\n *\n * @example\n * ```js\n * // Start and override controls\n * posthog.startExceptionAutocapture({\n * // you don't have to send all of these (unincluded values will use the default)\n * capture_unhandled_errors: true || false,\n * capture_unhandled_rejections: true || false,\n * capture_console_errors: true || false\n * })\n * ```\n *\n * @param config - optional configuration option to control the exception autocapture behavior\n */\n startExceptionAutocapture(config?: ExceptionAutoCaptureConfig): void {\n this.set_config({ capture_exceptions: config ?? true })\n }\n\n /**\n * turns exception autocapture off by updating the config option `capture_exceptions` to `false`\n *\n * {@label Error tracking}\n *\n * @public\n *\n * @example\n * ```js\n * // Stop capturing exceptions automatically\n * posthog.stopExceptionAutocapture()\n * ```\n */\n stopExceptionAutocapture(): void {\n this.set_config({ capture_exceptions: false })\n }\n\n /**\n * returns a boolean indicating whether the [toolbar](/docs/toolbar) loaded\n *\n * {@label Toolbar}\n *\n * @public\n *\n * @param toolbarParams\n * @returns {boolean} Whether the toolbar loaded\n */\n\n loadToolbar(params: ToolbarParams): boolean {\n return this.toolbar.loadToolbar(params)\n }\n\n /**\n * Returns the value of a super property. Returns undefined if the property doesn't exist.\n *\n * {@label Identification}\n *\n * @remarks\n * get_property() can only be called after the PostHog library has finished loading.\n * init() has a loaded function available to handle this automatically.\n *\n * @example\n * ```js\n * // grab value for '$user_id' after the posthog library has loaded\n * posthog.init('<YOUR PROJECT TOKEN>', {\n * loaded: function(posthog) {\n * user_id = posthog.get_property('$user_id');\n * }\n * });\n * ```\n * @public\n *\n * @param {String} property_name The name of the super property you want to retrieve\n */\n get_property(property_name: string): Property | undefined {\n return this.persistence?.props[property_name]\n }\n\n /**\n * Returns the value of the session super property named property_name. If no such\n * property is set, getSessionProperty() will return the undefined value.\n *\n * {@label Identification}\n *\n * @remarks\n * This is based on browser-level `sessionStorage`, NOT the PostHog session.\n * getSessionProperty() can only be called after the PostHog library has finished loading.\n * init() has a loaded function available to handle this automatically.\n *\n * @example\n * ```js\n * // grab value for 'user_id' after the posthog library has loaded\n * posthog.init('YOUR PROJECT TOKEN', {\n * loaded: function(posthog) {\n * user_id = posthog.getSessionProperty('user_id');\n * }\n * });\n * ```\n *\n * @param {String} property_name The name of the session super property you want to retrieve\n */\n getSessionProperty(property_name: string): Property | undefined {\n return this.sessionPersistence?.props[property_name]\n }\n\n /**\n * Returns a string representation of the PostHog instance.\n *\n * {@label Initialization}\n *\n * @internal\n */\n toString(): string {\n let name = this.config.name ?? PRIMARY_INSTANCE_NAME\n if (name !== PRIMARY_INSTANCE_NAME) {\n name = PRIMARY_INSTANCE_NAME + '.' + name\n }\n return name\n }\n\n _isIdentified(): boolean {\n return (\n this.persistence?.get_property(USER_STATE) === 'identified' ||\n this.sessionPersistence?.get_property(USER_STATE) === 'identified'\n )\n }\n\n _hasPersonProcessing(): boolean {\n return !(\n this.config.person_profiles === 'never' ||\n (this.config.person_profiles === 'identified_only' &&\n !this._isIdentified() &&\n isEmptyObject(this.getGroups()) &&\n !this.persistence?.props?.[ALIAS_ID_KEY] &&\n !this.persistence?.props?.[ENABLE_PERSON_PROCESSING])\n )\n }\n\n _shouldCapturePageleave(): boolean {\n return (\n this.config.capture_pageleave === true ||\n (this.config.capture_pageleave === 'if_capture_pageview' &&\n (this.config.capture_pageview === true || this.config.capture_pageview === 'history_change'))\n )\n }\n\n /**\n * Creates a person profile for the current user, if they don't already have one and config.person_profiles is set\n * to 'identified_only'. Produces a warning and does not create a profile if config.person_profiles is set to\n * 'never'. Learn more about [person profiles](/docs/product-analytics/identify)\n *\n * {@label Identification}\n *\n * @public\n *\n * @example\n * ```js\n * posthog.createPersonProfile()\n * ```\n */\n createPersonProfile(): void {\n if (this._hasPersonProcessing()) {\n // if a person profile already exists, don't send an event when we don't need to\n return\n }\n if (!this._requirePersonProcessing('posthog.createPersonProfile')) {\n return\n }\n // sent a $set event. We don't set any properties here, but attribution props will be added later\n this.setPersonProperties({}, {})\n }\n\n /**\n * Enables person processing if possible, returns true if it does so or already enabled, false otherwise\n *\n * @param function_name\n */\n _requirePersonProcessing(function_name: string): boolean {\n if (this.config.person_profiles === 'never') {\n logger.error(\n function_name + ' was called, but process_person is set to \"never\". This call will be ignored.'\n )\n return false\n }\n this._register_single(ENABLE_PERSON_PROCESSING, true)\n return true\n }\n\n private _is_persistence_disabled(): boolean {\n if (this.config.cookieless_mode === 'always') {\n return true\n }\n const isOptedOut = this.consent.isOptedOut()\n const defaultPersistenceDisabled =\n this.config.opt_out_persistence_by_default || this.config.cookieless_mode === 'on_reject'\n\n // TRICKY: We want a deterministic state for persistence so that a new pageload has the same persistence\n return this.config.disable_persistence || (isOptedOut && !!defaultPersistenceDisabled)\n }\n\n private _sync_opt_out_with_persistence(): boolean {\n const persistenceDisabled = this._is_persistence_disabled()\n\n if (this.persistence?._disabled !== persistenceDisabled) {\n this.persistence?.set_disabled(persistenceDisabled)\n }\n if (this.sessionPersistence?._disabled !== persistenceDisabled) {\n this.sessionPersistence?.set_disabled(persistenceDisabled)\n }\n return persistenceDisabled\n }\n\n /**\n * Opts the user into data capturing and persistence.\n *\n * {@label Privacy}\n *\n * @remarks\n * Enables event tracking and data persistence (cookies/localStorage) for this PostHog instance.\n * By default, captures an `$opt_in` event unless disabled.\n *\n * @example\n * ```js\n * // simple opt-in\n * posthog.opt_in_capturing()\n * ```\n *\n * @example\n * ```js\n * // opt-in with custom event and properties\n * posthog.opt_in_capturing({\n * captureEventName: 'Privacy Accepted',\n * captureProperties: { source: 'banner' }\n * })\n * ```\n *\n * @example\n * ```js\n * // opt-in without capturing event\n * posthog.opt_in_capturing({\n * captureEventName: false\n * })\n * ```\n *\n * @public\n *\n * @param {Object} [config] A dictionary of config options to override\n * @param {string} [config.capture_event_name=$opt_in] Event name to be used for capturing the opt-in action. Set to `null` or `false` to skip capturing the optin event\n * @param {Object} [config.capture_properties] Set of properties to be captured along with the opt-in action\n */\n opt_in_capturing(options?: {\n captureEventName?: EventName | null | false /** event name to be used for capturing the opt-in action */\n captureProperties?: Properties /** set of properties to be captured along with the opt-in action */\n }): void {\n if (this.config.cookieless_mode === 'always') {\n logger.warn('Consent opt in/out is not valid with cookieless_mode=\"always\" and will be ignored')\n return\n }\n if (this.config.cookieless_mode === 'on_reject' && this.consent.isExplicitlyOptedOut()) {\n // If the user has explicitly opted out on_reject mode, then before we can start sending regular non-cookieless events\n // we need to reset the instance to ensure that there is no leaking of state or data between the cookieless and regular events\n this.reset(true)\n this.sessionManager?.destroy()\n this.sessionManager = new SessionIdManager(this)\n if (this.persistence) {\n this.sessionPropsManager = new SessionPropsManager(this, this.sessionManager, this.persistence)\n }\n this.sessionRecording = new SessionRecording(this)\n this.sessionRecording.startIfEnabledOrStop()\n }\n\n this.consent.optInOut(true)\n this._sync_opt_out_with_persistence()\n\n // Start queue after opting in\n this._start_queue_if_opted_in()\n\n // Restart session recording if it should now be enabled\n // (this handles the case where opt_out_capturing_by_default or cookieless_mode prevented it from starting)\n this.sessionRecording?.startIfEnabledOrStop()\n\n // Reinitialize surveys if we're in cookieless mode and just opted in\n if (this.config.cookieless_mode == 'on_reject') {\n this.surveys.loadIfEnabled()\n }\n\n // Don't capture if captureEventName is null or false\n if (isUndefined(options?.captureEventName) || options?.captureEventName) {\n this.capture(options?.captureEventName ?? '$opt_in', options?.captureProperties, { send_instantly: true })\n }\n\n if (this.config.capture_pageview) {\n this._captureInitialPageview()\n }\n }\n\n /**\n * Opts the user out of data capturing and persistence.\n *\n * {@label Privacy}\n *\n * @remarks\n * Disables event tracking and data persistence (cookies/localStorage) for this PostHog instance.\n * If `opt_out_persistence_by_default` is true, SDK persistence will also be disabled.\n *\n * @example\n * ```js\n * // opt user out (e.g., on privacy settings page)\n * posthog.opt_out_capturing()\n * ```\n *\n * @public\n */\n opt_out_capturing(): void {\n if (this.config.cookieless_mode === 'always') {\n logger.warn('Consent opt in/out is not valid with cookieless_mode=\"always\" and will be ignored')\n return\n }\n\n if (this.config.cookieless_mode === 'on_reject' && this.consent.isOptedIn()) {\n // If the user has opted in, we need to reset the instance to ensure that there is no leaking of state or data between the cookieless and regular events\n this.reset(true)\n }\n\n this.consent.optInOut(false)\n this._sync_opt_out_with_persistence()\n\n if (this.config.cookieless_mode === 'on_reject') {\n // If cookieless_mode is 'on_reject', we start capturing events in cookieless mode\n this.register({\n distinct_id: COOKIELESS_SENTINEL_VALUE,\n $device_id: null,\n })\n this.sessionManager?.destroy()\n this.sessionManager = undefined\n this.sessionPropsManager = undefined\n this.sessionRecording?.stopRecording()\n this.sessionRecording = undefined\n this._captureInitialPageview()\n }\n }\n\n /**\n * Checks if the user has opted into data capturing.\n *\n * {@label Privacy}\n *\n * @remarks\n * Returns the current consent status for event tracking and data persistence.\n *\n * @example\n * ```js\n * if (posthog.has_opted_in_capturing()) {\n * // show analytics features\n * }\n * ```\n *\n * @public\n *\n * @returns {boolean} current opt-in status\n */\n has_opted_in_capturing(): boolean {\n return this.consent.isOptedIn()\n }\n\n /**\n * Checks if the user has opted out of data capturing.\n *\n * {@label Privacy}\n *\n * @remarks\n * Returns the current consent status for event tracking and data persistence.\n *\n * @example\n * ```js\n * if (posthog.has_opted_out_capturing()) {\n * // disable analytics features\n * }\n * ```\n *\n * @public\n *\n * @returns {boolean} current opt-out status\n */\n has_opted_out_capturing(): boolean {\n return this.consent.isOptedOut()\n }\n\n /**\n * Returns the explicit consent status of the user.\n *\n * @remarks\n * This can be used to check if the user has explicitly opted in or out of data capturing, or neither. This does not\n * take the default config options into account, only whether the user has made an explicit choice, so this can be\n * used to determine whether to show an initial cookie banner or not.\n *\n * @example\n * ```js\n * const consentStatus = posthog.get_explicit_consent_status()\n * if (consentStatus === \"granted\") {\n * // user has explicitly opted in\n * } else if (consentStatus === \"denied\") {\n * // user has explicitly opted out\n * } else if (consentStatus === \"pending\"){\n * // user has not made a choice, show consent banner\n * }\n * ```\n *\n * @public\n *\n * @returns {boolean | null} current explicit consent status\n */\n get_explicit_consent_status(): 'granted' | 'denied' | 'pending' {\n const consent = this.consent.consent\n return consent === ConsentStatus.GRANTED ? 'granted' : consent === ConsentStatus.DENIED ? 'denied' : 'pending'\n }\n\n /**\n * Checks whether the PostHog library is currently capturing events.\n *\n * Usually this means that the user has not opted out of capturing, but the exact behaviour can be controlled by\n * some config options.\n *\n * Additionally, if the cookieless_mode is set to 'on_reject', we will capture events in cookieless mode if the\n * user has explicitly opted out.\n *\n * {@label Privacy}\n *\n * @see {PostHogConfig.cookieless_mode}\n * @see {PostHogConfig.opt_out_persistence_by_default}\n * @see {PostHogConfig.respect_dnt}\n *\n * @returns {boolean} whether the posthog library is capturing events\n */\n is_capturing(): boolean {\n if (this.config.cookieless_mode === 'always') {\n return true\n }\n if (this.config.cookieless_mode === 'on_reject') {\n return this.consent.isExplicitlyOptedOut() || this.consent.isOptedIn()\n } else {\n return !this.has_opted_out_capturing()\n }\n }\n\n /**\n * Clear the user's opt in/out status of data capturing and cookies/localstorage for this PostHog instance\n *\n * {@label Privacy}\n *\n * @public\n *\n */\n clear_opt_in_out_capturing(): void {\n this.consent.reset()\n this._sync_opt_out_with_persistence()\n }\n\n _is_bot(): boolean | undefined {\n if (navigator) {\n return isLikelyBot(navigator, this.config.custom_blocked_useragents)\n } else {\n return undefined\n }\n }\n\n _captureInitialPageview(): void {\n if (!document) {\n return\n }\n\n // If page is not visible, add a listener to detect when the page becomes visible\n // and trigger the pageview only then\n // This is useful to avoid `prerender` calls from Chrome/Wordpress/SPAs\n // that are not visible to the user\n\n if (document.visibilityState !== 'visible') {\n if (!this._visibilityStateListener) {\n this._visibilityStateListener = this._captureInitialPageview.bind(this)\n addEventListener(document, 'visibilitychange', this._visibilityStateListener)\n }\n\n return\n }\n\n // Extra check here to guarantee we only ever trigger a single `$pageview` event\n if (!this._initialPageviewCaptured) {\n this._initialPageviewCaptured = true\n this.capture('$pageview', { title: document.title }, { send_instantly: true })\n\n // After we've captured the initial pageview, we can remove the listener\n if (this._visibilityStateListener) {\n document.removeEventListener('visibilitychange', this._visibilityStateListener)\n this._visibilityStateListener = null\n }\n }\n }\n\n /**\n * Enables or disables debug mode for detailed logging.\n *\n * @remarks\n * Debug mode logs all PostHog calls to the browser console for troubleshooting.\n * Can also be enabled by adding `?__posthog_debug=true` to the URL.\n *\n * {@label Initialization}\n *\n * @example\n * ```js\n * // enable debug mode\n * posthog.debug(true)\n * ```\n *\n * @example\n * ```js\n * // disable debug mode\n * posthog.debug(false)\n * ```\n *\n * @public\n *\n * @param {boolean} [debug] If true, will enable debug mode.\n */\n debug(debug?: boolean): void {\n if (debug === false) {\n window?.console.log(\"You've disabled debug mode.\")\n this.set_config({ debug: false })\n } else {\n window?.console.log(\n \"You're now in debug mode. All calls to PostHog will be logged in your console.\\nYou can disable this with `posthog.debug(false)`.\"\n )\n this.set_config({ debug: true })\n }\n }\n\n /**\n * Helper method to check if external API calls (flags/decide) should be disabled\n * Handles migration from old `advanced_disable_decide` to new `advanced_disable_flags`\n */\n _shouldDisableFlags(): boolean {\n // Check if advanced_disable_flags was explicitly set in original config\n const originalConfig = this._originalUserConfig || {}\n if ('advanced_disable_flags' in originalConfig) {\n return !!originalConfig.advanced_disable_flags\n }\n\n // Check if advanced_disable_flags was set post-init (different from default false)\n if (this.config.advanced_disable_flags !== false) {\n return !!this.config.advanced_disable_flags\n }\n\n // Check for post-init changes to advanced_disable_decide\n if (this.config.advanced_disable_decide === true) {\n logger.warn(\n \"Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. \" +\n 'The old field will be removed in a future major version.'\n )\n return true\n }\n\n // Fall back to migration logic for original user config\n return migrateConfigField(originalConfig, 'advanced_disable_flags', 'advanced_disable_decide', false, logger)\n }\n\n private _runBeforeSend(data: CaptureResult): CaptureResult | null {\n if (isNullish(this.config.before_send)) {\n return data\n }\n\n const fns = isArray(this.config.before_send) ? this.config.before_send : [this.config.before_send]\n let beforeSendResult: CaptureResult | null = data\n for (const fn of fns) {\n beforeSendResult = fn(beforeSendResult)\n if (isNullish(beforeSendResult)) {\n const logMessage = `Event '${data.event}' was rejected in beforeSend function`\n if (isKnownUnsafeEditableEvent(data.event)) {\n logger.warn(`${logMessage}. This can cause unexpected behavior.`)\n } else {\n logger.info(logMessage)\n }\n return null\n }\n if (!beforeSendResult.properties || isEmptyObject(beforeSendResult.properties)) {\n logger.warn(\n `Event '${data.event}' has no properties after beforeSend function, this is likely an error.`\n )\n }\n }\n return beforeSendResult\n }\n\n /**\n * Returns the current page view ID.\n *\n * {@label Initialization}\n *\n * @public\n *\n * @returns {string} The current page view ID\n */\n public getPageViewId(): string | undefined {\n return this.pageViewManager._currentPageview?.pageViewId\n }\n\n /**\n * Capture written user feedback for a LLM trace. Numeric values are converted to strings.\n *\n * {@label LLM analytics}\n *\n * @public\n *\n * @param traceId The trace ID to capture feedback for.\n * @param userFeedback The feedback to capture.\n */\n captureTraceFeedback(traceId: string | number, userFeedback: string) {\n this.capture('$ai_feedback', {\n $ai_trace_id: String(traceId),\n $ai_feedback_text: userFeedback,\n })\n }\n\n /**\n * Capture a metric for a LLM trace. Numeric values are converted to strings.\n *\n * {@label LLM analytics}\n *\n * @public\n *\n * @param traceId The trace ID to capture the metric for.\n * @param metricName The name of the metric to capture.\n * @param metricValue The value of the metric to capture.\n */\n captureTraceMetric(traceId: string | number, metricName: string, metricValue: string | number | boolean) {\n this.capture('$ai_metric', {\n $ai_trace_id: String(traceId),\n $ai_metric_name: metricName,\n $ai_metric_value: String(metricValue),\n })\n }\n\n private _checkLocalStorageForDebug(debugConfig: boolean | undefined) {\n const explicitlyFalse = isBoolean(debugConfig) && !debugConfig\n const isTrueInLocalStorage = localStore._is_supported() && localStore._get('ph_debug') === 'true'\n return explicitlyFalse ? false : isTrueInLocalStorage ? true : debugConfig\n }\n}\n\nsafewrapClass(PostHog, ['identify'])\n\nconst add_dom_loaded_handler = function () {\n // Cross browser DOM Loaded support\n function dom_loaded_handler() {\n // function flag since we only want to execute this once\n if ((dom_loaded_handler as any).done) {\n return\n }\n ;(dom_loaded_handler as any).done = true\n\n ENQUEUE_REQUESTS = false\n\n each(instances, function (inst: PostHog) {\n inst._dom_loaded()\n })\n }\n\n if (document?.addEventListener) {\n if (document.readyState === 'complete') {\n // safari 4 can fire the DOMContentLoaded event before loading all\n // external JS (including this file). you will see some copypasta\n // on the internet that checks for 'complete' and 'loaded', but\n // 'loaded' is an IE thing\n dom_loaded_handler()\n } else {\n addEventListener(document, 'DOMContentLoaded', dom_loaded_handler, { capture: false })\n }\n\n return\n }\n\n // Only IE6-8 don't support `document.addEventListener` and we don't support them\n // so let's simply log an error stating PostHog couldn't be initialized\n // We're checking for `window` to avoid erroring out on a SSR context\n if (window) {\n logger.error(\"Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized\")\n }\n}\n\nexport function init_from_snippet(): void {\n const posthogMain = (instances[PRIMARY_INSTANCE_NAME] = new PostHog())\n\n const snippetPostHog = assignableWindow['posthog']\n\n if (snippetPostHog) {\n /**\n * The snippet uses some clever tricks to allow deferred loading of array.js (this code)\n *\n * window.posthog is an array which the queue of calls made before the lib is loaded\n * It has methods attached to it to simulate the posthog object so for instance\n *\n * window.posthog.init(\"TOKEN\", {api_host: \"foo\" })\n * window.posthog.capture(\"my-event\", {foo: \"bar\" })\n *\n * ... will mean that window.posthog will look like this:\n * window.posthog == [\n * [\"my-event\", {foo: \"bar\"}]\n * ]\n *\n * window.posthog[_i] == [\n * [\"TOKEN\", {api_host: \"foo\" }, \"posthog\"]\n * ]\n *\n * If a name is given to the init function then the same as above is true but as a sub-property on the object:\n *\n * window.posthog.init(\"TOKEN\", {}, \"ph2\")\n * window.posthog.ph2.people.set({foo: \"bar\"})\n *\n * window.posthog.ph2 == []\n * window.posthog.people == [\n * [\"set\", {foo: \"bar\"}]\n * ]\n *\n */\n\n // Call all pre-loaded init calls properly\n\n each(snippetPostHog['_i'], function (item: [token: string, config: Partial<PostHogConfig>, name: string]) {\n if (item && isArray(item)) {\n const instance = posthogMain.init(item[0], item[1], item[2])\n\n const instanceSnippet = snippetPostHog[item[2]] || snippetPostHog\n\n if (instance) {\n // Crunch through the people queue first - we queue this data up &\n // flush on identify, so it's better to do all these operations first\n instance._execute_array.call(instance.people, instanceSnippet.people)\n instance._execute_array(instanceSnippet)\n }\n }\n })\n }\n\n assignableWindow['posthog'] = posthogMain\n\n add_dom_loaded_handler()\n}\n\nexport function init_as_module(): PostHog {\n const posthogMain = (instances[PRIMARY_INSTANCE_NAME] = new PostHog())\n\n add_dom_loaded_handler()\n\n return posthogMain\n}\n"]}
|
|
1
|
+
{"version":3,"file":"posthog-core.js","sourceRoot":"","sources":["../../src/posthog-core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgjHA,8CAyDC;AAED,wCAMC;AAjnHD,6CAA2C;AAC3C,oDAA6B;AAC7B,qCAAyD;AACzD,yCASoB;AACpB,gFAA+G;AAC/G,4EAAsE;AACtE,wEAAqE;AACrE,wEAA0E;AAC1E,sEAAgH;AAChH,gDAA8C;AAC9C,gEAA6D;AAC7D,sDAA8D;AAC9D,uCAAqC;AACrC,yCAA6C;AAC7C,2DAAwD;AACxD,+DAA4D;AAC5D,6DAA0D;AAC1D,iEAA6D;AAC7D,qDAAkD;AAClD,0FAAuF;AACvF,iEAMgC;AAChC,+CAA4C;AAC5C,iDAAoD;AACpD,qCAAsE;AACtE,iDAAyE;AACzE,6CAA0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;IAExB,OAAO,WAAW,CAAA;AACtB,CAAC","sourcesContent":["import { Autocapture } from './autocapture'\nimport Config from './config'\nimport { ConsentManager, ConsentStatus } from './consent'\nimport {\n ALIAS_ID_KEY,\n COOKIELESS_MODE_FLAG_PROPERTY,\n COOKIELESS_SENTINEL_VALUE,\n ENABLE_PERSON_PROCESSING,\n FLAG_CALL_REPORTED,\n PEOPLE_DISTINCT_ID_KEY,\n SURVEYS_REQUEST_TIMEOUT_MS,\n USER_STATE,\n} from './constants'\nimport { DeadClicksAutocapture, isDeadClicksEnabledForAutocapture } from './extensions/dead-clicks-autocapture'\nimport { ExceptionObserver } from './extensions/exception-autocapture'\nimport { HistoryAutocapture } from './extensions/history-autocapture'\nimport { setupSegmentIntegration } from './extensions/segment-integration'\nimport { SentryIntegration, sentryIntegration, SentryIntegrationOptions } from './extensions/sentry-integration'\nimport { Toolbar } from './extensions/toolbar'\nimport { TracingHeaders } from './extensions/tracing-headers'\nimport { WebVitalsAutocapture } from './extensions/web-vitals'\nimport { Heatmaps } from './heatmaps'\nimport { PageViewManager } from './page-view'\nimport { PostHogExceptions } from './posthog-exceptions'\nimport { PostHogFeatureFlags } from './posthog-featureflags'\nimport { PostHogPersistence } from './posthog-persistence'\nimport { PostHogProductTours } from './posthog-product-tours'\nimport { PostHogSurveys } from './posthog-surveys'\nimport { PostHogConversations } from './extensions/conversations/posthog-conversations'\nimport {\n DisplaySurveyOptions,\n SurveyCallback,\n SurveyEventName,\n SurveyEventProperties,\n SurveyRenderReason,\n} from './posthog-surveys-types'\nimport { RateLimiter } from './rate-limiter'\nimport { RemoteConfigLoader } from './remote-config'\nimport { extendURLParams, request, SUPPORTS_REQUEST } from './request'\nimport { DEFAULT_FLUSH_INTERVAL_MS, RequestQueue } from './request-queue'\nimport { RetryQueue } from './retry-queue'\nimport { ScrollManager } from './scroll-manager'\nimport { SessionPropsManager } from './session-props'\nimport { SessionIdManager } from './sessionid'\nimport { SiteApps } from './site-apps'\nimport { localStore } from './storage'\nimport {\n CaptureOptions,\n CaptureResult,\n Compression,\n ConfigDefaults,\n EarlyAccessFeatureCallback,\n EarlyAccessFeatureStage,\n EventName,\n ExceptionAutoCaptureConfig,\n FeatureFlagDetail,\n FeatureFlagsCallback,\n JsonType,\n OverrideConfig,\n PostHogConfig,\n Properties,\n Property,\n QueuedRequestWithOptions,\n RemoteConfig,\n RequestCallback,\n SessionIdChangedCallback,\n SnippetArrayItem,\n ToolbarParams,\n} from './types'\nimport {\n _copyAndTruncateStrings,\n addEventListener,\n each,\n eachArray,\n extend,\n isCrossDomainCookie,\n migrateConfigField,\n safewrapClass,\n} from './utils'\nimport { isLikelyBot } from './utils/blocked-uas'\nimport { getEventProperties } from './utils/event-utils'\nimport { assignableWindow, document, location, navigator, userAgent, window } from './utils/globals'\nimport { logger } from './utils/logger'\nimport { getPersonPropertiesHash } from './utils/property-utils'\nimport { RequestRouter, RequestRouterRegion } from './utils/request-router'\nimport { SimpleEventEmitter } from './utils/simple-event-emitter'\nimport {\n DEFAULT_DISPLAY_SURVEY_OPTIONS,\n getSurveyInteractionProperty,\n setSurveySeenOnLocalStorage,\n} from './utils/survey-utils'\nimport {\n isEmptyString,\n isFunction,\n isKnownUnsafeEditableEvent,\n isNullish,\n isNumber,\n isString,\n isUndefined,\n includes,\n isDistinctIdStringLike,\n isArray,\n isEmptyObject,\n isObject,\n isBoolean,\n} from '@posthog/core'\nimport { uuidv7 } from './uuidv7'\nimport { WebExperiments } from './web-experiments'\nimport { ExternalIntegrations } from './extensions/external-integration'\nimport { SessionRecording } from './extensions/replay/session-recording'\n\n/*\nSIMPLE STYLE GUIDE:\n\nUse TypeScript accessibility modifiers, e.g. private/protected\n\nIf something is not part of the public interface:\n* prefix it with _ to allow mangling\n* prefix it with __ to disable mangling, but signal that it is internal\n\nGlobals should be all caps\n*/\n\n/* posthog.init is called with `Partial<PostHogConfig>`\n * and we want to ensure that only valid keys are passed to the config object.\n * TypeScript does not enforce that the object passed does not have extra keys.\n * So someone can call with { bootstrap: { distinctId: '123'} }\n * which is not a valid key. They should have passed distinctID (upper case D).\n * That's a really tricky mistake to spot.\n * The OnlyValidKeys type ensures that only keys that are valid in the PostHogConfig type are allowed.\n */\ntype OnlyValidKeys<T, Shape> = T extends Shape ? (Exclude<keyof T, keyof Shape> extends never ? T : never) : never\n\nconst instances: Record<string, PostHog> = {}\n\n// some globals for comparisons\nconst __NOOP = () => {}\n\nconst PRIMARY_INSTANCE_NAME = 'posthog'\n\n/*\n * Dynamic... constants? Is that an oxymoron?\n */\n// http://hacks.mozilla.org/2009/07/cross-site-xmlhttprequest-with-cors/\n// https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#withCredentials\n\n// IE<10 does not support cross-origin XHR's but script tags\n// with defer won't block window.onload; ENQUEUE_REQUESTS\n// should only be true for Opera<12\nlet ENQUEUE_REQUESTS = !SUPPORTS_REQUEST && userAgent?.indexOf('MSIE') === -1 && userAgent?.indexOf('Mozilla') === -1\n\nconst defaultsThatVaryByConfig = (\n defaults?: ConfigDefaults\n): Pick<PostHogConfig, 'rageclick' | 'capture_pageview' | 'session_recording'> => ({\n rageclick: defaults && defaults >= '2025-11-30' ? { content_ignorelist: true } : true,\n capture_pageview: defaults && defaults >= '2025-05-24' ? 'history_change' : true,\n session_recording: defaults && defaults >= '2025-11-30' ? { strictMinimumDuration: true } : {},\n})\n\n// NOTE: Remember to update `types.ts` when changing a default value\n// to guarantee documentation is up to date, make sure to also update our website docs\n// NOTE²: This shouldn't ever change because we try very hard to be backwards-compatible\nexport const defaultConfig = (defaults?: ConfigDefaults): PostHogConfig => ({\n api_host: 'https://us.i.posthog.com',\n flags_api_host: null,\n ui_host: null,\n token: '',\n autocapture: true,\n cross_subdomain_cookie: isCrossDomainCookie(document?.location),\n persistence: 'localStorage+cookie', // up to 1.92.0 this was 'cookie'. It's easy to migrate as 'localStorage+cookie' will migrate data from cookie storage\n persistence_name: '',\n loaded: __NOOP,\n save_campaign_params: true,\n custom_campaign_params: [],\n custom_blocked_useragents: [],\n save_referrer: true,\n capture_pageleave: 'if_capture_pageview', // We'll only capture pageleave events if capture_pageview is also true\n defaults: defaults ?? 'unset',\n __preview_deferred_init_extensions: false, // Opt-in only for now\n debug: (location && isString(location?.search) && location.search.indexOf('__posthog_debug=true') !== -1) || false,\n cookie_expiration: 365,\n upgrade: false,\n disable_session_recording: false,\n disable_persistence: false,\n disable_web_experiments: true, // disabled in beta.\n disable_surveys: false,\n disable_surveys_automatic_display: false,\n disable_conversations: false,\n disable_product_tours: true,\n disable_external_dependency_loading: false,\n enable_recording_console_log: undefined, // When undefined, it falls back to the server-side setting\n secure_cookie: window?.location?.protocol === 'https:',\n ip: false,\n opt_out_capturing_by_default: false,\n opt_out_persistence_by_default: false,\n opt_out_useragent_filter: false,\n opt_out_capturing_persistence_type: 'localStorage',\n consent_persistence_name: null,\n opt_out_capturing_cookie_prefix: null,\n opt_in_site_apps: false,\n property_denylist: [],\n respect_dnt: false,\n sanitize_properties: null,\n request_headers: {}, // { header: value, header2: value }\n request_batching: true,\n properties_string_max_length: 65535,\n mask_all_element_attributes: false,\n mask_all_text: false,\n mask_personal_data_properties: false,\n custom_personal_data_properties: [],\n advanced_disable_flags: false,\n advanced_disable_decide: false,\n advanced_disable_feature_flags: false,\n advanced_disable_feature_flags_on_first_load: false,\n advanced_only_evaluate_survey_feature_flags: false,\n advanced_enable_surveys: false,\n advanced_disable_toolbar_metrics: false,\n feature_flag_request_timeout_ms: 3000,\n surveys_request_timeout_ms: SURVEYS_REQUEST_TIMEOUT_MS,\n on_request_error: (res) => {\n const error = 'Bad HTTP status: ' + res.statusCode + ' ' + res.text\n logger.error(error)\n },\n get_device_id: (uuid) => uuid,\n capture_performance: undefined,\n name: 'posthog',\n bootstrap: {},\n disable_compression: false,\n session_idle_timeout_seconds: 30 * 60, // 30 minutes\n person_profiles: 'identified_only',\n before_send: undefined,\n request_queue_config: { flush_interval_ms: DEFAULT_FLUSH_INTERVAL_MS },\n error_tracking: {},\n\n // Used for internal testing\n _onCapture: __NOOP,\n\n // make the default be lazy loading replay\n __preview_eager_load_replay: false,\n\n ...defaultsThatVaryByConfig(defaults),\n})\n\nexport const configRenames = (origConfig: Partial<PostHogConfig>): Partial<PostHogConfig> => {\n const renames: Partial<PostHogConfig> = {}\n if (!isUndefined(origConfig.process_person)) {\n renames.person_profiles = origConfig.process_person\n }\n if (!isUndefined(origConfig.xhr_headers)) {\n renames.request_headers = origConfig.xhr_headers\n }\n if (!isUndefined(origConfig.cookie_name)) {\n renames.persistence_name = origConfig.cookie_name\n }\n if (!isUndefined(origConfig.disable_cookie)) {\n renames.disable_persistence = origConfig.disable_cookie\n }\n if (!isUndefined(origConfig.store_google)) {\n renames.save_campaign_params = origConfig.store_google\n }\n if (!isUndefined(origConfig.verbose)) {\n renames.debug = origConfig.verbose\n }\n // on_xhr_error is not present, as the type is different to on_request_error\n\n // the original config takes priority over the renames\n const newConfig = extend({}, renames, origConfig)\n\n // merge property_blacklist into property_denylist\n if (isArray(origConfig.property_blacklist)) {\n if (isUndefined(origConfig.property_denylist)) {\n newConfig.property_denylist = origConfig.property_blacklist\n } else if (isArray(origConfig.property_denylist)) {\n newConfig.property_denylist = [...origConfig.property_blacklist, ...origConfig.property_denylist]\n } else {\n logger.error('Invalid value for property_denylist config: ' + origConfig.property_denylist)\n }\n }\n\n return newConfig\n}\n\nclass DeprecatedWebPerformanceObserver {\n get _forceAllowLocalhost(): boolean {\n return this.__forceAllowLocalhost\n }\n\n set _forceAllowLocalhost(value: boolean) {\n logger.error(\n 'WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`'\n )\n this.__forceAllowLocalhost = value\n }\n\n private __forceAllowLocalhost: boolean = false\n}\n\n/**\n *\n * This is the SDK reference for the PostHog JavaScript Web SDK.\n * You can learn more about example usage in the\n * [JavaScript Web SDK documentation](/docs/libraries/js).\n * You can also follow [framework specific guides](/docs/frameworks)\n * to integrate PostHog into your project.\n *\n * This SDK is designed for browser environments.\n * Use the PostHog [Node.js SDK](/docs/libraries/node) for server-side usage.\n *\n * @constructor\n */\nexport class PostHog {\n __loaded: boolean\n config: PostHogConfig\n _originalUserConfig?: Partial<PostHogConfig>\n\n rateLimiter: RateLimiter\n scrollManager: ScrollManager\n pageViewManager: PageViewManager\n featureFlags: PostHogFeatureFlags\n surveys: PostHogSurveys\n conversations: PostHogConversations\n experiments: WebExperiments\n toolbar: Toolbar\n exceptions: PostHogExceptions\n consent: ConsentManager\n\n // These are instance-specific state created after initialisation\n persistence?: PostHogPersistence\n sessionPersistence?: PostHogPersistence\n sessionManager?: SessionIdManager\n sessionPropsManager?: SessionPropsManager\n requestRouter: RequestRouter\n siteApps?: SiteApps\n autocapture?: Autocapture\n heatmaps?: Heatmaps\n webVitalsAutocapture?: WebVitalsAutocapture\n exceptionObserver?: ExceptionObserver\n deadClicksAutocapture?: DeadClicksAutocapture\n historyAutocapture?: HistoryAutocapture\n productTours?: PostHogProductTours\n\n _requestQueue?: RequestQueue\n _retryQueue?: RetryQueue\n sessionRecording?: SessionRecording\n externalIntegrations?: ExternalIntegrations\n webPerformance = new DeprecatedWebPerformanceObserver()\n\n _initialPageviewCaptured: boolean\n _visibilityStateListener: (() => void) | null\n _personProcessingSetOncePropertiesSent: boolean = false\n _triggered_notifs: any\n compression?: Compression\n __request_queue: QueuedRequestWithOptions[]\n _pendingRemoteConfig?: RemoteConfig\n analyticsDefaultEndpoint: string\n version = Config.LIB_VERSION\n _initialPersonProfilesConfig: 'always' | 'never' | 'identified_only' | null\n _cachedPersonProperties: string | null\n\n SentryIntegration: typeof SentryIntegration\n sentryIntegration: (options?: SentryIntegrationOptions) => ReturnType<typeof sentryIntegration>\n\n private _internalEventEmitter = new SimpleEventEmitter()\n\n // Legacy property to support existing usage - this isn't technically correct but it's what it has always been - a proxy for flags being loaded\n /** @deprecated Use `flagsEndpointWasHit` instead. We migrated to using a new feature flag endpoint and the new method is more semantically accurate */\n public get decideEndpointWasHit(): boolean {\n return this.featureFlags?.hasLoadedFlags ?? false\n }\n\n public get flagsEndpointWasHit(): boolean {\n return this.featureFlags?.hasLoadedFlags ?? false\n }\n\n /** DEPRECATED: We keep this to support existing usage but now one should just call .setPersonProperties */\n people: {\n set: (prop: string | Properties, to?: string, callback?: RequestCallback) => void\n set_once: (prop: string | Properties, to?: string, callback?: RequestCallback) => void\n }\n\n constructor() {\n this.config = defaultConfig()\n\n this.SentryIntegration = SentryIntegration\n this.sentryIntegration = (options?: SentryIntegrationOptions) => sentryIntegration(this, options)\n this.__request_queue = []\n this.__loaded = false\n this.analyticsDefaultEndpoint = '/e/'\n this._initialPageviewCaptured = false\n this._visibilityStateListener = null\n this._initialPersonProfilesConfig = null\n this._cachedPersonProperties = null\n this.featureFlags = new PostHogFeatureFlags(this)\n this.toolbar = new Toolbar(this)\n this.scrollManager = new ScrollManager(this)\n this.pageViewManager = new PageViewManager(this)\n this.surveys = new PostHogSurveys(this)\n this.conversations = new PostHogConversations(this)\n this.experiments = new WebExperiments(this)\n this.exceptions = new PostHogExceptions(this)\n this.rateLimiter = new RateLimiter(this)\n this.requestRouter = new RequestRouter(this)\n this.consent = new ConsentManager(this)\n this.externalIntegrations = new ExternalIntegrations(this)\n // NOTE: See the property definition for deprecation notice\n this.people = {\n set: (prop: string | Properties, to?: string, callback?: RequestCallback) => {\n const setProps = isString(prop) ? { [prop]: to } : prop\n this.setPersonProperties(setProps)\n callback?.({} as any)\n },\n set_once: (prop: string | Properties, to?: string, callback?: RequestCallback) => {\n const setProps = isString(prop) ? { [prop]: to } : prop\n this.setPersonProperties(undefined, setProps)\n callback?.({} as any)\n },\n }\n\n this.on('eventCaptured', (data) => logger.info(`send \"${data?.event}\"`, data))\n }\n\n // Initialization methods\n\n /**\n * Initializes a new instance of the PostHog capturing object.\n *\n * @remarks\n * All new instances are added to the main posthog object as sub properties (such as\n * `posthog.library_name`) and also returned by this function. [Learn more about configuration options](https://github.com/posthog/posthog-js/blob/6e0e873/src/posthog-core.js#L57-L91)\n *\n * @example\n * ```js\n * // basic initialization\n * posthog.init('<ph_project_api_key>', {\n * api_host: '<ph_client_api_host>'\n * })\n * ```\n *\n * @example\n * ```js\n * // multiple instances\n * posthog.init('<ph_project_api_key>', {}, 'project1')\n * posthog.init('<ph_project_api_key>', {}, 'project2')\n * ```\n *\n * @public\n *\n * @param token - Your PostHog API token\n * @param config - A dictionary of config options to override\n * @param name - The name for the new posthog instance that you want created\n *\n * {@label Initialization}\n *\n * @returns The newly initialized PostHog instance\n */\n init(\n token: string,\n config?: OnlyValidKeys<Partial<PostHogConfig>, Partial<PostHogConfig>>,\n name?: string\n ): PostHog {\n if (!name || name === PRIMARY_INSTANCE_NAME) {\n // This means we are initializing the primary instance (i.e. this)\n return this._init(token, config, name)\n } else {\n const namedPosthog = instances[name] ?? new PostHog()\n namedPosthog._init(token, config, name)\n instances[name] = namedPosthog\n\n // Add as a property to the primary instance (this isn't type-safe but it is how it was always done)\n ;(instances[PRIMARY_INSTANCE_NAME] as any)[name] = namedPosthog\n\n return namedPosthog\n }\n }\n\n // posthog._init(token:string, config:object, name:string)\n //\n // This function sets up the current instance of the posthog\n // library. The difference between this method and the init(...)\n // method is this one initializes the actual instance, whereas the\n // init(...) method sets up a new library and calls _init on it.\n //\n // Note that there are operations that can be asynchronous, so we\n // accept a callback that is called when all the asynchronous work\n // is done. Note that we do not use promises because we want to be\n // IE11 compatible. We could use polyfills, which would make the\n // code a bit cleaner, but will add some overhead.\n //\n _init(token: string, config: Partial<PostHogConfig> = {}, name?: string): PostHog {\n if (isUndefined(token) || isEmptyString(token)) {\n logger.critical(\n 'PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()'\n )\n return this\n }\n\n if (this.__loaded) {\n // need to be able to log before having processed debug config\n // eslint-disable-next-line no-console\n console.warn('[PostHog.js]', 'You have already initialized PostHog! Re-initializing is a no-op')\n return this\n }\n\n this.__loaded = true\n this.config = {} as PostHogConfig // will be set right below\n config.debug = this._checkLocalStorageForDebug(config.debug)\n this._originalUserConfig = config // Store original user config for migration\n\n this._triggered_notifs = []\n\n if (config.person_profiles) {\n this._initialPersonProfilesConfig = config.person_profiles\n }\n\n this.set_config(\n extend({}, defaultConfig(config.defaults), configRenames(config), {\n name: name,\n token: token,\n })\n )\n\n if (this.config.on_xhr_error) {\n logger.error('on_xhr_error is deprecated. Use on_request_error instead')\n }\n\n this.compression = config.disable_compression ? undefined : Compression.GZipJS\n\n const persistenceDisabled = this._is_persistence_disabled()\n\n this.persistence = new PostHogPersistence(this.config, persistenceDisabled)\n this.sessionPersistence =\n this.config.persistence === 'sessionStorage' || this.config.persistence === 'memory'\n ? this.persistence\n : new PostHogPersistence({ ...this.config, persistence: 'sessionStorage' }, persistenceDisabled)\n\n // should I store the initial person profiles config in persistence?\n const initialPersistenceProps = { ...this.persistence.props }\n const initialSessionProps = { ...this.sessionPersistence.props }\n\n this.register({ $initialization_time: new Date().toISOString() })\n\n this._requestQueue = new RequestQueue(\n (req) => this._send_retriable_request(req),\n this.config.request_queue_config\n )\n this._retryQueue = new RetryQueue(this)\n this.__request_queue = []\n\n const startInCookielessMode =\n this.config.cookieless_mode === 'always' ||\n (this.config.cookieless_mode === 'on_reject' && this.consent.isExplicitlyOptedOut())\n\n if (!startInCookielessMode) {\n this.sessionManager = new SessionIdManager(this)\n this.sessionPropsManager = new SessionPropsManager(this, this.sessionManager, this.persistence)\n }\n\n // Conditionally defer extension initialization based on config\n if (this.config.__preview_deferred_init_extensions) {\n // EXPERIMENTAL: Defer non-critical extension initialization to next tick\n // This reduces main thread blocking during init\n // while keeping critical path (persistence, sessions, capture) synchronous\n logger.info('Deferring extension initialization to improve startup performance')\n setTimeout(() => {\n this._initExtensions(startInCookielessMode)\n }, 0)\n } else {\n // Legacy synchronous initialization (default for now)\n logger.info('Initializing extensions synchronously')\n this._initExtensions(startInCookielessMode)\n }\n\n // if any instance on the page has debug = true, we set the\n // global debug to be true\n Config.DEBUG = Config.DEBUG || this.config.debug\n if (Config.DEBUG) {\n logger.info('Starting in debug mode', {\n this: this,\n config,\n thisC: { ...this.config },\n p: initialPersistenceProps,\n s: initialSessionProps,\n })\n }\n\n // isUndefined doesn't provide typehint here so wouldn't reduce bundle as we'd need to assign\n // eslint-disable-next-line posthog-js/no-direct-undefined-check\n if (config.bootstrap?.distinctID !== undefined) {\n const uuid = this.config.get_device_id(uuidv7())\n const deviceID = config.bootstrap?.isIdentifiedID ? uuid : config.bootstrap.distinctID\n this.persistence.set_property(USER_STATE, config.bootstrap?.isIdentifiedID ? 'identified' : 'anonymous')\n this.register({\n distinct_id: config.bootstrap.distinctID,\n $device_id: deviceID,\n })\n }\n\n if (this._hasBootstrappedFeatureFlags()) {\n const activeFlags = Object.keys(config.bootstrap?.featureFlags || {})\n .filter((flag) => !!config.bootstrap?.featureFlags?.[flag])\n .reduce((res: Record<string, string | boolean>, key) => {\n res[key] = config.bootstrap?.featureFlags?.[key] || false\n return res\n }, {})\n const featureFlagPayloads = Object.keys(config.bootstrap?.featureFlagPayloads || {})\n .filter((key) => activeFlags[key])\n .reduce((res: Record<string, JsonType>, key) => {\n if (config.bootstrap?.featureFlagPayloads?.[key]) {\n res[key] = config.bootstrap?.featureFlagPayloads?.[key]\n }\n return res\n }, {})\n\n this.featureFlags.receivedFeatureFlags({ featureFlags: activeFlags, featureFlagPayloads })\n }\n\n if (startInCookielessMode) {\n this.register_once(\n {\n distinct_id: COOKIELESS_SENTINEL_VALUE,\n $device_id: null,\n },\n ''\n )\n } else if (!this.get_distinct_id()) {\n // There is no need to set the distinct id\n // or the device id if something was already stored\n // in the persistence\n const uuid = this.config.get_device_id(uuidv7())\n\n this.register_once(\n {\n distinct_id: uuid,\n $device_id: uuid,\n },\n ''\n )\n // distinct id == $device_id is a proxy for anonymous user\n this.persistence.set_property(USER_STATE, 'anonymous')\n }\n // Set up event handler for pageleave\n // Use `onpagehide` if available, see https://calendar.perfplanet.com/2020/beaconing-in-practice/#beaconing-reliability-avoiding-abandons\n //\n // Not making it passive to try and force the browser to handle this before the page is unloaded\n addEventListener(window, 'onpagehide' in self ? 'pagehide' : 'unload', this._handle_unload.bind(this), {\n passive: false,\n })\n\n this.toolbar.maybeLoadToolbar()\n\n // We want to avoid promises for IE11 compatibility, so we use callbacks here\n if (config.segment) {\n setupSegmentIntegration(this, () => this._loaded())\n } else {\n this._loaded()\n }\n\n if (isFunction(this.config._onCapture) && this.config._onCapture !== __NOOP) {\n logger.warn('onCapture is deprecated. Please use `before_send` instead')\n this.on('eventCaptured', (data) => this.config._onCapture(data.event, data))\n }\n\n if (this.config.ip) {\n logger.warn(\n 'The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or \"Discard IP data\" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'\n )\n }\n\n return this\n }\n\n private _initExtensions(startInCookielessMode: boolean): void {\n // we don't support IE11 anymore, so performance.now is safe\n // eslint-disable-next-line compat/compat\n const initStartTime = performance.now()\n\n this.historyAutocapture = new HistoryAutocapture(this)\n this.historyAutocapture.startIfEnabled()\n\n // Build queue of extension initialization tasks\n const initTasks: Array<() => void> = []\n\n initTasks.push(() => {\n new TracingHeaders(this).startIfEnabledOrStop()\n })\n\n initTasks.push(() => {\n this.siteApps = new SiteApps(this)\n this.siteApps?.init()\n })\n\n if (!startInCookielessMode) {\n initTasks.push(() => {\n this.sessionRecording = new SessionRecording(this)\n this.sessionRecording.startIfEnabledOrStop()\n })\n }\n\n if (!this.config.disable_scroll_properties) {\n initTasks.push(() => {\n this.scrollManager.startMeasuringScrollPosition()\n })\n }\n\n initTasks.push(() => {\n this.autocapture = new Autocapture(this)\n this.autocapture.startIfEnabled()\n })\n\n initTasks.push(() => {\n this.surveys.loadIfEnabled()\n })\n\n initTasks.push(() => {\n this.conversations.loadIfEnabled()\n })\n\n initTasks.push(() => {\n this.productTours = new PostHogProductTours(this)\n this.productTours.loadIfEnabled()\n })\n\n initTasks.push(() => {\n this.heatmaps = new Heatmaps(this)\n this.heatmaps.startIfEnabled()\n })\n\n initTasks.push(() => {\n this.webVitalsAutocapture = new WebVitalsAutocapture(this)\n })\n\n initTasks.push(() => {\n this.exceptionObserver = new ExceptionObserver(this)\n this.exceptionObserver.startIfEnabledOrStop()\n })\n\n initTasks.push(() => {\n this.deadClicksAutocapture = new DeadClicksAutocapture(this, isDeadClicksEnabledForAutocapture)\n this.deadClicksAutocapture.startIfEnabled()\n })\n\n // Replay any pending remote config that arrived before extensions were ready\n initTasks.push(() => {\n if (this._pendingRemoteConfig) {\n const config = this._pendingRemoteConfig\n this._pendingRemoteConfig = undefined // Clear before replaying to avoid re-storing\n this._onRemoteConfig(config)\n }\n })\n\n // Process tasks with time-slicing to avoid blocking\n this._processInitTaskQueue(initTasks, initStartTime)\n }\n\n private _processInitTaskQueue(queue: Array<() => void>, initStartTime: number): void {\n const TIME_BUDGET_MS = 30 // Respect frame budget (~60fps = 16ms, but we're already deferred)\n\n while (queue.length > 0) {\n // Only time-slice if deferred init is enabled, otherwise run synchronously\n if (this.config.__preview_deferred_init_extensions) {\n // we don't support IE11 anymore, so performance.now is safe\n // eslint-disable-next-line compat/compat\n const elapsed = performance.now() - initStartTime\n\n // Check if we've exceeded our time budget\n if (elapsed >= TIME_BUDGET_MS && queue.length > 0) {\n // Yield to browser, then continue processing\n setTimeout(() => {\n this._processInitTaskQueue(queue, initStartTime)\n }, 0)\n return\n }\n }\n\n // Process next task\n const task = queue.shift()\n if (task) {\n try {\n task()\n } catch (error) {\n logger.error('Error initializing extension:', error)\n }\n }\n }\n\n // All tasks complete - record timing for both sync and deferred modes\n // we don't support IE11 anymore, so performance.now is safe\n // eslint-disable-next-line compat/compat\n const taskInitTiming = Math.round(performance.now() - initStartTime)\n this.register_for_session({\n $sdk_debug_extensions_init_method: this.config.__preview_deferred_init_extensions\n ? 'deferred'\n : 'synchronous',\n $sdk_debug_extensions_init_time_ms: taskInitTiming,\n })\n if (this.config.__preview_deferred_init_extensions) {\n logger.info(`PostHog extensions initialized (${taskInitTiming}ms)`)\n }\n }\n\n _onRemoteConfig(config: RemoteConfig) {\n if (!(document && document.body)) {\n logger.info('document not ready yet, trying again in 500 milliseconds...')\n setTimeout(() => {\n this._onRemoteConfig(config)\n }, 500)\n return\n }\n\n // Store config in case extensions aren't initialized yet (only needed for deferred init)\n if (this.config.__preview_deferred_init_extensions) {\n this._pendingRemoteConfig = config\n }\n\n this.compression = undefined\n if (config.supportedCompression && !this.config.disable_compression) {\n this.compression = includes(config['supportedCompression'], Compression.GZipJS)\n ? Compression.GZipJS\n : includes(config['supportedCompression'], Compression.Base64)\n ? Compression.Base64\n : undefined\n }\n\n if (config.analytics?.endpoint) {\n this.analyticsDefaultEndpoint = config.analytics.endpoint\n }\n\n this.set_config({\n person_profiles: this._initialPersonProfilesConfig ? this._initialPersonProfilesConfig : 'identified_only',\n })\n\n this.siteApps?.onRemoteConfig(config)\n this.sessionRecording?.onRemoteConfig(config)\n this.autocapture?.onRemoteConfig(config)\n this.heatmaps?.onRemoteConfig(config)\n this.surveys.onRemoteConfig(config)\n this.conversations.onRemoteConfig(config)\n this.productTours?.onRemoteConfig(config)\n this.webVitalsAutocapture?.onRemoteConfig(config)\n this.exceptionObserver?.onRemoteConfig(config)\n this.exceptions.onRemoteConfig(config)\n this.deadClicksAutocapture?.onRemoteConfig(config)\n }\n\n _loaded(): void {\n try {\n this.config.loaded(this)\n } catch (err) {\n logger.critical('`loaded` function failed', err)\n }\n\n this._start_queue_if_opted_in()\n\n // this happens after \"loaded\" so a user can call identify or any other things before the pageview fires\n if (this.config.capture_pageview) {\n // NOTE: We want to fire this on the next tick as the previous implementation had this side effect\n // and some clients may rely on it\n setTimeout(() => {\n if (this.consent.isOptedIn() || this.config.cookieless_mode === 'always') {\n this._captureInitialPageview()\n }\n }, 1)\n }\n\n new RemoteConfigLoader(this).load()\n this.featureFlags.flags()\n }\n\n _start_queue_if_opted_in(): void {\n if (this.is_capturing()) {\n if (this.config.request_batching) {\n this._requestQueue?.enable()\n }\n }\n }\n\n _dom_loaded(): void {\n if (this.is_capturing()) {\n eachArray(this.__request_queue, (item) => this._send_retriable_request(item))\n }\n\n this.__request_queue = []\n this._start_queue_if_opted_in()\n }\n\n _handle_unload(): void {\n this.surveys.handlePageUnload()\n\n if (!this.config.request_batching) {\n if (this._shouldCapturePageleave()) {\n this.capture('$pageleave', null, { transport: 'sendBeacon' })\n }\n return\n }\n\n if (this._shouldCapturePageleave()) {\n this.capture('$pageleave')\n }\n\n this._requestQueue?.unload()\n this._retryQueue?.unload()\n }\n\n _send_request(options: QueuedRequestWithOptions): void {\n if (!this.__loaded) {\n return\n }\n\n if (ENQUEUE_REQUESTS) {\n this.__request_queue.push(options)\n return\n }\n\n if (this.rateLimiter.isServerRateLimited(options.batchKey)) {\n return\n }\n\n options.transport = options.transport || this.config.api_transport\n options.url = extendURLParams(options.url, {\n // Whether to detect ip info or not\n ip: this.config.ip ? 1 : 0,\n })\n options.headers = {\n ...this.config.request_headers,\n ...options.headers,\n }\n options.compression = options.compression === 'best-available' ? this.compression : options.compression\n options.disableXHRCredentials = this.config.__preview_disable_xhr_credentials\n if (this.config.__preview_disable_beacon) {\n options.disableTransport = ['sendBeacon']\n }\n\n // Specially useful if you're doing SSR with NextJS\n // Users must be careful when tweaking `cache` because they might get out-of-date feature flags\n options.fetchOptions = options.fetchOptions || this.config.fetch_options\n\n request({\n ...options,\n callback: (response) => {\n this.rateLimiter.checkForLimiting(response)\n\n if (response.statusCode >= 400) {\n this.config.on_request_error?.(response)\n }\n\n options.callback?.(response)\n },\n })\n }\n\n _send_retriable_request(options: QueuedRequestWithOptions): void {\n if (this._retryQueue) {\n this._retryQueue.retriableRequest(options)\n } else {\n this._send_request(options)\n }\n }\n\n /**\n * _execute_array() deals with processing any posthog function\n * calls that were called before the PostHog library were loaded\n * (and are thus stored in an array so they can be called later)\n *\n * Note: we fire off all the posthog function calls && user defined\n * functions BEFORE we fire off posthog capturing calls. This is so\n * identify/register/set_config calls can properly modify early\n * capturing calls.\n *\n * @param {Array} array\n */\n _execute_array(array: SnippetArrayItem[]): void {\n let fn_name\n const alias_calls: SnippetArrayItem[] = []\n const other_calls: SnippetArrayItem[] = []\n const capturing_calls: SnippetArrayItem[] = []\n eachArray(array, (item) => {\n if (item) {\n fn_name = item[0]\n if (isArray(fn_name)) {\n capturing_calls.push(item) // chained call e.g. posthog.get_group().set()\n } else if (isFunction(item)) {\n ;(item as any).call(this)\n } else if (isArray(item) && fn_name === 'alias') {\n alias_calls.push(item)\n } else if (isArray(item) && fn_name.indexOf('capture') !== -1 && isFunction((this as any)[fn_name])) {\n capturing_calls.push(item)\n } else {\n other_calls.push(item)\n }\n }\n })\n\n const execute = function (calls: SnippetArrayItem[], thisArg: any) {\n eachArray(\n calls,\n function (item) {\n if (isArray(item[0])) {\n // chained call\n let caller = thisArg\n each(item, function (call) {\n caller = caller[call[0]].apply(caller, call.slice(1))\n })\n } else {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this[item[0]].apply(this, item.slice(1))\n }\n },\n thisArg\n )\n }\n\n execute(alias_calls, this)\n execute(other_calls, this)\n execute(capturing_calls, this)\n }\n\n _hasBootstrappedFeatureFlags(): boolean {\n return (\n (this.config.bootstrap?.featureFlags && Object.keys(this.config.bootstrap?.featureFlags).length > 0) ||\n false\n )\n }\n\n /**\n * push() keeps the standard async-array-push\n * behavior around after the lib is loaded.\n * This is only useful for external integrations that\n * do not wish to rely on our convenience methods\n * (created in the snippet).\n *\n * @example\n * ```js\n * posthog.push(['register', { a: 'b' }]);\n * ```\n *\n * @param {Array} item A [function_name, args...] array to be executed\n */\n push(item: SnippetArrayItem): void {\n this._execute_array([item])\n }\n\n /**\n * Captures an event with optional properties and configuration.\n *\n * @remarks\n * You can capture arbitrary object-like values as events. [Learn about capture best practices](/docs/product-analytics/capture-events)\n *\n * @example\n * ```js\n * // basic event capture\n * posthog.capture('cta-button-clicked', {\n * button_name: 'Get Started',\n * page: 'homepage'\n * })\n * ```\n *\n * {@label Capture}\n *\n * @public\n *\n * @param event_name - The name of the event (e.g., 'Sign Up', 'Button Click', 'Purchase')\n * @param properties - Properties to include with the event describing the user or event details\n * @param options - Optional configuration for the capture request\n *\n * @returns The capture result containing event data, or undefined if capture failed\n */\n capture(\n event_name: EventName,\n properties?: Properties | null,\n options?: CaptureOptions\n ): CaptureResult | undefined {\n // While developing, a developer might purposefully _not_ call init(),\n // in this case, we would like capture to be a noop.\n if (!this.__loaded || !this.persistence || !this.sessionPersistence || !this._requestQueue) {\n logger.uninitializedWarning('posthog.capture')\n return\n }\n\n if (!this.is_capturing()) {\n return\n }\n\n // typing doesn't prevent interesting data\n if (isUndefined(event_name) || !isString(event_name)) {\n logger.error('No event name provided to posthog.capture')\n return\n }\n\n const isBot = !this.config.opt_out_useragent_filter && this._is_bot()\n const shouldDropBotEvent = isBot && !this.config.__preview_capture_bot_pageviews\n\n // We drop bot events unless the preview flag to send bot pageviews is enabled\n // or the user has explicitly opted out of useragent filtering\n if (shouldDropBotEvent) {\n return\n }\n\n const clientRateLimitContext = !options?.skip_client_rate_limiting\n ? this.rateLimiter.clientRateLimitContext()\n : undefined\n\n if (clientRateLimitContext?.isRateLimited) {\n logger.critical('This capture call is ignored due to client rate limiting.')\n return\n }\n\n if (properties?.$current_url && !isString(properties?.$current_url)) {\n logger.error(\n 'Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value.'\n )\n delete properties?.$current_url\n }\n\n // update persistence\n this.sessionPersistence.update_search_keyword()\n\n // The initial campaign/referrer props need to be stored in the regular persistence, as they are there to mimic\n // the person-initial props. The non-initial versions are stored in the sessionPersistence, as they are sent\n // with every event and used by the session table to create session-initial props.\n if (this.config.save_campaign_params) {\n this.sessionPersistence.update_campaign_params()\n }\n if (this.config.save_referrer) {\n this.sessionPersistence.update_referrer_info()\n }\n\n if (this.config.save_campaign_params || this.config.save_referrer) {\n this.persistence.set_initial_person_info()\n }\n\n const systemTime = new Date()\n const timestamp = options?.timestamp || systemTime\n\n const uuid = uuidv7()\n let data: CaptureResult = {\n uuid,\n event: event_name,\n properties: this.calculateEventProperties(event_name, properties || {}, timestamp, uuid),\n }\n\n // Route pageviews to $bot_pageview when bot detected and preview flag enabled\n if (event_name === '$pageview' && this.config.__preview_capture_bot_pageviews && isBot) {\n data.event = '$bot_pageview'\n // While it's obvious that a $bot_pageview is (likely) from a bot, we explicitly set $browser_type\n // to make it easy to filter and test bot pageviews in the product\n data.properties.$browser_type = 'bot'\n }\n\n if (clientRateLimitContext) {\n data.properties['$lib_rate_limit_remaining_tokens'] = clientRateLimitContext.remainingTokens\n }\n\n const setProperties = options?.$set\n if (setProperties) {\n data.$set = options?.$set\n }\n // $groupidentify doesn't process person $set_once on the server, so don't mark\n // initial person props as sent. This ensures they're included with subsequent\n // $identify calls.\n const markSetOnceAsSent = event_name !== '$groupidentify'\n const setOnceProperties = this._calculate_set_once_properties(options?.$set_once, markSetOnceAsSent)\n if (setOnceProperties) {\n data.$set_once = setOnceProperties\n }\n\n data = _copyAndTruncateStrings(data, options?._noTruncate ? null : this.config.properties_string_max_length)\n data.timestamp = timestamp\n if (!isUndefined(options?.timestamp)) {\n data.properties['$event_time_override_provided'] = true\n data.properties['$event_time_override_system_time'] = systemTime\n }\n\n if (event_name === SurveyEventName.DISMISSED || event_name === SurveyEventName.SENT) {\n const surveyId = properties?.[SurveyEventProperties.SURVEY_ID]\n const surveyIteration = properties?.[SurveyEventProperties.SURVEY_ITERATION]\n setSurveySeenOnLocalStorage({ id: surveyId, current_iteration: surveyIteration })\n data.$set = {\n ...data.$set,\n [getSurveyInteractionProperty(\n { id: surveyId, current_iteration: surveyIteration },\n event_name === SurveyEventName.SENT ? 'responded' : 'dismissed'\n )]: true,\n }\n }\n\n // Top-level $set overriding values from the one from properties is taken from the plugin-server normalizeEvent\n // This doesn't handle $set_once, because posthog-people doesn't either\n const finalSet = { ...data.properties['$set'], ...data['$set'] }\n if (!isEmptyObject(finalSet)) {\n this.setPersonPropertiesForFlags(finalSet)\n }\n\n if (!isNullish(this.config.before_send)) {\n const beforeSendResult = this._runBeforeSend(data)\n if (!beforeSendResult) {\n return\n } else {\n data = beforeSendResult\n }\n }\n\n this._internalEventEmitter.emit('eventCaptured', data)\n\n const requestOptions: QueuedRequestWithOptions = {\n method: 'POST',\n url: options?._url ?? this.requestRouter.endpointFor('api', this.analyticsDefaultEndpoint),\n data,\n compression: 'best-available',\n batchKey: options?._batchKey,\n }\n\n if (this.config.request_batching && (!options || options?._batchKey) && !options?.send_instantly) {\n this._requestQueue.enqueue(requestOptions)\n } else {\n this._send_retriable_request(requestOptions)\n }\n\n return data\n }\n\n _addCaptureHook(callback: (eventName: string, eventPayload?: CaptureResult) => void): () => void {\n return this.on('eventCaptured', (data) => callback(data.event, data))\n }\n\n /**\n * This method is used internally to calculate the event properties before sending it to PostHog. It can also be\n * used by integrations (e.g. Segment) to enrich events with PostHog properties before sending them to Segment,\n * which is required for some PostHog products to work correctly. (e.g. to have a correct $session_id property).\n *\n * @param {String} eventName The name of the event. This can be anything the user does - 'Button Click', 'Sign Up', '$pageview', etc.\n * @param {Object} eventProperties The properties to include with the event.\n * @param {Date} [timestamp] The timestamp of the event, e.g. for calculating time on page. If not set, it'll automatically be set to the current time.\n * @param {String} [uuid] The uuid of the event, e.g. for storing the $pageview ID.\n * @param {Boolean} [readOnly] Set this if you do not intend to actually send the event, and therefore do not want to update internal state e.g. session timeout\n *\n * @internal\n */\n public calculateEventProperties(\n eventName: string,\n eventProperties: Properties,\n timestamp?: Date,\n uuid?: string,\n readOnly?: boolean\n ): Properties {\n timestamp = timestamp || new Date()\n if (!this.persistence || !this.sessionPersistence) {\n return eventProperties\n }\n\n // set defaults\n const startTimestamp = readOnly ? undefined : this.persistence.remove_event_timer(eventName)\n let properties = { ...eventProperties }\n properties['token'] = this.config.token\n properties['$config_defaults'] = this.config.defaults\n\n if (\n this.config.cookieless_mode == 'always' ||\n (this.config.cookieless_mode == 'on_reject' && this.consent.isExplicitlyOptedOut())\n ) {\n // Set a flag to tell the plugin server to use cookieless server hash mode\n properties[COOKIELESS_MODE_FLAG_PROPERTY] = true\n }\n\n if (eventName === '$snapshot') {\n const persistenceProps = { ...this.persistence.properties(), ...this.sessionPersistence.properties() }\n properties['distinct_id'] = persistenceProps.distinct_id\n if (\n // we spotted one customer that was managing to send `false` for ~9k events a day\n !(isString(properties['distinct_id']) || isNumber(properties['distinct_id'])) ||\n isEmptyString(properties['distinct_id'])\n ) {\n logger.error('Invalid distinct_id for replay event. This indicates a bug in your implementation')\n }\n return properties\n }\n\n const infoProperties = getEventProperties(\n this.config.mask_personal_data_properties,\n this.config.custom_personal_data_properties\n )\n\n if (this.sessionManager) {\n const { sessionId, windowId } = this.sessionManager.checkAndGetSessionAndWindowId(\n readOnly,\n timestamp.getTime()\n )\n properties['$session_id'] = sessionId\n properties['$window_id'] = windowId\n }\n if (this.sessionPropsManager) {\n extend(properties, this.sessionPropsManager.getSessionProps())\n }\n\n try {\n if (this.sessionRecording) {\n extend(properties, this.sessionRecording.sdkDebugProperties)\n }\n properties['$sdk_debug_retry_queue_size'] = this._retryQueue?.length\n } catch (e: any) {\n properties['$sdk_debug_error_capturing_properties'] = String(e)\n }\n\n if (this.requestRouter.region === RequestRouterRegion.CUSTOM) {\n properties['$lib_custom_api_host'] = this.config.api_host\n }\n\n let pageviewProperties: Record<string, any>\n if (eventName === '$pageview' && !readOnly) {\n pageviewProperties = this.pageViewManager.doPageView(timestamp, uuid)\n } else if (eventName === '$pageleave' && !readOnly) {\n pageviewProperties = this.pageViewManager.doPageLeave(timestamp)\n } else {\n pageviewProperties = this.pageViewManager.doEvent()\n }\n properties = extend(properties, pageviewProperties)\n\n if (eventName === '$pageview' && document) {\n properties['title'] = document.title\n }\n\n // set $duration if time_event was previously called for this event\n if (!isUndefined(startTimestamp)) {\n const duration_in_ms = timestamp.getTime() - startTimestamp\n properties['$duration'] = parseFloat((duration_in_ms / 1000).toFixed(3))\n }\n\n // this is only added when this.config.opt_out_useragent_filter is true,\n // or it would always add \"browser\"\n if (userAgent && this.config.opt_out_useragent_filter) {\n properties['$browser_type'] = this._is_bot() ? 'bot' : 'browser'\n }\n\n // note: extend writes to the first object, so lets make sure we\n // don't write to the persistence properties object and info\n // properties object by passing in a new object\n\n // update properties with pageview info and super-properties\n properties = extend(\n {},\n infoProperties,\n this.persistence.properties(),\n this.sessionPersistence.properties(),\n properties\n )\n\n properties['$is_identified'] = this._isIdentified()\n\n if (isArray(this.config.property_denylist)) {\n each(this.config.property_denylist, function (denylisted_prop) {\n delete properties[denylisted_prop]\n })\n } else {\n logger.error(\n 'Invalid value for property_denylist config: ' +\n this.config.property_denylist +\n ' or property_blacklist config: ' +\n this.config.property_blacklist\n )\n }\n\n const sanitize_properties = this.config.sanitize_properties\n if (sanitize_properties) {\n logger.error('sanitize_properties is deprecated. Use before_send instead')\n properties = sanitize_properties(properties, eventName)\n }\n\n // add person processing flag as very last step, so it cannot be overridden\n const hasPersonProcessing = this._hasPersonProcessing()\n properties['$process_person_profile'] = hasPersonProcessing\n // if the event has person processing, ensure that all future events will too, even if the setting changes\n if (hasPersonProcessing && !readOnly) {\n this._requirePersonProcessing('_calculate_event_properties')\n }\n\n return properties\n }\n\n /** @deprecated - deprecated in 1.241.0, use `calculateEventProperties` instead */\n _calculate_event_properties = this.calculateEventProperties.bind(this)\n\n /**\n * Add additional set_once properties to the event when creating a person profile. This allows us to create the\n * profile with mostly-accurate properties, despite earlier events not setting them. We do this by storing them in\n * persistence.\n * @param dataSetOnce\n * @param markAsSent - if true, marks the properties as sent so they won't be included in future events.\n * Set to false for events like $groupidentify where the server doesn't process person props.\n */\n _calculate_set_once_properties(dataSetOnce?: Properties, markAsSent: boolean = true): Properties | undefined {\n if (!this.persistence || !this._hasPersonProcessing()) {\n return dataSetOnce\n }\n\n if (this._personProcessingSetOncePropertiesSent) {\n // We only need to send these properties once. Sending them with later events would be redundant and would\n // just require extra work on the server to process them.\n return dataSetOnce\n }\n // if we're an identified person, send initial params with every event\n const initialProps = this.persistence.get_initial_props()\n const sessionProps = this.sessionPropsManager?.getSetOnceProps()\n let setOnceProperties = extend({}, initialProps, sessionProps || {}, dataSetOnce || {})\n const sanitize_properties = this.config.sanitize_properties\n if (sanitize_properties) {\n logger.error('sanitize_properties is deprecated. Use before_send instead')\n setOnceProperties = sanitize_properties(setOnceProperties, '$set_once')\n }\n if (markAsSent) {\n this._personProcessingSetOncePropertiesSent = true\n }\n if (isEmptyObject(setOnceProperties)) {\n return undefined\n }\n return setOnceProperties\n }\n\n /**\n * Registers super properties that are included with all events.\n *\n * @remarks\n * Super properties are stored in persistence and automatically added to every event you capture.\n * These values will overwrite any existing super properties with the same keys.\n *\n * @example\n * ```js\n * // register a single property\n * posthog.register({ plan: 'premium' })\n * ```\n *\n * {@label Capture}\n *\n * @example\n * ```js\n * // register multiple properties\n * posthog.register({\n * email: 'user@example.com',\n * account_type: 'business',\n * signup_date: '2023-01-15'\n * })\n * ```\n *\n * @example\n * ```js\n * // register with custom expiration\n * posthog.register({ campaign: 'summer_sale' }, 7) // expires in 7 days\n * ```\n *\n * @public\n *\n * @param {Object} properties properties to store about the user\n * @param {Number} [days] How many days since the user's last visit to store the super properties\n */\n register(properties: Properties, days?: number): void {\n this.persistence?.register(properties, days)\n }\n\n /**\n * Registers super properties only if they haven't been set before.\n *\n * @remarks\n * Unlike `register()`, this method will not overwrite existing super properties.\n * Use this for properties that should only be set once, like signup date or initial referrer.\n *\n * {@label Capture}\n *\n * @example\n * ```js\n * // register once-only properties\n * posthog.register_once({\n * first_login_date: new Date().toISOString(),\n * initial_referrer: document.referrer\n * })\n * ```\n *\n * @example\n * ```js\n * // override existing value if it matches default\n * posthog.register_once(\n * { user_type: 'premium' },\n * 'unknown' // overwrite if current value is 'unknown'\n * )\n * ```\n *\n * @public\n *\n * @param {Object} properties An associative array of properties to store about the user\n * @param {*} [default_value] Value to override if already set in super properties (ex: 'False') Default: 'None'\n * @param {Number} [days] How many days since the users last visit to store the super properties\n */\n register_once(properties: Properties, default_value?: Property, days?: number): void {\n this.persistence?.register_once(properties, default_value, days)\n }\n\n /**\n * Registers super properties for the current session only.\n *\n * @remarks\n * Session super properties are automatically added to all events during the current browser session.\n * Unlike regular super properties, these are cleared when the session ends and are stored in sessionStorage.\n *\n * {@label Capture}\n *\n * @example\n * ```js\n * // register session-specific properties\n * posthog.register_for_session({\n * current_page_type: 'checkout',\n * ab_test_variant: 'control'\n * })\n * ```\n *\n * @example\n * ```js\n * // register properties for user flow tracking\n * posthog.register_for_session({\n * selected_plan: 'pro',\n * completed_steps: 3,\n * flow_id: 'signup_flow_v2'\n * })\n * ```\n *\n * @public\n *\n * @param {Object} properties An associative array of properties to store about the user\n */\n register_for_session(properties: Properties): void {\n this.sessionPersistence?.register(properties)\n }\n\n /**\n * Removes a super property from persistent storage.\n *\n * @remarks\n * This will stop the property from being automatically included in future events.\n * The property will be permanently removed from the user's profile.\n *\n * {@label Capture}\n *\n * @example\n * ```js\n * // remove a super property\n * posthog.unregister('plan_type')\n * ```\n *\n * @public\n *\n * @param {String} property The name of the super property to remove\n */\n unregister(property: string): void {\n this.persistence?.unregister(property)\n }\n\n /**\n * Removes a session super property from the current session.\n *\n * @remarks\n * This will stop the property from being automatically included in future events for this session.\n * The property is removed from sessionStorage.\n *\n * {@label Capture}\n *\n * @example\n * ```js\n * // remove a session property\n * posthog.unregister_for_session('current_flow')\n * ```\n *\n * @public\n *\n * @param {String} property The name of the session super property to remove\n */\n unregister_for_session(property: string): void {\n this.sessionPersistence?.unregister(property)\n }\n\n _register_single(prop: string, value: Property) {\n this.register({ [prop]: value })\n }\n\n /**\n * Gets the value of a feature flag for the current user.\n *\n * @remarks\n * Returns the feature flag value which can be a boolean, string, or undefined.\n * Supports multivariate flags that can return custom string values.\n *\n * {@label Feature flags}\n *\n * @example\n * ```js\n * // check boolean flag\n * if (posthog.getFeatureFlag('new-feature')) {\n * // show new feature\n * }\n * ```\n *\n * @example\n * ```js\n * // check multivariate flag\n * const variant = posthog.getFeatureFlag('button-color')\n * if (variant === 'red') {\n * // show red button\n * }\n * ```\n *\n * @public\n *\n * @param {Object|String} prop Key of the feature flag.\n * @param {Object|String} options (optional) If {send_event: false}, we won't send an $feature_flag_call event to PostHog.\n */\n getFeatureFlag(key: string, options?: { send_event?: boolean }): boolean | string | undefined {\n return this.featureFlags.getFeatureFlag(key, options)\n }\n\n /**\n * Get feature flag payload value matching key for user (supports multivariate flags).\n *\n * {@label Feature flags}\n *\n * @example\n * ```js\n * if(posthog.getFeatureFlag('beta-feature') === 'some-value') {\n * const someValue = posthog.getFeatureFlagPayload('beta-feature')\n * // do something\n * }\n * ```\n *\n * @public\n *\n * @param {Object|String} prop Key of the feature flag.\n */\n getFeatureFlagPayload(key: string): JsonType {\n const payload = this.featureFlags.getFeatureFlagPayload(key)\n try {\n return JSON.parse(payload as any)\n } catch {\n return payload\n }\n }\n\n /**\n * Checks if a feature flag is enabled for the current user.\n *\n * @remarks\n * Returns true if the flag is enabled, false if disabled, or undefined if not found.\n * This is a convenience method that treats any truthy value as enabled.\n *\n * {@label Feature flags}\n *\n * @example\n * ```js\n * // simple feature flag check\n * if (posthog.isFeatureEnabled('new-checkout')) {\n * showNewCheckout()\n * }\n * ```\n *\n * @example\n * ```js\n * // disable event tracking\n * if (posthog.isFeatureEnabled('feature', { send_event: false })) {\n * // flag checked without sending $feature_flag_call event\n * }\n * ```\n *\n * @public\n *\n * @param {Object|String} prop Key of the feature flag.\n * @param {Object|String} options (optional) If {send_event: false}, we won't send an $feature_flag_call event to PostHog.\n */\n isFeatureEnabled(key: string, options?: { send_event: boolean }): boolean | undefined {\n return this.featureFlags.isFeatureEnabled(key, options)\n }\n\n /**\n * Feature flag values are cached. If something has changed with your user and you'd like to refetch their flag values, call this method.\n *\n * {@label Feature flags}\n *\n * @example\n * ```js\n * posthog.reloadFeatureFlags()\n * ```\n *\n * @public\n */\n reloadFeatureFlags(): void {\n this.featureFlags.reloadFeatureFlags()\n }\n\n /**\n * Manually update feature flag values without making a network request.\n *\n * This is useful when you have feature flag values from an external source\n * (e.g., server-side evaluation, edge middleware) and want to inject them\n * into the client SDK.\n *\n * {@label Feature flags}\n *\n * @example\n * ```js\n * // Replace all flags with server-evaluated values\n * posthog.updateFlags({\n * 'my-flag': true,\n * 'my-experiment': 'variant-a'\n * })\n *\n * // Merge with existing flags (update only specified flags)\n * posthog.updateFlags(\n * { 'my-flag': true },\n * undefined,\n * { merge: true }\n * )\n *\n * // With payloads\n * posthog.updateFlags(\n * { 'my-flag': true },\n * { 'my-flag': { some: 'data' } }\n * )\n * ```\n *\n * @param flags - An object mapping flag keys to their values (boolean or string variant)\n * @param payloads - Optional object mapping flag keys to their JSON payloads\n * @param options - Optional settings. Use `{ merge: true }` to merge with existing flags instead of replacing.\n * @public\n */\n updateFlags(\n flags: Record<string, boolean | string>,\n payloads?: Record<string, JsonType>,\n options?: { merge?: boolean }\n ): void {\n // If merging, combine with existing flags\n const existingFlags = options?.merge ? this.featureFlags.getFlagVariants() : {}\n const existingPayloads = options?.merge ? this.featureFlags.getFlagPayloads() : {}\n const finalFlags = { ...existingFlags, ...flags }\n const finalPayloads = { ...existingPayloads, ...payloads }\n\n // Convert simple flags to v4 format to avoid deprecation warning\n const flagDetails: Record<string, FeatureFlagDetail> = {}\n for (const [key, value] of Object.entries(finalFlags)) {\n const isVariant = typeof value === 'string'\n flagDetails[key] = {\n key,\n enabled: isVariant ? true : Boolean(value),\n variant: isVariant ? value : undefined,\n reason: undefined,\n // id: 0 indicates manually injected flags (not from server evaluation)\n metadata: !isUndefined(finalPayloads?.[key])\n ? { id: 0, version: undefined, description: undefined, payload: finalPayloads[key] }\n : undefined,\n }\n }\n\n this.featureFlags.receivedFeatureFlags({\n flags: flagDetails,\n })\n }\n\n /**\n * Opt the user in or out of an early access feature. [Learn more in the docs](/docs/feature-flags/early-access-feature-management#option-2-custom-implementation)\n *\n * {@label Feature flags}\n *\n * @example\n * ```js\n * const toggleBeta = (betaKey) => {\n * if (activeBetas.some(\n * beta => beta.flagKey === betaKey\n * )) {\n * posthog.updateEarlyAccessFeatureEnrollment(\n * betaKey,\n * false\n * )\n * setActiveBetas(\n * prevActiveBetas => prevActiveBetas.filter(\n * item => item.flagKey !== betaKey\n * )\n * );\n * return\n * }\n *\n * posthog.updateEarlyAccessFeatureEnrollment(\n * betaKey,\n * true\n * )\n * setInactiveBetas(\n * prevInactiveBetas => prevInactiveBetas.filter(\n * item => item.flagKey !== betaKey\n * )\n * );\n * }\n *\n * const registerInterest = (featureKey) => {\n * posthog.updateEarlyAccessFeatureEnrollment(\n * featureKey,\n * true\n * )\n * // Update UI to show user has registered\n * }\n * ```\n *\n * @public\n *\n * @param {String} key The key of the feature flag to update.\n * @param {Boolean} isEnrolled Whether the user is enrolled in the feature.\n * @param {String} [stage] The stage of the feature flag to update.\n */\n updateEarlyAccessFeatureEnrollment(key: string, isEnrolled: boolean, stage?: string): void {\n this.featureFlags.updateEarlyAccessFeatureEnrollment(key, isEnrolled, stage)\n }\n\n /**\n * Get the list of early access features. To check enrollment status, use `isFeatureEnabled`. [Learn more in the docs](/docs/feature-flags/early-access-feature-management#option-2-custom-implementation)\n *\n * {@label Feature flags}\n *\n * @example\n * ```js\n * const posthog = usePostHog()\n * const activeFlags = useActiveFeatureFlags()\n *\n * const [activeBetas, setActiveBetas] = useState([])\n * const [inactiveBetas, setInactiveBetas] = useState([])\n * const [comingSoonFeatures, setComingSoonFeatures] = useState([])\n *\n * useEffect(() => {\n * posthog.getEarlyAccessFeatures((features) => {\n * // Filter features by stage\n * const betaFeatures = features.filter(feature => feature.stage === 'beta')\n * const conceptFeatures = features.filter(feature => feature.stage === 'concept')\n *\n * setComingSoonFeatures(conceptFeatures)\n *\n * if (!activeFlags || activeFlags.length === 0) {\n * setInactiveBetas(betaFeatures)\n * return\n * }\n *\n * const activeBetas = betaFeatures.filter(\n * beta => activeFlags.includes(beta.flagKey)\n * );\n * const inactiveBetas = betaFeatures.filter(\n * beta => !activeFlags.includes(beta.flagKey)\n * );\n * setActiveBetas(activeBetas)\n * setInactiveBetas(inactiveBetas)\n * }, true, ['concept', 'beta'])\n * }, [activeFlags])\n * ```\n *\n * @public\n *\n * @param {Function} callback The callback function will be called when the early access features are loaded.\n * @param {Boolean} [force_reload] Whether to force a reload of the early access features.\n * @param {String[]} [stages] The stages of the early access features to load.\n */\n getEarlyAccessFeatures(\n callback: EarlyAccessFeatureCallback,\n force_reload = false,\n stages?: EarlyAccessFeatureStage[]\n ): void {\n return this.featureFlags.getEarlyAccessFeatures(callback, force_reload, stages)\n }\n\n /**\n * Exposes a set of events that PostHog will emit.\n * e.g. `eventCaptured` is emitted immediately before trying to send an event\n *\n * Unlike `onFeatureFlags` and `onSessionId` these are not called when the\n * listener is registered, the first callback will be the next event\n * _after_ registering a listener\n *\n * {@label Capture}\n *\n * @example\n * ```js\n * posthog.on('eventCaptured', (event) => {\n * console.log(event)\n * })\n * ```\n *\n * @public\n *\n * @param {String} event The event to listen for.\n * @param {Function} cb The callback function to call when the event is emitted.\n * @returns {Function} A function that can be called to unsubscribe the listener.\n */\n on(event: 'eventCaptured', cb: (...args: any[]) => void): () => void {\n return this._internalEventEmitter.on(event, cb)\n }\n\n /**\n * Register an event listener that runs when feature flags become available or when they change.\n * If there are flags, the listener is called immediately in addition to being called on future changes.\n * Note that this is not called only when we fetch feature flags from the server, but also when they change in the browser.\n *\n * {@label Feature flags}\n *\n * @example\n * ```js\n * posthog.onFeatureFlags(function(featureFlags, featureFlagsVariants, { errorsLoading }) {\n * // do something\n * })\n * ```\n *\n * @param callback - The callback function will be called once the feature flags are ready or when they are updated.\n * It'll return a list of feature flags enabled for the user, the variants,\n * and also a context object indicating whether we succeeded to fetch the flags or not.\n * @returns A function that can be called to unsubscribe the listener. Used by `useEffect` when the component unmounts.\n */\n onFeatureFlags(callback: FeatureFlagsCallback): () => void {\n return this.featureFlags.onFeatureFlags(callback)\n }\n\n /**\n * Register an event listener that runs when surveys are loaded.\n *\n * Callback parameters:\n * - surveys: Survey[]: An array containing all survey objects fetched from PostHog using the getSurveys method\n * - context: { isLoaded: boolean, error?: string }: An object indicating if the surveys were loaded successfully\n *\n * {@label Surveys}\n *\n * @example\n * ```js\n * posthog.onSurveysLoaded((surveys, context) => { // do something })\n * ```\n *\n *\n * @param {Function} callback The callback function will be called when surveys are loaded or updated.\n * @returns {Function} A function that can be called to unsubscribe the listener.\n */\n onSurveysLoaded(callback: SurveyCallback): () => void {\n return this.surveys.onSurveysLoaded(callback)\n }\n\n /**\n * Register an event listener that runs whenever the session id or window id change.\n * If there is already a session id, the listener is called immediately in addition to being called on future changes.\n *\n * Can be used, for example, to sync the PostHog session id with a backend session.\n *\n * {@label Identification}\n *\n * @example\n * ```js\n * posthog.onSessionId(function(sessionId, windowId) { // do something })\n * ```\n *\n * @param {Function} [callback] The callback function will be called once a session id is present or when it or the window id are updated.\n * @returns {Function} A function that can be called to unsubscribe the listener. E.g. Used by `useEffect` when the component unmounts.\n */\n onSessionId(callback: SessionIdChangedCallback): () => void {\n return this.sessionManager?.onSessionId(callback) ?? (() => {})\n }\n\n /**\n * Get list of all surveys.\n *\n * {@label Surveys}\n *\n * @example\n * ```js\n * function callback(surveys, context) {\n * // do something\n * }\n *\n * posthog.getSurveys(callback, false)\n * ```\n *\n * @public\n *\n * @param {Function} [callback] Function that receives the array of surveys\n * @param {Boolean} [forceReload] Optional boolean to force an API call for updated surveys\n */\n getSurveys(callback: SurveyCallback, forceReload = false): void {\n this.surveys.getSurveys(callback, forceReload)\n }\n\n /**\n * Get surveys that should be enabled for the current user. See [fetching surveys documentation](/docs/surveys/implementing-custom-surveys#fetching-surveys-manually) for more details.\n *\n * {@label Surveys}\n *\n * @example\n * ```js\n * posthog.getActiveMatchingSurveys((surveys) => {\n * // do something\n * })\n * ```\n *\n * @public\n *\n * @param {Function} [callback] The callback function will be called when the surveys are loaded or updated.\n * @param {Boolean} [forceReload] Whether to force a reload of the surveys.\n */\n getActiveMatchingSurveys(callback: SurveyCallback, forceReload = false): void {\n this.surveys.getActiveMatchingSurveys(callback, forceReload)\n }\n\n /**\n * Although we recommend using popover surveys and display conditions,\n * if you want to show surveys programmatically without setting up all\n * the extra logic needed for API surveys, you can render surveys\n * programmatically with the renderSurvey method.\n *\n * This takes a survey ID and an HTML selector to render an unstyled survey.\n *\n * {@label Surveys}\n *\n * @example\n * ```js\n * posthog.renderSurvey(coolSurveyID, '#survey-container')\n * ```\n *\n * @deprecated Use displaySurvey instead - it's more complete and also supports popover surveys.\n *\n * @public\n *\n * @param {String} surveyId The ID of the survey to render.\n * @param {String} selector The selector of the HTML element to render the survey on.\n */\n renderSurvey(surveyId: string, selector: string): void {\n this.surveys.renderSurvey(surveyId, selector)\n }\n\n /**\n * Display a survey programmatically as either a popover or inline element.\n *\n * @param {string} surveyId - The survey ID to display\n * @param {DisplaySurveyOptions} options - Display configuration\n *\n * @example\n * ```js\n * // Display as popover (respects all conditions defined in the dashboard)\n * posthog.displaySurvey('survey-id-123')\n * ```\n *\n * @example\n * ```js\n * // Display inline in a specific element\n * posthog.displaySurvey('survey-id-123', {\n * displayType: DisplaySurveyType.Inline,\n * selector: '#survey-container'\n * })\n * ```\n *\n * @example\n * ```js\n * // Force display ignoring conditions and delays\n * posthog.displaySurvey('survey-id-123', {\n * displayType: DisplaySurveyType.Popover,\n * ignoreConditions: true,\n * ignoreDelay: true\n * })\n * ```\n *\n * {@label Surveys}\n */\n displaySurvey(surveyId: string, options: DisplaySurveyOptions = DEFAULT_DISPLAY_SURVEY_OPTIONS): void {\n this.surveys.displaySurvey(surveyId, options)\n }\n\n /**\n * Cancels a pending survey that is waiting to be displayed (e.g., due to a popup delay).\n *\n * {@label Surveys}\n */\n cancelPendingSurvey(surveyId: string): void {\n this.surveys.cancelPendingSurvey(surveyId)\n }\n\n /**\n * Checks the feature flags associated with this Survey to see if the survey can be rendered.\n * This method is deprecated because it's synchronous and won't return the correct result if surveys are not loaded.\n * Use `canRenderSurveyAsync` instead.\n *\n * {@label Surveys}\n *\n *\n * @deprecated\n *\n * @param surveyId The ID of the survey to check.\n * @returns A SurveyRenderReason object indicating if the survey can be rendered.\n */\n canRenderSurvey(surveyId: string): SurveyRenderReason | null {\n return this.surveys.canRenderSurvey(surveyId)\n }\n\n /**\n * Checks the feature flags associated with this Survey to see if the survey can be rendered.\n *\n * {@label Surveys}\n *\n * @example\n * ```js\n * posthog.canRenderSurveyAsync(surveyId).then((result) => {\n * if (result.visible) {\n * // Survey can be rendered\n * console.log('Survey can be rendered')\n * } else {\n * // Survey cannot be rendered\n * console.log('Survey cannot be rendered:', result.disabledReason)\n * }\n * })\n * ```\n *\n * @public\n *\n * @param surveyId The ID of the survey to check.\n * @param forceReload If true, the survey will be reloaded from the server, Default: false\n * @returns A SurveyRenderReason object indicating if the survey can be rendered.\n */\n canRenderSurveyAsync(surveyId: string, forceReload = false): Promise<SurveyRenderReason> {\n return this.surveys.canRenderSurveyAsync(surveyId, forceReload)\n }\n\n /**\n * Associates a user with a unique identifier instead of an auto-generated ID.\n * Learn more about [identifying users](/docs/product-analytics/identify)\n *\n * {@label Identification}\n *\n * @remarks\n * By default, PostHog assigns each user a randomly generated `distinct_id`. Use this method to\n * replace that ID with your own unique identifier (like a user ID from your database).\n *\n * @example\n * ```js\n * // basic identification\n * posthog.identify('user_12345')\n * ```\n *\n * @example\n * ```js\n * // identify with user properties\n * posthog.identify('user_12345', {\n * email: 'user@example.com',\n * plan: 'premium'\n * })\n * ```\n *\n * @example\n * ```js\n * // identify with set and set_once properties\n * posthog.identify('user_12345',\n * { last_login: new Date() }, // updates every time\n * { signup_date: new Date() } // sets only once\n * )\n * ```\n *\n * @public\n *\n * @param {String} [new_distinct_id] A string that uniquely identifies a user. If not provided, the distinct_id currently in the persistent store (cookie or localStorage) will be used.\n * @param {Object} [userPropertiesToSet] Optional: An associative array of properties to store about the user. Note: For feature flag evaluations, if the same key is present in the userPropertiesToSetOnce,\n * it will be overwritten by the value in userPropertiesToSet.\n * @param {Object} [userPropertiesToSetOnce] Optional: An associative array of properties to store about the user. If property is previously set, this does not override that value.\n */\n identify(new_distinct_id?: string, userPropertiesToSet?: Properties, userPropertiesToSetOnce?: Properties): void {\n if (!this.__loaded || !this.persistence) {\n return logger.uninitializedWarning('posthog.identify')\n }\n if (isNumber(new_distinct_id)) {\n new_distinct_id = (new_distinct_id as number).toString()\n logger.warn(\n 'The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.'\n )\n }\n\n //if the new_distinct_id has not been set ignore the identify event\n if (!new_distinct_id) {\n logger.error('Unique user id has not been set in posthog.identify')\n return\n }\n\n if (isDistinctIdStringLike(new_distinct_id)) {\n logger.critical(\n `The string \"${new_distinct_id}\" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`\n )\n return\n }\n if (new_distinct_id === COOKIELESS_SENTINEL_VALUE) {\n logger.critical(\n `The string \"${COOKIELESS_SENTINEL_VALUE}\" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`\n )\n return\n }\n\n if (!this._requirePersonProcessing('posthog.identify')) {\n return\n }\n\n const previous_distinct_id = this.get_distinct_id()\n this.register({ $user_id: new_distinct_id })\n\n if (!this.get_property('$device_id')) {\n // The persisted distinct id might not actually be a device id at all\n // it might be a distinct id of the user from before\n const device_id = previous_distinct_id\n this.register_once(\n {\n $had_persisted_distinct_id: true,\n $device_id: device_id,\n },\n ''\n )\n }\n\n // if the previous distinct id had an alias stored, then we clear it\n if (new_distinct_id !== previous_distinct_id && new_distinct_id !== this.get_property(ALIAS_ID_KEY)) {\n this.unregister(ALIAS_ID_KEY)\n this.register({ distinct_id: new_distinct_id })\n }\n\n const isKnownAnonymous = (this.persistence.get_property(USER_STATE) || 'anonymous') === 'anonymous'\n\n // send an $identify event any time the distinct_id is changing and the old ID is an anonymous ID\n // - logic on the server will determine whether or not to do anything with it.\n if (new_distinct_id !== previous_distinct_id && isKnownAnonymous) {\n this.persistence.set_property(USER_STATE, 'identified')\n\n // Update current user properties\n this.setPersonPropertiesForFlags(\n { ...(userPropertiesToSetOnce || {}), ...(userPropertiesToSet || {}) },\n false\n )\n\n this.capture(\n '$identify',\n {\n distinct_id: new_distinct_id,\n $anon_distinct_id: previous_distinct_id,\n },\n { $set: userPropertiesToSet || {}, $set_once: userPropertiesToSetOnce || {} }\n )\n\n this._cachedPersonProperties = getPersonPropertiesHash(\n new_distinct_id,\n userPropertiesToSet,\n userPropertiesToSetOnce\n )\n\n // let the reload feature flag request know to send this previous distinct id\n // for flag consistency\n this.featureFlags.setAnonymousDistinctId(previous_distinct_id)\n } else if (userPropertiesToSet || userPropertiesToSetOnce) {\n // If the distinct_id is not changing, but we have user properties to set, we can check if they have changed\n // and if so, send a $set event\n\n this.setPersonProperties(userPropertiesToSet, userPropertiesToSetOnce)\n }\n\n // Reload active feature flags if the user identity changes.\n // Note we don't reload this on property changes as these get processed async\n if (new_distinct_id !== previous_distinct_id) {\n this.reloadFeatureFlags()\n // also clear any stored flag calls\n this.unregister(FLAG_CALL_REPORTED)\n }\n }\n\n /**\n * Sets properties on the person profile associated with the current `distinct_id`.\n * Learn more about [identifying users](/docs/product-analytics/identify)\n *\n * {@label Identification}\n *\n * @remarks\n * Updates user properties that are stored with the person profile in PostHog.\n * If `person_profiles` is set to `identified_only` and no profile exists, this will create one.\n *\n * @example\n * ```js\n * // set user properties\n * posthog.setPersonProperties({\n * email: 'user@example.com',\n * plan: 'premium'\n * })\n * ```\n *\n * @example\n * ```js\n * // set properties\n * posthog.setPersonProperties(\n * { name: 'Max Hedgehog' }, // $set properties\n * { initial_url: '/blog' } // $set_once properties\n * )\n * ```\n *\n * @public\n *\n * @param {Object} [userPropertiesToSet] Optional: An associative array of properties to store about the user. Note: For feature flag evaluations, if the same key is present in the userPropertiesToSetOnce,\n * it will be overwritten by the value in userPropertiesToSet.\n * @param {Object} [userPropertiesToSetOnce] Optional: An associative array of properties to store about the user. If property is previously set, this does not override that value.\n */\n setPersonProperties(userPropertiesToSet?: Properties, userPropertiesToSetOnce?: Properties): void {\n if (!userPropertiesToSet && !userPropertiesToSetOnce) {\n return\n }\n\n if (!this._requirePersonProcessing('posthog.setPersonProperties')) {\n return\n }\n\n const hash = getPersonPropertiesHash(this.get_distinct_id(), userPropertiesToSet, userPropertiesToSetOnce)\n\n // if exactly this $set call has been sent before, don't send it again - determine based on hash of properties\n if (this._cachedPersonProperties === hash) {\n logger.info('A duplicate setPersonProperties call was made with the same properties. It has been ignored.')\n return\n }\n\n // Update current user properties\n this.setPersonPropertiesForFlags({ ...(userPropertiesToSetOnce || {}), ...(userPropertiesToSet || {}) })\n\n this.capture('$set', { $set: userPropertiesToSet || {}, $set_once: userPropertiesToSetOnce || {} })\n\n this._cachedPersonProperties = hash\n }\n\n /**\n * Associates the user with a group for group-based analytics.\n * Learn more about [groups](/docs/product-analytics/group-analytics)\n *\n * {@label Identification}\n *\n * @remarks\n * Groups allow you to analyze users collectively (e.g., by organization, team, or account).\n * This sets the group association for all subsequent events and reloads feature flags.\n *\n * @example\n * ```js\n * // associate user with an organization\n * posthog.group('organization', 'org_12345', {\n * name: 'Acme Corp',\n * plan: 'enterprise'\n * })\n * ```\n *\n * @example\n * ```js\n * // associate with multiple group types\n * posthog.group('organization', 'org_12345')\n * posthog.group('team', 'team_67890')\n * ```\n *\n * @public\n *\n * @param {String} groupType Group type (example: 'organization')\n * @param {String} groupKey Group key (example: 'org::5')\n * @param {Object} groupPropertiesToSet Optional properties to set for group\n */\n group(groupType: string, groupKey: string, groupPropertiesToSet?: Properties): void {\n if (!groupType || !groupKey) {\n logger.error('posthog.group requires a group type and group key')\n return\n }\n\n const existingGroups = this.getGroups()\n\n // if group key changes, remove stored group properties\n if (existingGroups[groupType] !== groupKey) {\n this.resetGroupPropertiesForFlags(groupType)\n }\n\n this.register({ $groups: { ...existingGroups, [groupType]: groupKey } })\n\n if (groupPropertiesToSet) {\n this.capture('$groupidentify', {\n $group_type: groupType,\n $group_key: groupKey,\n $group_set: groupPropertiesToSet,\n })\n this.setGroupPropertiesForFlags({ [groupType]: groupPropertiesToSet })\n }\n\n // If groups change and no properties change, reload feature flags.\n // The property change reload case is handled in setGroupPropertiesForFlags.\n if (existingGroups[groupType] !== groupKey && !groupPropertiesToSet) {\n this.reloadFeatureFlags()\n }\n }\n\n /**\n * Resets only the group properties of the user currently logged in.\n * Learn more about [groups](/docs/product-analytics/group-analytics)\n *\n * {@label Identification}\n *\n * @example\n * ```js\n * posthog.resetGroups()\n * ```\n *\n * @public\n */\n resetGroups(): void {\n this.register({ $groups: {} })\n this.resetGroupPropertiesForFlags()\n\n // If groups changed, reload feature flags.\n this.reloadFeatureFlags()\n }\n\n /**\n * Sometimes, you might want to evaluate feature flags using properties that haven't been ingested yet,\n * or were set incorrectly earlier. You can do so by setting properties the flag depends on with these calls:\n *\n * {@label Feature flags}\n *\n * @example\n * ```js\n * // Set properties\n * posthog.setPersonPropertiesForFlags({'property1': 'value', property2: 'value2'})\n * ```\n *\n * @example\n * ```js\n * // Set properties without reloading\n * posthog.setPersonPropertiesForFlags({'property1': 'value', property2: 'value2'}, false)\n * ```\n *\n * @public\n *\n * @param {Object} properties The properties to override.\n * @param {Boolean} [reloadFeatureFlags] Whether to reload feature flags.\n */\n setPersonPropertiesForFlags(properties: Properties, reloadFeatureFlags = true): void {\n this.featureFlags.setPersonPropertiesForFlags(properties, reloadFeatureFlags)\n }\n\n /**\n * Resets the person properties for feature flags.\n *\n * {@label Feature flags}\n *\n * @public\n *\n * @example\n * ```js\n * posthog.resetPersonPropertiesForFlags()\n * ```\n */\n resetPersonPropertiesForFlags(): void {\n this.featureFlags.resetPersonPropertiesForFlags()\n }\n\n /**\n * Set override group properties for feature flags.\n * This is used when dealing with new groups / where you don't want to wait for ingestion\n * to update properties.\n * Takes in an object, the key of which is the group type.\n *\n * {@label Feature flags}\n *\n * @public\n *\n * @example\n * ```js\n * // Set properties with reload\n * posthog.setGroupPropertiesForFlags({'organization': { name: 'CYZ', employees: '11' } })\n * ```\n *\n * @example\n * ```js\n * // Set properties without reload\n * posthog.setGroupPropertiesForFlags({'organization': { name: 'CYZ', employees: '11' } }, false)\n * ```\n *\n * @param {Object} properties The properties to override, the key of which is the group type.\n * @param {Boolean} [reloadFeatureFlags] Whether to reload feature flags.\n */\n setGroupPropertiesForFlags(properties: { [type: string]: Properties }, reloadFeatureFlags = true): void {\n if (!this._requirePersonProcessing('posthog.setGroupPropertiesForFlags')) {\n return\n }\n this.featureFlags.setGroupPropertiesForFlags(properties, reloadFeatureFlags)\n }\n\n /**\n * Resets the group properties for feature flags.\n *\n * {@label Feature flags}\n *\n * @public\n *\n * @example\n * ```js\n * posthog.resetGroupPropertiesForFlags()\n * ```\n */\n resetGroupPropertiesForFlags(group_type?: string): void {\n this.featureFlags.resetGroupPropertiesForFlags(group_type)\n }\n\n /**\n * Resets all user data and starts a fresh session.\n *\n * ⚠️ **Warning**: Only call this when a user logs out. Calling at the wrong time can cause split sessions.\n *\n * This clears:\n * - Session ID and super properties\n * - User identification (sets new random distinct_id)\n * - Cached data and consent settings\n *\n * {@label Identification}\n * @example\n * ```js\n * // reset on user logout\n * function logout() {\n * posthog.reset()\n * // redirect to login page\n * }\n * ```\n *\n * @example\n * ```js\n * // reset and generate new device ID\n * posthog.reset(true) // also resets device_id\n * ```\n *\n * @public\n */\n reset(reset_device_id?: boolean): void {\n logger.info('reset')\n if (!this.__loaded) {\n return logger.uninitializedWarning('posthog.reset')\n }\n const device_id = this.get_property('$device_id')\n this.consent.reset()\n this.persistence?.clear()\n this.sessionPersistence?.clear()\n this.surveys.reset()\n this.featureFlags.reset()\n this.persistence?.set_property(USER_STATE, 'anonymous')\n this.sessionManager?.resetSessionId()\n this._cachedPersonProperties = null\n if (this.config.cookieless_mode === 'always') {\n this.register_once(\n {\n distinct_id: COOKIELESS_SENTINEL_VALUE,\n $device_id: null,\n },\n ''\n )\n } else {\n const uuid = this.config.get_device_id(uuidv7())\n this.register_once(\n {\n distinct_id: uuid,\n $device_id: reset_device_id ? uuid : device_id,\n },\n ''\n )\n }\n\n this.register(\n {\n $last_posthog_reset: new Date().toISOString(),\n },\n 1\n )\n }\n\n /**\n * Returns the current distinct ID for the user.\n *\n * @remarks\n * This is either the auto-generated ID or the ID set via `identify()`.\n * The distinct ID is used to associate events with users in PostHog.\n *\n * {@label Identification}\n *\n * @example\n * ```js\n * // get the current user ID\n * const userId = posthog.get_distinct_id()\n * console.log('Current user:', userId)\n * ```\n *\n * @example\n * ```js\n * // use in loaded callback\n * posthog.init('token', {\n * loaded: (posthog) => {\n * const id = posthog.get_distinct_id()\n * // use the ID\n * }\n * })\n * ```\n *\n * @public\n *\n * @returns The current distinct ID\n */\n get_distinct_id(): string {\n return this.get_property('distinct_id')\n }\n\n /**\n * Returns the current groups.\n *\n * {@label Identification}\n *\n * @public\n *\n * @returns The current groups\n */\n getGroups(): Record<string, any> {\n return this.get_property('$groups') || {}\n }\n\n /**\n * Returns the current session_id.\n *\n * @remarks\n * This should only be used for informative purposes.\n * Any actual internal use case for the session_id should be handled by the sessionManager.\n *\n * @public\n *\n * @returns The stored session ID for the current session. This may be an empty string if the client is not yet fully initialized.\n */\n get_session_id(): string {\n return this.sessionManager?.checkAndGetSessionAndWindowId(true).sessionId ?? ''\n }\n\n /**\n * Returns the Replay url for the current session.\n *\n * {@label Session replay}\n *\n * @public\n *\n * @example\n * ```js\n * // basic usage\n * posthog.get_session_replay_url()\n *\n * @example\n * ```js\n * // timestamp\n * posthog.get_session_replay_url({ withTimestamp: true })\n * ```\n *\n * @example\n * ```js\n * // timestamp and lookback\n * posthog.get_session_replay_url({\n * withTimestamp: true,\n * timestampLookBack: 30 // look back 30 seconds\n * })\n * ```\n *\n * @param options Options for the url\n * @param options.withTimestamp Whether to include the timestamp in the url (defaults to false)\n * @param options.timestampLookBack How many seconds to look back for the timestamp (defaults to 10)\n */\n get_session_replay_url(options?: { withTimestamp?: boolean; timestampLookBack?: number }): string {\n if (!this.sessionManager) {\n return ''\n }\n const { sessionId, sessionStartTimestamp } = this.sessionManager.checkAndGetSessionAndWindowId(true)\n let url = this.requestRouter.endpointFor('ui', `/project/${this.config.token}/replay/${sessionId}`)\n if (options?.withTimestamp && sessionStartTimestamp) {\n const LOOK_BACK = options.timestampLookBack ?? 10\n if (!sessionStartTimestamp) {\n return url\n }\n const recordingStartTime = Math.max(\n Math.floor((new Date().getTime() - sessionStartTimestamp) / 1000) - LOOK_BACK,\n 0\n )\n url += `?t=${recordingStartTime}`\n }\n\n return url\n }\n\n /**\n * Creates an alias linking two distinct user identifiers. Learn more about [identifying users](/docs/product-analytics/identify)\n *\n * {@label Identification}\n *\n * @remarks\n * PostHog will use this to link two distinct_ids going forward (not retroactively).\n * Call this when a user signs up to connect their anonymous session with their account.\n *\n *\n * @example\n * ```js\n * // link anonymous user to account on signup\n * posthog.alias('user_12345')\n * ```\n *\n * @example\n * ```js\n * // explicit alias with original ID\n * posthog.alias('user_12345', 'anonymous_abc123')\n * ```\n *\n * @public\n *\n * @param {String} alias A unique identifier that you want to use for this user in the future.\n * @param {String} [original] The current identifier being used for this user.\n */\n alias(alias: string, original?: string): CaptureResult | void | number {\n // If the $people_distinct_id key exists in persistence, there has been a previous\n // posthog.people.identify() call made for this user. It is VERY BAD to make an alias with\n // this ID, as it will duplicate users.\n if (alias === this.get_property(PEOPLE_DISTINCT_ID_KEY)) {\n logger.critical('Attempting to create alias for existing People user - aborting.')\n return -2\n }\n if (!this._requirePersonProcessing('posthog.alias')) {\n return\n }\n\n if (isUndefined(original)) {\n original = this.get_distinct_id()\n }\n if (alias !== original) {\n this._register_single(ALIAS_ID_KEY, alias)\n return this.capture('$create_alias', { alias: alias, distinct_id: original })\n } else {\n logger.warn('alias matches current distinct_id - skipping api call.')\n this.identify(alias)\n return -1\n }\n }\n\n /**\n * Updates the configuration of the PostHog instance.\n *\n * {@label Initialization}\n *\n * @public\n *\n * @param {Partial<PostHogConfig>} config A dictionary of new configuration values to update\n */\n set_config(config: Partial<PostHogConfig>): void {\n const oldConfig = { ...this.config }\n if (isObject(config)) {\n extend(this.config, configRenames(config))\n\n const isPersistenceDisabled = this._is_persistence_disabled()\n this.persistence?.update_config(this.config, oldConfig, isPersistenceDisabled)\n this.sessionPersistence =\n this.config.persistence === 'sessionStorage' || this.config.persistence === 'memory'\n ? this.persistence\n : new PostHogPersistence({ ...this.config, persistence: 'sessionStorage' }, isPersistenceDisabled)\n\n const debugConfigFromLocalStorage = this._checkLocalStorageForDebug(this.config.debug)\n if (isBoolean(debugConfigFromLocalStorage)) {\n this.config.debug = debugConfigFromLocalStorage\n }\n\n if (isBoolean(this.config.debug)) {\n if (this.config.debug) {\n Config.DEBUG = true\n localStore._is_supported() && localStore._set('ph_debug', 'true')\n logger.info('set_config', {\n config,\n oldConfig,\n newConfig: { ...this.config },\n })\n } else {\n Config.DEBUG = false\n localStore._is_supported() && localStore._remove('ph_debug')\n }\n }\n\n this.exceptionObserver?.onConfigChange()\n\n this.sessionRecording?.startIfEnabledOrStop()\n this.autocapture?.startIfEnabled()\n this.heatmaps?.startIfEnabled()\n this.exceptionObserver?.startIfEnabledOrStop()\n this.surveys.loadIfEnabled()\n this._sync_opt_out_with_persistence()\n this.externalIntegrations?.startIfEnabledOrStop()\n }\n }\n\n /**\n * turns session recording on, and updates the config option `disable_session_recording` to false\n *\n * {@label Session replay}\n *\n * @public\n *\n * @example\n * ```js\n * // Start and ignore controls\n * posthog.startSessionRecording(true)\n * ```\n *\n * @example\n * ```js\n * // Start and override controls\n * posthog.startSessionRecording({\n * // you don't have to send all of these\n * sampling: true || false,\n * linked_flag: true || false,\n * url_trigger: true || false,\n * event_trigger: true || false\n * })\n * ```\n *\n * @param override.sampling - optional boolean to override the default sampling behavior - ensures the next session recording to start will not be skipped by sampling config.\n * @param override.linked_flag - optional boolean to override the default linked_flag behavior - ensures the next session recording to start will not be skipped by linked_flag config.\n * @param override.url_trigger - optional boolean to override the default url_trigger behavior - ensures the next session recording to start will not be skipped by url_trigger config.\n * @param override.event_trigger - optional boolean to override the default event_trigger behavior - ensures the next session recording to start will not be skipped by event_trigger config.\n * @param override - optional boolean to override the default sampling behavior - ensures the next session recording to start will not be skipped by sampling or linked_flag config. `true` is shorthand for { sampling: true, linked_flag: true }\n */\n startSessionRecording(\n override?: { sampling?: boolean; linked_flag?: boolean; url_trigger?: true; event_trigger?: true } | true\n ): void {\n const overrideAll = override === true\n const overrideConfig: OverrideConfig = {\n sampling: overrideAll || !!override?.sampling,\n linked_flag: overrideAll || !!override?.linked_flag,\n url_trigger: overrideAll || !!override?.url_trigger,\n event_trigger: overrideAll || !!override?.event_trigger,\n }\n\n if (Object.values(overrideConfig).some(Boolean)) {\n // allow the session id check to rotate session id if necessary\n this.sessionManager?.checkAndGetSessionAndWindowId()\n\n if (overrideConfig.sampling) {\n this.sessionRecording?.overrideSampling()\n }\n\n if (overrideConfig.linked_flag) {\n this.sessionRecording?.overrideLinkedFlag()\n }\n\n if (overrideConfig.url_trigger) {\n this.sessionRecording?.overrideTrigger('url')\n }\n\n if (overrideConfig.event_trigger) {\n this.sessionRecording?.overrideTrigger('event')\n }\n }\n\n this.set_config({ disable_session_recording: false })\n }\n\n /**\n * turns session recording off, and updates the config option\n * disable_session_recording to true\n *\n * {@label Session replay}\n *\n * @public\n *\n * @example\n * ```js\n * // Stop session recording\n * posthog.stopSessionRecording()\n * ```\n */\n stopSessionRecording(): void {\n this.set_config({ disable_session_recording: true })\n }\n\n /**\n * returns a boolean indicating whether session recording\n * is currently running\n *\n * {@label Session replay}\n *\n * @public\n *\n * @example\n * ```js\n * // Stop session recording if it's running\n * if (posthog.sessionRecordingStarted()) {\n * posthog.stopSessionRecording()\n * }\n * ```\n */\n sessionRecordingStarted(): boolean {\n return !!this.sessionRecording?.started\n }\n\n /**\n * Capture a caught exception manually\n *\n * {@label Error tracking}\n *\n * @public\n *\n * @example\n * ```js\n * // Capture a caught exception\n * try {\n * // something that might throw\n * } catch (error) {\n * posthog.captureException(error)\n * }\n * ```\n *\n * @example\n * ```js\n * // With additional properties\n * posthog.captureException(error, {\n * customProperty: 'value',\n * anotherProperty: ['I', 'can be a list'],\n * ...\n * })\n * ```\n *\n * @param {Error} error The error to capture\n * @param {Object} [additionalProperties] Any additional properties to add to the error event\n * @returns {CaptureResult} The result of the capture\n */\n captureException(error: unknown, additionalProperties?: Properties): CaptureResult | undefined {\n const syntheticException = new Error('PostHog syntheticException')\n const errorToProperties = this.exceptions.buildProperties(error, {\n handled: true,\n syntheticException,\n })\n return this.exceptions.sendExceptionEvent({\n ...errorToProperties,\n ...additionalProperties,\n })\n }\n\n /**\n * turns exception autocapture on, and updates the config option `capture_exceptions` to the provided config (or `true`)\n *\n * {@label Error tracking}\n *\n * @public\n *\n * @example\n * ```js\n * // Start with default exception autocapture rules. No-op if already enabled\n * posthog.startExceptionAutocapture()\n * ```\n *\n * @example\n * ```js\n * // Start and override controls\n * posthog.startExceptionAutocapture({\n * // you don't have to send all of these (unincluded values will use the default)\n * capture_unhandled_errors: true || false,\n * capture_unhandled_rejections: true || false,\n * capture_console_errors: true || false\n * })\n * ```\n *\n * @param config - optional configuration option to control the exception autocapture behavior\n */\n startExceptionAutocapture(config?: ExceptionAutoCaptureConfig): void {\n this.set_config({ capture_exceptions: config ?? true })\n }\n\n /**\n * turns exception autocapture off by updating the config option `capture_exceptions` to `false`\n *\n * {@label Error tracking}\n *\n * @public\n *\n * @example\n * ```js\n * // Stop capturing exceptions automatically\n * posthog.stopExceptionAutocapture()\n * ```\n */\n stopExceptionAutocapture(): void {\n this.set_config({ capture_exceptions: false })\n }\n\n /**\n * returns a boolean indicating whether the [toolbar](/docs/toolbar) loaded\n *\n * {@label Toolbar}\n *\n * @public\n *\n * @param toolbarParams\n * @returns {boolean} Whether the toolbar loaded\n */\n\n loadToolbar(params: ToolbarParams): boolean {\n return this.toolbar.loadToolbar(params)\n }\n\n /**\n * Returns the value of a super property. Returns undefined if the property doesn't exist.\n *\n * {@label Identification}\n *\n * @remarks\n * get_property() can only be called after the PostHog library has finished loading.\n * init() has a loaded function available to handle this automatically.\n *\n * @example\n * ```js\n * // grab value for '$user_id' after the posthog library has loaded\n * posthog.init('<YOUR PROJECT TOKEN>', {\n * loaded: function(posthog) {\n * user_id = posthog.get_property('$user_id');\n * }\n * });\n * ```\n * @public\n *\n * @param {String} property_name The name of the super property you want to retrieve\n */\n get_property(property_name: string): Property | undefined {\n return this.persistence?.props[property_name]\n }\n\n /**\n * Returns the value of the session super property named property_name. If no such\n * property is set, getSessionProperty() will return the undefined value.\n *\n * {@label Identification}\n *\n * @remarks\n * This is based on browser-level `sessionStorage`, NOT the PostHog session.\n * getSessionProperty() can only be called after the PostHog library has finished loading.\n * init() has a loaded function available to handle this automatically.\n *\n * @example\n * ```js\n * // grab value for 'user_id' after the posthog library has loaded\n * posthog.init('YOUR PROJECT TOKEN', {\n * loaded: function(posthog) {\n * user_id = posthog.getSessionProperty('user_id');\n * }\n * });\n * ```\n *\n * @param {String} property_name The name of the session super property you want to retrieve\n */\n getSessionProperty(property_name: string): Property | undefined {\n return this.sessionPersistence?.props[property_name]\n }\n\n /**\n * Returns a string representation of the PostHog instance.\n *\n * {@label Initialization}\n *\n * @internal\n */\n toString(): string {\n let name = this.config.name ?? PRIMARY_INSTANCE_NAME\n if (name !== PRIMARY_INSTANCE_NAME) {\n name = PRIMARY_INSTANCE_NAME + '.' + name\n }\n return name\n }\n\n _isIdentified(): boolean {\n return (\n this.persistence?.get_property(USER_STATE) === 'identified' ||\n this.sessionPersistence?.get_property(USER_STATE) === 'identified'\n )\n }\n\n _hasPersonProcessing(): boolean {\n return !(\n this.config.person_profiles === 'never' ||\n (this.config.person_profiles === 'identified_only' &&\n !this._isIdentified() &&\n isEmptyObject(this.getGroups()) &&\n !this.persistence?.props?.[ALIAS_ID_KEY] &&\n !this.persistence?.props?.[ENABLE_PERSON_PROCESSING])\n )\n }\n\n _shouldCapturePageleave(): boolean {\n return (\n this.config.capture_pageleave === true ||\n (this.config.capture_pageleave === 'if_capture_pageview' &&\n (this.config.capture_pageview === true || this.config.capture_pageview === 'history_change'))\n )\n }\n\n /**\n * Creates a person profile for the current user, if they don't already have one and config.person_profiles is set\n * to 'identified_only'. Produces a warning and does not create a profile if config.person_profiles is set to\n * 'never'. Learn more about [person profiles](/docs/product-analytics/identify)\n *\n * {@label Identification}\n *\n * @public\n *\n * @example\n * ```js\n * posthog.createPersonProfile()\n * ```\n */\n createPersonProfile(): void {\n if (this._hasPersonProcessing()) {\n // if a person profile already exists, don't send an event when we don't need to\n return\n }\n if (!this._requirePersonProcessing('posthog.createPersonProfile')) {\n return\n }\n // sent a $set event. We don't set any properties here, but attribution props will be added later\n this.setPersonProperties({}, {})\n }\n\n /**\n * Enables person processing if possible, returns true if it does so or already enabled, false otherwise\n *\n * @param function_name\n */\n _requirePersonProcessing(function_name: string): boolean {\n if (this.config.person_profiles === 'never') {\n logger.error(\n function_name + ' was called, but process_person is set to \"never\". This call will be ignored.'\n )\n return false\n }\n this._register_single(ENABLE_PERSON_PROCESSING, true)\n return true\n }\n\n private _is_persistence_disabled(): boolean {\n if (this.config.cookieless_mode === 'always') {\n return true\n }\n const isOptedOut = this.consent.isOptedOut()\n const defaultPersistenceDisabled =\n this.config.opt_out_persistence_by_default || this.config.cookieless_mode === 'on_reject'\n\n // TRICKY: We want a deterministic state for persistence so that a new pageload has the same persistence\n return this.config.disable_persistence || (isOptedOut && !!defaultPersistenceDisabled)\n }\n\n private _sync_opt_out_with_persistence(): boolean {\n const persistenceDisabled = this._is_persistence_disabled()\n\n if (this.persistence?._disabled !== persistenceDisabled) {\n this.persistence?.set_disabled(persistenceDisabled)\n }\n if (this.sessionPersistence?._disabled !== persistenceDisabled) {\n this.sessionPersistence?.set_disabled(persistenceDisabled)\n }\n return persistenceDisabled\n }\n\n /**\n * Opts the user into data capturing and persistence.\n *\n * {@label Privacy}\n *\n * @remarks\n * Enables event tracking and data persistence (cookies/localStorage) for this PostHog instance.\n * By default, captures an `$opt_in` event unless disabled.\n *\n * @example\n * ```js\n * // simple opt-in\n * posthog.opt_in_capturing()\n * ```\n *\n * @example\n * ```js\n * // opt-in with custom event and properties\n * posthog.opt_in_capturing({\n * captureEventName: 'Privacy Accepted',\n * captureProperties: { source: 'banner' }\n * })\n * ```\n *\n * @example\n * ```js\n * // opt-in without capturing event\n * posthog.opt_in_capturing({\n * captureEventName: false\n * })\n * ```\n *\n * @public\n *\n * @param {Object} [config] A dictionary of config options to override\n * @param {string} [config.capture_event_name=$opt_in] Event name to be used for capturing the opt-in action. Set to `null` or `false` to skip capturing the optin event\n * @param {Object} [config.capture_properties] Set of properties to be captured along with the opt-in action\n */\n opt_in_capturing(options?: {\n captureEventName?: EventName | null | false /** event name to be used for capturing the opt-in action */\n captureProperties?: Properties /** set of properties to be captured along with the opt-in action */\n }): void {\n if (this.config.cookieless_mode === 'always') {\n logger.warn('Consent opt in/out is not valid with cookieless_mode=\"always\" and will be ignored')\n return\n }\n if (this.config.cookieless_mode === 'on_reject' && this.consent.isExplicitlyOptedOut()) {\n // If the user has explicitly opted out on_reject mode, then before we can start sending regular non-cookieless events\n // we need to reset the instance to ensure that there is no leaking of state or data between the cookieless and regular events\n this.reset(true)\n this.sessionManager?.destroy()\n this.pageViewManager?.destroy()\n this.sessionManager = new SessionIdManager(this)\n this.pageViewManager = new PageViewManager(this)\n if (this.persistence) {\n this.sessionPropsManager = new SessionPropsManager(this, this.sessionManager, this.persistence)\n }\n this.sessionRecording = new SessionRecording(this)\n this.sessionRecording.startIfEnabledOrStop()\n }\n\n this.consent.optInOut(true)\n this._sync_opt_out_with_persistence()\n\n // Start queue after opting in\n this._start_queue_if_opted_in()\n\n // Restart session recording if it should now be enabled\n // (this handles the case where opt_out_capturing_by_default or cookieless_mode prevented it from starting)\n this.sessionRecording?.startIfEnabledOrStop()\n\n // Reinitialize surveys if we're in cookieless mode and just opted in\n if (this.config.cookieless_mode == 'on_reject') {\n this.surveys.loadIfEnabled()\n }\n\n // Don't capture if captureEventName is null or false\n if (isUndefined(options?.captureEventName) || options?.captureEventName) {\n this.capture(options?.captureEventName ?? '$opt_in', options?.captureProperties, { send_instantly: true })\n }\n\n if (this.config.capture_pageview) {\n this._captureInitialPageview()\n }\n }\n\n /**\n * Opts the user out of data capturing and persistence.\n *\n * {@label Privacy}\n *\n * @remarks\n * Disables event tracking and data persistence (cookies/localStorage) for this PostHog instance.\n * If `opt_out_persistence_by_default` is true, SDK persistence will also be disabled.\n *\n * @example\n * ```js\n * // opt user out (e.g., on privacy settings page)\n * posthog.opt_out_capturing()\n * ```\n *\n * @public\n */\n opt_out_capturing(): void {\n if (this.config.cookieless_mode === 'always') {\n logger.warn('Consent opt in/out is not valid with cookieless_mode=\"always\" and will be ignored')\n return\n }\n\n if (this.config.cookieless_mode === 'on_reject' && this.consent.isOptedIn()) {\n // If the user has opted in, we need to reset the instance to ensure that there is no leaking of state or data between the cookieless and regular events\n this.reset(true)\n }\n\n this.consent.optInOut(false)\n this._sync_opt_out_with_persistence()\n\n if (this.config.cookieless_mode === 'on_reject') {\n // If cookieless_mode is 'on_reject', we start capturing events in cookieless mode\n this.register({\n distinct_id: COOKIELESS_SENTINEL_VALUE,\n $device_id: null,\n })\n this.sessionManager?.destroy()\n this.pageViewManager?.destroy()\n this.sessionManager = undefined\n this.sessionPropsManager = undefined\n this.sessionRecording?.stopRecording()\n this.sessionRecording = undefined\n this._captureInitialPageview()\n }\n }\n\n /**\n * Checks if the user has opted into data capturing.\n *\n * {@label Privacy}\n *\n * @remarks\n * Returns the current consent status for event tracking and data persistence.\n *\n * @example\n * ```js\n * if (posthog.has_opted_in_capturing()) {\n * // show analytics features\n * }\n * ```\n *\n * @public\n *\n * @returns {boolean} current opt-in status\n */\n has_opted_in_capturing(): boolean {\n return this.consent.isOptedIn()\n }\n\n /**\n * Checks if the user has opted out of data capturing.\n *\n * {@label Privacy}\n *\n * @remarks\n * Returns the current consent status for event tracking and data persistence.\n *\n * @example\n * ```js\n * if (posthog.has_opted_out_capturing()) {\n * // disable analytics features\n * }\n * ```\n *\n * @public\n *\n * @returns {boolean} current opt-out status\n */\n has_opted_out_capturing(): boolean {\n return this.consent.isOptedOut()\n }\n\n /**\n * Returns the explicit consent status of the user.\n *\n * @remarks\n * This can be used to check if the user has explicitly opted in or out of data capturing, or neither. This does not\n * take the default config options into account, only whether the user has made an explicit choice, so this can be\n * used to determine whether to show an initial cookie banner or not.\n *\n * @example\n * ```js\n * const consentStatus = posthog.get_explicit_consent_status()\n * if (consentStatus === \"granted\") {\n * // user has explicitly opted in\n * } else if (consentStatus === \"denied\") {\n * // user has explicitly opted out\n * } else if (consentStatus === \"pending\"){\n * // user has not made a choice, show consent banner\n * }\n * ```\n *\n * @public\n *\n * @returns {boolean | null} current explicit consent status\n */\n get_explicit_consent_status(): 'granted' | 'denied' | 'pending' {\n const consent = this.consent.consent\n return consent === ConsentStatus.GRANTED ? 'granted' : consent === ConsentStatus.DENIED ? 'denied' : 'pending'\n }\n\n /**\n * Checks whether the PostHog library is currently capturing events.\n *\n * Usually this means that the user has not opted out of capturing, but the exact behaviour can be controlled by\n * some config options.\n *\n * Additionally, if the cookieless_mode is set to 'on_reject', we will capture events in cookieless mode if the\n * user has explicitly opted out.\n *\n * {@label Privacy}\n *\n * @see {PostHogConfig.cookieless_mode}\n * @see {PostHogConfig.opt_out_persistence_by_default}\n * @see {PostHogConfig.respect_dnt}\n *\n * @returns {boolean} whether the posthog library is capturing events\n */\n is_capturing(): boolean {\n if (this.config.cookieless_mode === 'always') {\n return true\n }\n if (this.config.cookieless_mode === 'on_reject') {\n return this.consent.isExplicitlyOptedOut() || this.consent.isOptedIn()\n } else {\n return !this.has_opted_out_capturing()\n }\n }\n\n /**\n * Clear the user's opt in/out status of data capturing and cookies/localstorage for this PostHog instance\n *\n * {@label Privacy}\n *\n * @public\n *\n */\n clear_opt_in_out_capturing(): void {\n this.consent.reset()\n this._sync_opt_out_with_persistence()\n }\n\n _is_bot(): boolean | undefined {\n if (navigator) {\n return isLikelyBot(navigator, this.config.custom_blocked_useragents)\n } else {\n return undefined\n }\n }\n\n _captureInitialPageview(): void {\n if (!document) {\n return\n }\n\n // If page is not visible, add a listener to detect when the page becomes visible\n // and trigger the pageview only then\n // This is useful to avoid `prerender` calls from Chrome/Wordpress/SPAs\n // that are not visible to the user\n\n if (document.visibilityState !== 'visible') {\n if (!this._visibilityStateListener) {\n this._visibilityStateListener = this._captureInitialPageview.bind(this)\n addEventListener(document, 'visibilitychange', this._visibilityStateListener)\n }\n\n return\n }\n\n // Extra check here to guarantee we only ever trigger a single `$pageview` event\n if (!this._initialPageviewCaptured) {\n this._initialPageviewCaptured = true\n this.capture('$pageview', { title: document.title }, { send_instantly: true })\n\n // After we've captured the initial pageview, we can remove the listener\n if (this._visibilityStateListener) {\n document.removeEventListener('visibilitychange', this._visibilityStateListener)\n this._visibilityStateListener = null\n }\n }\n }\n\n /**\n * Enables or disables debug mode for detailed logging.\n *\n * @remarks\n * Debug mode logs all PostHog calls to the browser console for troubleshooting.\n * Can also be enabled by adding `?__posthog_debug=true` to the URL.\n *\n * {@label Initialization}\n *\n * @example\n * ```js\n * // enable debug mode\n * posthog.debug(true)\n * ```\n *\n * @example\n * ```js\n * // disable debug mode\n * posthog.debug(false)\n * ```\n *\n * @public\n *\n * @param {boolean} [debug] If true, will enable debug mode.\n */\n debug(debug?: boolean): void {\n if (debug === false) {\n window?.console.log(\"You've disabled debug mode.\")\n this.set_config({ debug: false })\n } else {\n window?.console.log(\n \"You're now in debug mode. All calls to PostHog will be logged in your console.\\nYou can disable this with `posthog.debug(false)`.\"\n )\n this.set_config({ debug: true })\n }\n }\n\n /**\n * Helper method to check if external API calls (flags/decide) should be disabled\n * Handles migration from old `advanced_disable_decide` to new `advanced_disable_flags`\n */\n _shouldDisableFlags(): boolean {\n // Check if advanced_disable_flags was explicitly set in original config\n const originalConfig = this._originalUserConfig || {}\n if ('advanced_disable_flags' in originalConfig) {\n return !!originalConfig.advanced_disable_flags\n }\n\n // Check if advanced_disable_flags was set post-init (different from default false)\n if (this.config.advanced_disable_flags !== false) {\n return !!this.config.advanced_disable_flags\n }\n\n // Check for post-init changes to advanced_disable_decide\n if (this.config.advanced_disable_decide === true) {\n logger.warn(\n \"Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. \" +\n 'The old field will be removed in a future major version.'\n )\n return true\n }\n\n // Fall back to migration logic for original user config\n return migrateConfigField(originalConfig, 'advanced_disable_flags', 'advanced_disable_decide', false, logger)\n }\n\n private _runBeforeSend(data: CaptureResult): CaptureResult | null {\n if (isNullish(this.config.before_send)) {\n return data\n }\n\n const fns = isArray(this.config.before_send) ? this.config.before_send : [this.config.before_send]\n let beforeSendResult: CaptureResult | null = data\n for (const fn of fns) {\n beforeSendResult = fn(beforeSendResult)\n if (isNullish(beforeSendResult)) {\n const logMessage = `Event '${data.event}' was rejected in beforeSend function`\n if (isKnownUnsafeEditableEvent(data.event)) {\n logger.warn(`${logMessage}. This can cause unexpected behavior.`)\n } else {\n logger.info(logMessage)\n }\n return null\n }\n if (!beforeSendResult.properties || isEmptyObject(beforeSendResult.properties)) {\n logger.warn(\n `Event '${data.event}' has no properties after beforeSend function, this is likely an error.`\n )\n }\n }\n return beforeSendResult\n }\n\n /**\n * Returns the current page view ID.\n *\n * {@label Initialization}\n *\n * @public\n *\n * @returns {string} The current page view ID\n */\n public getPageViewId(): string | undefined {\n return this.pageViewManager._currentPageview?.pageViewId\n }\n\n /**\n * Capture written user feedback for a LLM trace. Numeric values are converted to strings.\n *\n * {@label LLM analytics}\n *\n * @public\n *\n * @param traceId The trace ID to capture feedback for.\n * @param userFeedback The feedback to capture.\n */\n captureTraceFeedback(traceId: string | number, userFeedback: string) {\n this.capture('$ai_feedback', {\n $ai_trace_id: String(traceId),\n $ai_feedback_text: userFeedback,\n })\n }\n\n /**\n * Capture a metric for a LLM trace. Numeric values are converted to strings.\n *\n * {@label LLM analytics}\n *\n * @public\n *\n * @param traceId The trace ID to capture the metric for.\n * @param metricName The name of the metric to capture.\n * @param metricValue The value of the metric to capture.\n */\n captureTraceMetric(traceId: string | number, metricName: string, metricValue: string | number | boolean) {\n this.capture('$ai_metric', {\n $ai_trace_id: String(traceId),\n $ai_metric_name: metricName,\n $ai_metric_value: String(metricValue),\n })\n }\n\n private _checkLocalStorageForDebug(debugConfig: boolean | undefined) {\n const explicitlyFalse = isBoolean(debugConfig) && !debugConfig\n const isTrueInLocalStorage = localStore._is_supported() && localStore._get('ph_debug') === 'true'\n return explicitlyFalse ? false : isTrueInLocalStorage ? true : debugConfig\n }\n}\n\nsafewrapClass(PostHog, ['identify'])\n\nconst add_dom_loaded_handler = function () {\n // Cross browser DOM Loaded support\n function dom_loaded_handler() {\n // function flag since we only want to execute this once\n if ((dom_loaded_handler as any).done) {\n return\n }\n ;(dom_loaded_handler as any).done = true\n\n ENQUEUE_REQUESTS = false\n\n each(instances, function (inst: PostHog) {\n inst._dom_loaded()\n })\n }\n\n if (document?.addEventListener) {\n if (document.readyState === 'complete') {\n // safari 4 can fire the DOMContentLoaded event before loading all\n // external JS (including this file). you will see some copypasta\n // on the internet that checks for 'complete' and 'loaded', but\n // 'loaded' is an IE thing\n dom_loaded_handler()\n } else {\n addEventListener(document, 'DOMContentLoaded', dom_loaded_handler, { capture: false })\n }\n\n return\n }\n\n // Only IE6-8 don't support `document.addEventListener` and we don't support them\n // so let's simply log an error stating PostHog couldn't be initialized\n // We're checking for `window` to avoid erroring out on a SSR context\n if (window) {\n logger.error(\"Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized\")\n }\n}\n\nexport function init_from_snippet(): void {\n const posthogMain = (instances[PRIMARY_INSTANCE_NAME] = new PostHog())\n\n const snippetPostHog = assignableWindow['posthog']\n\n if (snippetPostHog) {\n /**\n * The snippet uses some clever tricks to allow deferred loading of array.js (this code)\n *\n * window.posthog is an array which the queue of calls made before the lib is loaded\n * It has methods attached to it to simulate the posthog object so for instance\n *\n * window.posthog.init(\"TOKEN\", {api_host: \"foo\" })\n * window.posthog.capture(\"my-event\", {foo: \"bar\" })\n *\n * ... will mean that window.posthog will look like this:\n * window.posthog == [\n * [\"my-event\", {foo: \"bar\"}]\n * ]\n *\n * window.posthog[_i] == [\n * [\"TOKEN\", {api_host: \"foo\" }, \"posthog\"]\n * ]\n *\n * If a name is given to the init function then the same as above is true but as a sub-property on the object:\n *\n * window.posthog.init(\"TOKEN\", {}, \"ph2\")\n * window.posthog.ph2.people.set({foo: \"bar\"})\n *\n * window.posthog.ph2 == []\n * window.posthog.people == [\n * [\"set\", {foo: \"bar\"}]\n * ]\n *\n */\n\n // Call all pre-loaded init calls properly\n\n each(snippetPostHog['_i'], function (item: [token: string, config: Partial<PostHogConfig>, name: string]) {\n if (item && isArray(item)) {\n const instance = posthogMain.init(item[0], item[1], item[2])\n\n const instanceSnippet = snippetPostHog[item[2]] || snippetPostHog\n\n if (instance) {\n // Crunch through the people queue first - we queue this data up &\n // flush on identify, so it's better to do all these operations first\n instance._execute_array.call(instance.people, instanceSnippet.people)\n instance._execute_array(instanceSnippet)\n }\n }\n })\n }\n\n assignableWindow['posthog'] = posthogMain\n\n add_dom_loaded_handler()\n}\n\nexport function init_as_module(): PostHog {\n const posthogMain = (instances[PRIMARY_INSTANCE_NAME] = new PostHog())\n\n add_dom_loaded_handler()\n\n return posthogMain\n}\n"]}
|