posthog-js 1.166.2 → 1.167.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"posthog-core.js","sourceRoot":"","sources":["../../src/posthog-core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,MAAM,MAAM,UAAU,CAAA;AAC7B,OAAO,EACH,uBAAuB,EACvB,IAAI,EACJ,SAAS,EACT,MAAM,EACN,QAAQ,EACR,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,sBAAsB,GACzB,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACpG,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EACH,YAAY,EACZ,kBAAkB,EAClB,sBAAsB,EACtB,4BAA4B,EAC5B,UAAU,EACV,wBAAwB,GAC3B,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAA;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC3E,OAAO,EAGH,WAAW,GAad,MAAM,SAAS,CAAA;AAChB,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QAAQ,CAAC,cAAc,CAAC,eAAe,CAAC,CAAA;gBAC5C,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAA;IACN,CAAC;IAED,gBAAgB,CAAC,SAAS,CAAC,GAAG,WAAW,CAAA;IAEzC,sBAAsB,EAAE,CAAA;AAC5B,CAAC;AAED,MAAM,UAAU,cAAc;IAC1B,IAAM,WAAW,GAAG,CAAC,SAAS,CAAC,qBAAqB,CAAC,GAAG,IAAI,OAAO,EAAE,CAAC,CAAA;IAEtE,sBAAsB,EAAE,CAAA;IAExB,OAAO,WAAW,CAAA;AACtB,CAAC","sourcesContent":["import Config from './config'\nimport {\n _copyAndTruncateStrings,\n each,\n eachArray,\n extend,\n includes,\n registerEvent,\n safewrapClass,\n isCrossDomainCookie,\n isDistinctIdStringLike,\n} from './utils'\nimport { assignableWindow, document, location, navigator, userAgent, window } from './utils/globals'\nimport { PostHogFeatureFlags } from './posthog-featureflags'\nimport { PostHogPersistence } from './posthog-persistence'\nimport {\n ALIAS_ID_KEY,\n FLAG_CALL_REPORTED,\n PEOPLE_DISTINCT_ID_KEY,\n SESSION_RECORDING_IS_SAMPLED,\n USER_STATE,\n ENABLE_PERSON_PROCESSING,\n} from './constants'\nimport { SessionRecording } from './extensions/replay/sessionrecording'\nimport { Decide } from './decide'\nimport { Toolbar } from './extensions/toolbar'\nimport { localStore } from './storage'\nimport { RequestQueue } from './request-queue'\nimport { RetryQueue } from './retry-queue'\nimport { SessionIdManager } from './sessionid'\nimport { RequestRouter, RequestRouterRegion } from './utils/request-router'\nimport {\n CaptureOptions,\n CaptureResult,\n Compression,\n DecideResponse,\n EarlyAccessFeatureCallback,\n IsFeatureEnabledOptions,\n JsonType,\n PostHogConfig,\n Properties,\n Property,\n QueuedRequestOptions,\n RequestCallback,\n SessionIdChangedCallback,\n SnippetArrayItem,\n ToolbarParams,\n} from './types'\nimport { SentryIntegration, SentryIntegrationOptions, sentryIntegration } from './extensions/sentry-integration'\nimport { setupSegmentIntegration } from './extensions/segment-integration'\nimport { PageViewManager } from './page-view'\nimport { PostHogSurveys } from './posthog-surveys'\nimport { RateLimiter } from './rate-limiter'\nimport { uuidv7 } from './uuidv7'\nimport { Survey, SurveyCallback, SurveyQuestionBranchingType } from './posthog-surveys-types'\nimport {\n isArray,\n isBoolean,\n isEmptyObject,\n isEmptyString,\n isFunction,\n isNumber,\n isObject,\n isString,\n isUndefined,\n} from './utils/type-utils'\nimport { Info } from './utils/event-utils'\nimport { logger } from './utils/logger'\nimport { SessionPropsManager } from './session-props'\nimport { isLikelyBot } from './utils/blocked-uas'\nimport { extendURLParams, request, SUPPORTS_REQUEST } from './request'\nimport { Heatmaps } from './heatmaps'\nimport { ScrollManager } from './scroll-manager'\nimport { SimpleEventEmitter } from './utils/simple-event-emitter'\nimport { Autocapture } from './autocapture'\nimport { TracingHeaders } from './extensions/tracing-headers'\nimport { ConsentManager } from './consent'\nimport { ExceptionObserver } from './extensions/exception-autocapture'\nimport { WebVitalsAutocapture } from './extensions/web-vitals'\nimport { WebExperiments } from './web-experiments'\nimport { PostHogExceptions } from './posthog-exceptions'\n\n/*\nSIMPLE STYLE GUIDE:\n\nthis.x === public function\nthis._x === internal - only use within this file\nthis.__x === private - only use within the class\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\nexport const defaultConfig = (): PostHogConfig => ({\n api_host: 'https://us.i.posthog.com',\n ui_host: null,\n token: '',\n autocapture: true,\n rageclick: 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 store_google: true,\n custom_campaign_params: [],\n custom_blocked_useragents: [],\n save_referrer: true,\n capture_pageview: true,\n capture_pageleave: 'if_capture_pageview', // We'll only capture pageleave events if capture_pageview is also true\n debug: (location && isString(location?.search) && location.search.indexOf('__posthog_debug=true') !== -1) || false,\n verbose: 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 enable_recording_console_log: undefined, // When undefined, it falls back to the server-side setting\n secure_cookie: window?.location?.protocol === 'https:',\n ip: true,\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 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 inapp_protocol: '//',\n inapp_link_new_window: false,\n request_batching: true,\n properties_string_max_length: 65535,\n session_recording: {},\n mask_all_element_attributes: false,\n mask_all_text: false,\n advanced_disable_decide: false,\n advanced_disable_feature_flags: false,\n advanced_disable_feature_flags_on_first_load: false,\n advanced_disable_toolbar_metrics: false,\n feature_flag_request_timeout_ms: 3000,\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 // Used for internal testing\n _onCapture: __NOOP,\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: 'always',\n __add_tracing_headers: false,\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 // 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 * PostHog Library Object\n * @constructor\n */\nexport class PostHog {\n __loaded: boolean\n config: PostHogConfig\n\n rateLimiter: RateLimiter\n scrollManager: ScrollManager\n pageViewManager: PageViewManager\n featureFlags: PostHogFeatureFlags\n surveys: PostHogSurveys\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 autocapture?: Autocapture\n heatmaps?: Heatmaps\n webVitalsAutocapture?: WebVitalsAutocapture\n exceptionObserver?: ExceptionObserver\n\n _requestQueue?: RequestQueue\n _retryQueue?: RetryQueue\n sessionRecording?: SessionRecording\n webPerformance = new DeprecatedWebPerformanceObserver()\n\n _initialPageviewCaptured: boolean\n _triggered_notifs: any\n compression?: Compression\n __request_queue: QueuedRequestOptions[]\n decideEndpointWasHit: boolean\n analyticsDefaultEndpoint: string\n version = Config.LIB_VERSION\n\n SentryIntegration: typeof SentryIntegration\n sentryIntegration: (options?: SentryIntegrationOptions) => ReturnType<typeof sentryIntegration>\n\n private _internalEventEmitter = new SimpleEventEmitter()\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.decideEndpointWasHit = false\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\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.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\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))\n }\n\n // Initialization methods\n\n /**\n * This function initializes a new instance of the PostHog capturing object.\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. To define a\n * second instance on the page, you would call:\n *\n * posthog.init('new token', { your: 'config' }, 'library_name');\n *\n * and use it like so:\n *\n * posthog.library_name.capture(...);\n *\n * @param {String} token Your PostHog API token\n * @param {Object} [config] A dictionary of config options to override. <a href=\"https://github.com/posthog/posthog-js/blob/6e0e873/src/posthog-core.js#L57-L91\">See a list of default config options</a>.\n * @param {String} [name] The name for the new posthog instance that you want created\n */\n init(\n token: string,\n config?: OnlyValidKeys<Partial<PostHogConfig>, Partial<PostHogConfig>>,\n name?: string\n ): PostHog | undefined {\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 // Add as a property to the primary instance (this isn't type-safe but its 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 logger.warn('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 this._triggered_notifs = []\n\n this.set_config(\n extend({}, defaultConfig(), configRenames(config), {\n name: name,\n token: token,\n })\n )\n\n if (this.config.on_xhr_error) {\n logger.error('[posthog] on_xhr_error is deprecated. Use on_request_error instead')\n }\n\n this.compression = config.disable_compression ? undefined : Compression.GZipJS\n\n this.persistence = new PostHogPersistence(this.config)\n this.sessionPersistence =\n this.config.persistence === 'sessionStorage'\n ? this.persistence\n : new PostHogPersistence({ ...this.config, persistence: 'sessionStorage' })\n const initialPersistenceProps = { ...this.persistence.props }\n const initialSessionProps = { ...this.sessionPersistence.props }\n\n this._requestQueue = new RequestQueue((req) => this._send_retriable_request(req))\n this._retryQueue = new RetryQueue(this)\n this.__request_queue = []\n\n this.sessionManager = new SessionIdManager(this.config, this.persistence)\n this.sessionPropsManager = new SessionPropsManager(this.sessionManager, this.persistence)\n\n new TracingHeaders(this).startIfEnabledOrStop()\n\n this.sessionRecording = new SessionRecording(this)\n this.sessionRecording.startIfEnabledOrStop()\n\n if (!this.config.disable_scroll_properties) {\n this.scrollManager.startMeasuringScrollPosition()\n }\n\n this.autocapture = new Autocapture(this)\n this.autocapture.startIfEnabled()\n this.surveys.loadIfEnabled()\n\n this.heatmaps = new Heatmaps(this)\n this.heatmaps.startIfEnabled()\n\n this.webVitalsAutocapture = new WebVitalsAutocapture(this)\n\n this.exceptionObserver = new ExceptionObserver(this)\n this.exceptionObserver.startIfEnabled()\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 this._sync_opt_out_with_persistence()\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(\n (res: Record<string, string | boolean>, key) => (\n (res[key] = config.bootstrap?.featureFlags?.[key] || false), res\n ),\n {}\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 (!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 persitence\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 window?.addEventListener?.('onpagehide' in self ? 'pagehide' : 'unload', this._handle_unload.bind(this))\n\n this.toolbar.maybeLoadToolbar()\n\n // We wan't 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)) {\n this.on('eventCaptured', (data) => this.config._onCapture(data.event, data))\n }\n\n return this\n }\n\n // Private methods\n _afterDecideResponse(response: DecideResponse) {\n this.compression = undefined\n if (response.supportedCompression && !this.config.disable_compression) {\n this.compression = includes(response['supportedCompression'], Compression.GZipJS)\n ? Compression.GZipJS\n : includes(response['supportedCompression'], Compression.Base64)\n ? Compression.Base64\n : undefined\n }\n\n if (response.analytics?.endpoint) {\n this.analyticsDefaultEndpoint = response.analytics.endpoint\n }\n\n this.sessionRecording?.afterDecideResponse(response)\n this.autocapture?.afterDecideResponse(response)\n this.heatmaps?.afterDecideResponse(response)\n this.experiments?.afterDecideResponse(response)\n this.surveys?.afterDecideResponse(response)\n this.webVitalsAutocapture?.afterDecideResponse(response)\n this.exceptions?.afterDecideResponse(response)\n this.exceptionObserver?.afterDecideResponse(response)\n }\n\n _loaded(): void {\n // Pause `reloadFeatureFlags` calls in config.loaded callback.\n // These feature flags are loaded in the decide call made right\n // afterwards\n const disableDecide = this.config.advanced_disable_decide\n if (!disableDecide) {\n this.featureFlags.setReloadingPaused(true)\n }\n\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()) {\n this._captureInitialPageview()\n }\n }, 1)\n }\n\n // Call decide to get what features are enabled and other settings.\n // As a reminder, if the /decide endpoint is disabled, feature flags, toolbar, session recording, autocapture,\n // and compression will not be available.\n if (!disableDecide) {\n new Decide(this).call()\n\n // TRICKY: Reset any decide reloads queued during config.loaded because they'll be\n // covered by the decide call right above.\n this.featureFlags.resetRequestQueue()\n }\n }\n\n _start_queue_if_opted_in(): void {\n if (!this.has_opted_out_capturing()) {\n if (this.config.request_batching) {\n this._requestQueue?.enable()\n }\n }\n }\n\n _dom_loaded(): void {\n if (!this.has_opted_out_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 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: QueuedRequestOptions): 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 }\n options.compression = options.compression === 'best-available' ? this.compression : options.compression\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: QueuedRequestOptions): 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 * ### Usage:\n * posthog.push(['register', { a: 'b' }]);\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 * Capture an event. This is the most important and\n * frequently used PostHog function.\n *\n * ### Usage:\n *\n * // capture an event named 'Registered'\n * posthog.capture('Registered', {'Gender': 'Male', 'Age': 21});\n *\n * // capture an event using navigator.sendBeacon\n * posthog.capture('Left page', {'duration_seconds': 35}, {transport: 'sendBeacon'});\n *\n * @param {String} event_name The name of the event. This can be anything the user does - 'Button Click', 'Sign Up', 'Item Purchased', etc.\n * @param {Object} [properties] A set of properties to include with the event you're sending. These describe the user who did the event or details about the event itself.\n * @param {Object} [config] Optional configuration for this capture request.\n * @param {String} [config.transport] Transport method for network request ('XHR' or 'sendBeacon').\n * @param {Date} [config.timestamp] Timestamp is a Date object. If not set, it'll automatically be set to the current time.\n */\n capture(event_name: string, properties?: Properties | null, options?: CaptureOptions): 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.consent.isOptedOut()) {\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 if (!this.config.opt_out_useragent_filter && this._is_bot()) {\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 // 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.store_google) {\n this.sessionPersistence.update_campaign_params()\n }\n if (this.config.save_referrer) {\n this.sessionPersistence.update_referrer_info()\n }\n if (this.config.store_google || 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 let data: CaptureResult = {\n uuid: uuidv7(),\n event: event_name,\n properties: this._calculate_event_properties(event_name, properties || {}, timestamp),\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 const setOnceProperties = this._calculate_set_once_properties(options?.$set_once)\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 // 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 this._internalEventEmitter.emit('eventCaptured', data)\n\n const requestOptions: QueuedRequestOptions = {\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 _calculate_event_properties(event_name: string, event_properties: Properties, timestamp?: Date): Properties {\n timestamp = timestamp || new Date()\n if (!this.persistence || !this.sessionPersistence) {\n return event_properties\n }\n\n // set defaults\n const startTimestamp = this.persistence.remove_event_timer(event_name)\n let properties = { ...event_properties }\n properties['token'] = this.config.token\n\n if (event_name === '$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 = Info.properties()\n\n if (this.sessionManager) {\n const { sessionId, windowId } = this.sessionManager.checkAndGetSessionAndWindowId()\n properties['$session_id'] = sessionId\n properties['$window_id'] = windowId\n }\n\n if (this.requestRouter.region === RequestRouterRegion.CUSTOM) {\n properties['$lib_custom_api_host'] = this.config.api_host\n }\n\n if (\n this.sessionPropsManager &&\n this.config.__preview_send_client_session_params &&\n (event_name === '$pageview' || event_name === '$pageleave' || event_name === '$autocapture')\n ) {\n const sessionProps = this.sessionPropsManager.getSessionProps()\n properties = extend(properties, sessionProps)\n }\n\n if (!this.config.disable_scroll_properties) {\n let performanceProperties: Record<string, any> = {}\n if (event_name === '$pageview') {\n performanceProperties = this.pageViewManager.doPageView(timestamp)\n } else if (event_name === '$pageleave') {\n performanceProperties = this.pageViewManager.doPageLeave(timestamp)\n }\n properties = extend(properties, performanceProperties)\n }\n\n if (event_name === '$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 properties = sanitize_properties(properties, event_name)\n }\n\n // add person processing flag as very last step, so it cannot be overridden. process_person=true is default\n properties['$process_person_profile'] = this._hasPersonProcessing()\n\n return properties\n }\n\n _calculate_set_once_properties(dataSetOnce?: Properties): Properties | undefined {\n if (!this.persistence || !this._hasPersonProcessing()) {\n return dataSetOnce\n }\n // if we're an identified person, send initial params with every event\n const setOnceProperties = extend({}, this.persistence.get_initial_props(), dataSetOnce || {})\n if (isEmptyObject(setOnceProperties)) {\n return undefined\n }\n return setOnceProperties\n }\n\n /**\n * Register a set of super properties, which are included with all\n * events. This will overwrite previous super property values, except\n * for session properties (see `register_for_session(properties)`).\n *\n * ### Usage:\n *\n * // register 'Gender' as a super property\n * posthog.register({'Gender': 'Female'});\n *\n * // register several super properties when a user signs up\n * posthog.register({\n * 'Email': 'jdoe@example.com',\n * 'Account Type': 'Free'\n * });\n *\n * // Display the properties\n * console.log(posthog.persistence.properties())\n *\n * @param {Object} properties An associative array of 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 * Register a set of super properties only once. These will not\n * overwrite previous super property values, unlike register().\n *\n * ### Usage:\n *\n * // register a super property for the first time only\n * posthog.register_once({\n * 'First Login Date': new Date().toISOString()\n * });\n *\n * // Display the properties\n * console.log(posthog.persistence.properties())\n *\n * ### Notes:\n *\n * If default_value is specified, current super properties\n * with that value will be overwritten.\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 * Register a set of super properties, which are included with all events, but only\n * for THIS SESSION. These will overwrite all other super property values.\n *\n * Unlike regular super properties, which last in LocalStorage for a long time,\n * session super properties get cleared after a session ends.\n *\n * ### Usage:\n *\n * // register on all events this session\n * posthog.register_for_session({'referer': customGetReferer()});\n *\n * // register several session super properties when a user signs up\n * posthog.register_for_session({\n * 'selectedPlan': 'pro',\n * 'completedSteps': 4,\n * });\n *\n * // Display the properties\n * console.log(posthog.sessionPersistence.properties())\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 * Delete a super property stored with the current user.\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 * Delete a session super property stored with the current user.\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 * Get feature flag value for user (supports multivariate flags).\n *\n * ### Usage:\n *\n * if(posthog.getFeatureFlag('beta-feature') === 'some-value') { // do something }\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 * ### Usage:\n *\n * if(posthog.getFeatureFlag('beta-feature') === 'some-value') {\n * const someValue = posthog.getFeatureFlagPayload('beta-feature')\n * // do something\n * }\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 * See if feature flag is enabled for user.\n *\n * ### Usage:\n *\n * if(posthog.isFeatureEnabled('beta-feature')) { // do something }\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?: IsFeatureEnabledOptions): boolean | undefined {\n return this.featureFlags.isFeatureEnabled(key, options)\n }\n\n reloadFeatureFlags(): void {\n this.featureFlags.reloadFeatureFlags()\n }\n\n /** Opt the user in or out of an early access feature. */\n updateEarlyAccessFeatureEnrollment(key: string, isEnrolled: boolean): void {\n this.featureFlags.updateEarlyAccessFeatureEnrollment(key, isEnrolled)\n }\n\n /** Get the list of early access features. To check enrollment status, use `isFeatureEnabled`. */\n getEarlyAccessFeatures(callback: EarlyAccessFeatureCallback, force_reload = false): void {\n return this.featureFlags.getEarlyAccessFeatures(callback, force_reload)\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 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 *\n * ### Usage:\n *\n * posthog.onFeatureFlags(function(featureFlags) { // do something })\n *\n * @param {Function} [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.\n * @returns {Function} A function that can be called to unsubscribe the listener. Used by useEffect when the component unmounts.\n */\n onFeatureFlags(callback: (flags: string[], variants: Record<string, string | boolean>) => void): () => void {\n return this.featureFlags.onFeatureFlags(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 * ### Usage:\n *\n * posthog.onSessionId(function(sessionId, windowId) { // do something })\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 /** Get list of all surveys. */\n getSurveys(callback: SurveyCallback, forceReload = false): void {\n this.surveys.getSurveys(callback, forceReload)\n }\n\n /** Get surveys that should be enabled for the current user. */\n getActiveMatchingSurveys(callback: SurveyCallback, forceReload = false): void {\n this.surveys.getActiveMatchingSurveys(callback, forceReload)\n }\n\n /** Render a survey on a specific element. */\n renderSurvey(surveyId: string, selector: string): void {\n this.surveys.renderSurvey(surveyId, selector)\n }\n\n /** Checks the feature flags associated with this Survey to see if the survey can be rendered. */\n canRenderSurvey(surveyId: string): void {\n this.surveys.canRenderSurvey(surveyId)\n }\n\n /** Get the next step of the survey: a question index or `end` */\n getNextSurveyStep(\n survey: Survey,\n currentQuestionIndex: number,\n response: string | string[] | number | null\n ): number | SurveyQuestionBranchingType.End {\n return this.surveys.getNextSurveyStep(survey, currentQuestionIndex, response)\n }\n\n /**\n * Identify a user with a unique ID instead of a PostHog\n * randomly generated distinct_id. If the method is never called,\n * then unique visitors will be identified by a UUID that is generated\n * the first time they visit the site.\n *\n * If user properties are passed, they are also sent to posthog.\n *\n * ### Usage:\n *\n * posthog.identify('[user unique id]')\n * posthog.identify('[user unique id]', { email: 'john@example.com' })\n * posthog.identify('[user unique id]', {}, { referral_code: '12345' })\n *\n * ### Notes:\n *\n * You can call this function to overwrite a previously set\n * unique ID for the current user.\n *\n * If the user has been identified ($user_state in persistence is set to 'identified'),\n * then capture of $identify is skipped to avoid merging users. For example,\n * if your system allows an admin user to impersonate another user.\n *\n * Then a single browser instance can have:\n *\n * `identify('a') -> capture(1) -> identify('b') -> capture(2)`\n *\n * and capture 1 and capture 2 will have the correct distinct_id.\n * but users a and b will NOT be merged in posthog.\n *\n * However, if reset is called then:\n *\n * `identify('a') -> capture(1) -> reset() -> capture(2) -> identify('b') -> capture(3)`\n *\n * users a and b are not merged.\n * Capture 1 is associated with user a.\n * A new distinct id is generated for capture 2.\n * which is merged with user b.\n * So, capture 2 and 3 are associated with user b.\n *\n * If you want to merge two identified users, you can call posthog.alias\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\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\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(userPropertiesToSet || {}, false)\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 // 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 go for a $set event\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 for the Person associated with the current distinct_id. If config.person_profiles is set to\n * identified_only, and a Person profile has not been created yet, this will create one.\n *\n *\n * @param {Object} [userPropertiesToSet] Optional: An associative array of properties to store about the user\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 // Update current user properties\n this.setPersonPropertiesForFlags(userPropertiesToSet || {})\n\n this.capture('$set', { $set: userPropertiesToSet || {}, $set_once: userPropertiesToSetOnce || {} })\n }\n\n /**\n * Sets group analytics information for subsequent events and reloads feature flags.\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 if (!this._requirePersonProcessing('posthog.group')) {\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 */\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 * Set override person properties for feature flags.\n * This is used when dealing with new persons / where you don't want to wait for ingestion\n * to update user properties.\n */\n setPersonPropertiesForFlags(properties: Properties, reloadFeatureFlags = true): void {\n if (!this._requirePersonProcessing('posthog.setPersonPropertiesForFlags')) {\n return\n }\n this.featureFlags.setPersonPropertiesForFlags(properties, reloadFeatureFlags)\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 * For example:\n * setGroupPropertiesForFlags({'organization': { name: 'CYZ', employees: '11' } })\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 resetGroupPropertiesForFlags(group_type?: string): void {\n this.featureFlags.resetGroupPropertiesForFlags(group_type)\n }\n\n /**\n * Clears super properties and generates a new random distinct_id for this instance.\n * Useful for clearing data when a user logs out.\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.persistence?.set_property(USER_STATE, 'anonymous')\n this.sessionManager?.resetSessionId()\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 /**\n * Returns the current distinct id of the user. This is either the id automatically\n * generated by the library or the id that has been passed by a call to identify().\n *\n * ### Notes:\n *\n * get_distinct_id() can only be called after the PostHog library has finished loading.\n * init() has a loaded function available to handle this automatically. For example:\n *\n * // set distinct_id after the posthog library has loaded\n * posthog.init('YOUR PROJECT TOKEN', {\n * loaded: function(posthog) {\n * distinct_id = posthog.get_distinct_id();\n * }\n * });\n */\n get_distinct_id(): string {\n return this.get_property('distinct_id')\n }\n\n getGroups(): Record<string, any> {\n return this.get_property('$groups') || {}\n }\n\n /**\n * Returns the current session_id.\n *\n * NOTE: 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\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 * @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 * Create an alias, which PostHog will use to link two distinct_ids going forward (not retroactively).\n * Multiple aliases can map to the same original ID, but not vice-versa. Aliases can also be chained - the\n * following is a valid scenario:\n *\n * posthog.alias('new_id', 'existing_id');\n * ...\n * posthog.alias('newer_id', 'new_id');\n *\n * If the original ID is not passed in, we will use the current distinct_id - probably the auto-generated GUID.\n *\n * ### Notes:\n *\n * The best practice is to call alias() when a unique ID is first created for a user\n * (e.g., when a user first registers for an account and provides an email address).\n * alias() should never be called more than once for a given user, except to\n * chain a newer ID to a previously new ID, as described above.\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 * Update the configuration of a posthog library instance.\n *\n * The default config is:\n *\n * {\n * // PostHog API host\n * api_host: 'https://us.i.posthog.com',\n * *\n * // PostHog web app host, currently only used by the Sentry integration.\n * // This will only be different from api_host when using a reverse-proxied API host – in that case\n * // the original web app host needs to be passed here so that links to the web app are still convenient.\n * ui_host: 'https://us.posthog.com',\n *\n * // Automatically capture clicks, form submissions and change events\n * autocapture: true\n *\n * // Capture rage clicks\n * rageclick: true\n *\n * // transport for sending requests ('XHR' or 'sendBeacon')\n * // NB: sendBeacon should only be used for scenarios such as\n * // page unload where a \"best-effort\" attempt to send is\n * // acceptable; the sendBeacon API does not support callbacks\n * // or any way to know the result of the request. PostHog\n * // capturing via sendBeacon will not support any event-\n * // batching or retry mechanisms.\n * api_transport: 'XHR'\n *\n * // super properties cookie expiration (in days)\n * cookie_expiration: 365\n *\n * // super properties span subdomains\n * cross_subdomain_cookie: true\n *\n * // debug mode\n * debug: false\n *\n * // if this is true, the posthog cookie or localStorage entry\n * // will be deleted, and no user persistence will take place\n * disable_persistence: false\n *\n * // if this is true, PostHog will automatically determine\n * // City, Region and Country data using the IP address of\n * //the client\n * ip: true\n *\n * // opt users out of capturing by this PostHog instance by default\n * opt_out_capturing_by_default: false\n *\n * // opt users out of browser data storage by this PostHog instance by default\n * opt_out_persistence_by_default: false\n *\n * // opt out of user agent filtering such as googlebot or other bots\n * opt_out_useragent_filter: false\n *\n * // persistence mechanism used by opt-in/opt-out methods - cookie\n * // or localStorage - falls back to cookie if localStorage is unavailable\n * opt_out_capturing_persistence_type: 'localStorage'\n *\n * // customize the name of cookie/localStorage set by opt-in/opt-out methods\n * opt_out_capturing_cookie_prefix: null\n *\n * // type of persistent store for super properties (cookie/\n * // localStorage) if set to 'localStorage', any existing\n * // posthog cookie value with the same persistence_name\n * // will be transferred to localStorage and deleted\n * persistence: 'cookie'\n *\n * // name for super properties persistent store\n * persistence_name: ''\n *\n * // deprecated, use property_denylist instead.\n * // names of properties/superproperties which should never\n * // be sent with capture() calls.\n * property_blacklist: []\n *\n * // names of properties/superproperties which should never\n * // be sent with capture() calls.\n * property_denylist: []\n *\n * // if this is true, posthog cookies will be marked as\n * // secure, meaning they will only be transmitted over https\n * secure_cookie: false\n *\n * // should we capture a page view on page load\n * capture_pageview: true\n *\n * // if you set upgrade to be true, the library will check for\n * // a cookie from our old js library and import super\n * // properties from it, then the old cookie is deleted\n * // The upgrade config option only works in the initialization,\n * // so make sure you set it when you create the library.\n * upgrade: false\n *\n * // if this is true, session recording is always disabled.\n * disable_session_recording: false,\n *\n * // extra HTTP request headers to set for each API request, in\n * // the format {'Header-Name': value}\n * response_headers: {}\n *\n * // protocol for fetching in-app message resources, e.g.\n * // 'https://' or 'http://'; defaults to '//' (which defers to the\n * // current page's protocol)\n * inapp_protocol: '//'\n *\n * // whether to open in-app message link in new tab/window\n * inapp_link_new_window: false\n *\n * // a set of rrweb config options that PostHog users can configure\n * // see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n * session_recording: {\n * blockClass: 'ph-no-capture',\n * blockSelector: null,\n * ignoreClass: 'ph-ignore-input',\n * maskAllInputs: true,\n * maskInputOptions: {password: true},\n * maskInputFn: null,\n * slimDOMOptions: {},\n * collectFonts: false,\n * inlineStylesheet: true,\n * }\n *\n * // prevent autocapture from capturing any attribute names on elements\n * mask_all_element_attributes: false\n *\n * // prevent autocapture from capturing textContent on all elements\n * mask_all_text: false\n *\n * // Anonymous users get a random UUID as their device by default.\n * // This option allows overriding that option.\n * get_device_id: (uuid) => uuid\n * }\n *\n *\n * @param {Object} config A dictionary of new configuration values to update\n */\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 this.persistence?.update_config(this.config, oldConfig)\n this.sessionPersistence =\n this.config.persistence === 'sessionStorage'\n ? this.persistence\n : new PostHogPersistence({ ...this.config, persistence: 'sessionStorage' })\n\n if (localStore.is_supported() && localStore.get('ph_debug') === 'true') {\n this.config.debug = true\n }\n if (this.config.debug) {\n Config.DEBUG = true\n logger.info('set_config', {\n config,\n oldConfig,\n newConfig: { ...this.config },\n })\n }\n\n this.sessionRecording?.startIfEnabledOrStop()\n this.autocapture?.startIfEnabled()\n this.heatmaps?.startIfEnabled()\n this.surveys.loadIfEnabled()\n this._sync_opt_out_with_persistence()\n }\n }\n\n /**\n * turns session recording on, and updates the config option `disable_session_recording` to false\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 - 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(override?: { sampling?: boolean; linked_flag?: boolean } | true): void {\n const overrideAll = isBoolean(override) && override\n if (overrideAll || override?.sampling) {\n // allow the session id check to rotate session id if necessary\n const ids = this.sessionManager?.checkAndGetSessionAndWindowId()\n this.persistence?.register({\n // short-circuits the `makeSamplingDecision` function in the session recording module\n [SESSION_RECORDING_IS_SAMPLED]: true,\n })\n logger.info('Session recording started with sampling override for session: ', ids?.sessionId)\n }\n if (overrideAll || override?.linked_flag) {\n this.sessionRecording?.overrideLinkedFlag()\n logger.info('Session recording started with linked_flags override')\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 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 sessionRecordingStarted(): boolean {\n return !!this.sessionRecording?.started\n }\n\n /** Capture a caught exception manually */\n captureException(error: Error, additionalProperties?: Properties): void {\n const properties: Properties = isFunction(assignableWindow.__PosthogExtensions__?.parseErrorAsProperties)\n ? assignableWindow.__PosthogExtensions__.parseErrorAsProperties([\n error.message,\n undefined,\n undefined,\n undefined,\n error,\n ])\n : {\n $exception_type: error.name,\n $exception_message: error.message,\n $exception_level: 'error',\n ...additionalProperties,\n }\n\n this.exceptions.sendExceptionEvent(properties)\n }\n\n /**\n * returns a boolean indicating whether the toolbar loaded\n * @param toolbarParams\n */\n\n loadToolbar(params: ToolbarParams): boolean {\n return this.toolbar.loadToolbar(params)\n }\n\n /**\n * Returns the value of the super property named property_name. If no such\n * property is set, get_property() will return the undefined value.\n *\n * ### Notes:\n *\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. For example:\n *\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 * @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 * ### Notes:\n *\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. For example:\n *\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 * @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 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' && this.config.capture_pageview)\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'.\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 /**\n * Enable or disable persistence based on options\n * only enable/disable if persistence is not already in this state\n * @param {boolean} [disabled] If true, will re-enable sdk persistence\n */\n private _sync_opt_out_with_persistence(): void {\n const isOptedOut = this.consent.isOptedOut()\n const defaultPersistenceDisabled = this.config.opt_out_persistence_by_default\n\n // TRICKY: We want a deterministic state for persistence so that a new pageload has the same persistence\n const persistenceDisabled = this.config.disable_persistence || (isOptedOut && !!defaultPersistenceDisabled)\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 }\n\n /**\n * Opt the user in to data capturing and cookies/localstorage for this PostHog instance\n * If the config.opt_out_persistence_by_default is set to false, the SDK persistence will be enabled.\n *\n * ### Usage\n *\n * // opt user in\n * posthog.opt_in_capturing();\n *\n * // opt user in with specific event name, properties, cookie configuration\n * posthog.opt_in_capturing({\n * capture_event_name: 'User opted in',\n * capture_event_properties: {\n * 'email': 'jdoe@example.com'\n * }\n * });\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?: string | 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 this.consent.optInOut(true)\n this._sync_opt_out_with_persistence()\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 * Opt the user out of data capturing and cookies/localstorage for this PostHog instance.\n * If the config.opt_out_persistence_by_default is set to true, the SDK persistence will be disabled.\n *\n * ### Usage\n *\n * // opt user out\n * posthog.opt_out_capturing()\n */\n opt_out_capturing(): void {\n this.consent.optInOut(false)\n this._sync_opt_out_with_persistence()\n }\n\n /**\n * Check whether the user has opted in to data capturing and cookies/localstorage for this PostHog instance\n *\n * ### Usage\n *\n * const has_opted_in = posthog.has_opted_in_capturing();\n * // use has_opted_in value\n *\n * @returns {boolean} current opt-in status\n */\n has_opted_in_capturing(): boolean {\n return this.consent.isOptedIn()\n }\n\n /**\n * Check whether the user has opted out of data capturing and cookies/localstorage for this PostHog instance\n *\n * ### Usage\n *\n * const has_opted_out = posthog.has_opted_out_capturing();\n * // use has_opted_out value\n *\n * @returns {boolean} current opt-out status\n */\n has_opted_out_capturing(): boolean {\n return this.consent.isOptedOut()\n }\n\n /**\n * Clear the user's opt in/out status of data capturing and cookies/localstorage for this PostHog instance\n *\n * ### Usage\n *\n * // clear user's opt-in/out status\n * posthog.clear_opt_in_out_capturing();\n * *\n * @param {Object} [config] A dictionary of config options to override\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 && !this._initialPageviewCaptured) {\n this._initialPageviewCaptured = true\n this.capture('$pageview', { title: document.title }, { send_instantly: true })\n }\n }\n\n debug(debug?: boolean): void {\n if (debug === false) {\n window?.console.log(\"You've disabled debug mode.\")\n localStorage && localStorage.removeItem('ph_debug')\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 localStorage && localStorage.setItem('ph_debug', 'true')\n this.set_config({ debug: true })\n }\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 document.addEventListener('DOMContentLoaded', dom_loaded_handler, false)\n }\n }\n\n // fallback handler, always will work\n if (window) {\n registerEvent(window, 'load', dom_loaded_handler, true)\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,MAAM,MAAM,UAAU,CAAA;AAC7B,OAAO,EACH,uBAAuB,EACvB,IAAI,EACJ,SAAS,EACT,MAAM,EACN,QAAQ,EACR,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,sBAAsB,GACzB,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACpG,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EACH,YAAY,EACZ,kBAAkB,EAClB,sBAAsB,EACtB,4BAA4B,EAC5B,UAAU,EACV,wBAAwB,GAC3B,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAA;AACvE,OAAO,EAAE,MAAM,EAA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;;;;;;;;;;;;;;;;;;;;WA4BG;QAEH,0CAA0C;QAE1C,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,UAAU,IAAmE;YACpG,IAAI,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;gBACxB,IAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;gBAE5D,IAAM,eAAe,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,cAAc,CAAA;gBAEjE,IAAI,QAAQ,EAAE,CAAC;oBACX,kEAAkE;oBAClE,qEAAqE;oBACrE,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC,CAAA;oBACrE,QAAQ,CAAC,cAAc,CAAC,eAAe,CAAC,CAAA;gBAC5C,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAA;IACN,CAAC;IAED,gBAAgB,CAAC,SAAS,CAAC,GAAG,WAAW,CAAA;IAEzC,sBAAsB,EAAE,CAAA;AAC5B,CAAC;AAED,MAAM,UAAU,cAAc;IAC1B,IAAM,WAAW,GAAG,CAAC,SAAS,CAAC,qBAAqB,CAAC,GAAG,IAAI,OAAO,EAAE,CAAC,CAAA;IAEtE,sBAAsB,EAAE,CAAA;IAExB,OAAO,WAAW,CAAA;AACtB,CAAC","sourcesContent":["import Config from './config'\nimport {\n _copyAndTruncateStrings,\n each,\n eachArray,\n extend,\n includes,\n registerEvent,\n safewrapClass,\n isCrossDomainCookie,\n isDistinctIdStringLike,\n} from './utils'\nimport { assignableWindow, document, location, navigator, userAgent, window } from './utils/globals'\nimport { PostHogFeatureFlags } from './posthog-featureflags'\nimport { PostHogPersistence } from './posthog-persistence'\nimport {\n ALIAS_ID_KEY,\n FLAG_CALL_REPORTED,\n PEOPLE_DISTINCT_ID_KEY,\n SESSION_RECORDING_IS_SAMPLED,\n USER_STATE,\n ENABLE_PERSON_PROCESSING,\n} from './constants'\nimport { SessionRecording } from './extensions/replay/sessionrecording'\nimport { Decide } from './decide'\nimport { Toolbar } from './extensions/toolbar'\nimport { localStore } from './storage'\nimport { RequestQueue } from './request-queue'\nimport { RetryQueue } from './retry-queue'\nimport { SessionIdManager } from './sessionid'\nimport { RequestRouter, RequestRouterRegion } from './utils/request-router'\nimport {\n CaptureOptions,\n CaptureResult,\n Compression,\n DecideResponse,\n EarlyAccessFeatureCallback,\n IsFeatureEnabledOptions,\n JsonType,\n PostHogConfig,\n Properties,\n Property,\n QueuedRequestOptions,\n RequestCallback,\n SessionIdChangedCallback,\n SnippetArrayItem,\n ToolbarParams,\n} from './types'\nimport { SentryIntegration, SentryIntegrationOptions, sentryIntegration } from './extensions/sentry-integration'\nimport { setupSegmentIntegration } from './extensions/segment-integration'\nimport { PageViewManager } from './page-view'\nimport { PostHogSurveys } from './posthog-surveys'\nimport { RateLimiter } from './rate-limiter'\nimport { uuidv7 } from './uuidv7'\nimport { Survey, SurveyCallback, SurveyQuestionBranchingType } from './posthog-surveys-types'\nimport {\n isArray,\n isBoolean,\n isEmptyObject,\n isEmptyString,\n isFunction,\n isNumber,\n isObject,\n isString,\n isUndefined,\n} from './utils/type-utils'\nimport { Info } from './utils/event-utils'\nimport { logger } from './utils/logger'\nimport { SessionPropsManager } from './session-props'\nimport { isLikelyBot } from './utils/blocked-uas'\nimport { extendURLParams, request, SUPPORTS_REQUEST } from './request'\nimport { Heatmaps } from './heatmaps'\nimport { ScrollManager } from './scroll-manager'\nimport { SimpleEventEmitter } from './utils/simple-event-emitter'\nimport { Autocapture } from './autocapture'\nimport { TracingHeaders } from './extensions/tracing-headers'\nimport { ConsentManager } from './consent'\nimport { ExceptionObserver } from './extensions/exception-autocapture'\nimport { WebVitalsAutocapture } from './extensions/web-vitals'\nimport { WebExperiments } from './web-experiments'\nimport { PostHogExceptions } from './posthog-exceptions'\n\n/*\nSIMPLE STYLE GUIDE:\n\nthis.x === public function\nthis._x === internal - only use within this file\nthis.__x === private - only use within the class\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\nexport const defaultConfig = (): PostHogConfig => ({\n api_host: 'https://us.i.posthog.com',\n ui_host: null,\n token: '',\n autocapture: true,\n rageclick: 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 store_google: true,\n custom_campaign_params: [],\n custom_blocked_useragents: [],\n save_referrer: true,\n capture_pageview: true,\n capture_pageleave: 'if_capture_pageview', // We'll only capture pageleave events if capture_pageview is also true\n debug: (location && isString(location?.search) && location.search.indexOf('__posthog_debug=true') !== -1) || false,\n verbose: 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 enable_recording_console_log: undefined, // When undefined, it falls back to the server-side setting\n secure_cookie: window?.location?.protocol === 'https:',\n ip: true,\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 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 inapp_protocol: '//',\n inapp_link_new_window: false,\n request_batching: true,\n properties_string_max_length: 65535,\n session_recording: {},\n mask_all_element_attributes: false,\n mask_all_text: false,\n advanced_disable_decide: false,\n advanced_disable_feature_flags: false,\n advanced_disable_feature_flags_on_first_load: false,\n advanced_disable_toolbar_metrics: false,\n feature_flag_request_timeout_ms: 3000,\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 // Used for internal testing\n _onCapture: __NOOP,\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: 'always',\n __add_tracing_headers: false,\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 // 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 * PostHog Library Object\n * @constructor\n */\nexport class PostHog {\n __loaded: boolean\n config: PostHogConfig\n\n rateLimiter: RateLimiter\n scrollManager: ScrollManager\n pageViewManager: PageViewManager\n featureFlags: PostHogFeatureFlags\n surveys: PostHogSurveys\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 autocapture?: Autocapture\n heatmaps?: Heatmaps\n webVitalsAutocapture?: WebVitalsAutocapture\n exceptionObserver?: ExceptionObserver\n\n _requestQueue?: RequestQueue\n _retryQueue?: RetryQueue\n sessionRecording?: SessionRecording\n webPerformance = new DeprecatedWebPerformanceObserver()\n\n _initialPageviewCaptured: boolean\n _triggered_notifs: any\n compression?: Compression\n __request_queue: QueuedRequestOptions[]\n decideEndpointWasHit: boolean\n analyticsDefaultEndpoint: string\n version = Config.LIB_VERSION\n\n SentryIntegration: typeof SentryIntegration\n sentryIntegration: (options?: SentryIntegrationOptions) => ReturnType<typeof sentryIntegration>\n\n private _internalEventEmitter = new SimpleEventEmitter()\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.decideEndpointWasHit = false\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\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.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\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))\n }\n\n // Initialization methods\n\n /**\n * This function initializes a new instance of the PostHog capturing object.\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. To define a\n * second instance on the page, you would call:\n *\n * posthog.init('new token', { your: 'config' }, 'library_name');\n *\n * and use it like so:\n *\n * posthog.library_name.capture(...);\n *\n * @param {String} token Your PostHog API token\n * @param {Object} [config] A dictionary of config options to override. <a href=\"https://github.com/posthog/posthog-js/blob/6e0e873/src/posthog-core.js#L57-L91\">See a list of default config options</a>.\n * @param {String} [name] The name for the new posthog instance that you want created\n */\n init(\n token: string,\n config?: OnlyValidKeys<Partial<PostHogConfig>, Partial<PostHogConfig>>,\n name?: string\n ): PostHog | undefined {\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 // Add as a property to the primary instance (this isn't type-safe but its 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 logger.warn('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 this._triggered_notifs = []\n\n this.set_config(\n extend({}, defaultConfig(), configRenames(config), {\n name: name,\n token: token,\n })\n )\n\n if (this.config.on_xhr_error) {\n logger.error('[posthog] on_xhr_error is deprecated. Use on_request_error instead')\n }\n\n this.compression = config.disable_compression ? undefined : Compression.GZipJS\n\n this.persistence = new PostHogPersistence(this.config)\n this.sessionPersistence =\n this.config.persistence === 'sessionStorage'\n ? this.persistence\n : new PostHogPersistence({ ...this.config, persistence: 'sessionStorage' })\n const initialPersistenceProps = { ...this.persistence.props }\n const initialSessionProps = { ...this.sessionPersistence.props }\n\n this._requestQueue = new RequestQueue((req) => this._send_retriable_request(req))\n this._retryQueue = new RetryQueue(this)\n this.__request_queue = []\n\n this.sessionManager = new SessionIdManager(this.config, this.persistence)\n this.sessionPropsManager = new SessionPropsManager(this.sessionManager, this.persistence)\n\n new TracingHeaders(this).startIfEnabledOrStop()\n\n this.sessionRecording = new SessionRecording(this)\n this.sessionRecording.startIfEnabledOrStop()\n\n if (!this.config.disable_scroll_properties) {\n this.scrollManager.startMeasuringScrollPosition()\n }\n\n this.autocapture = new Autocapture(this)\n this.autocapture.startIfEnabled()\n this.surveys.loadIfEnabled()\n\n this.heatmaps = new Heatmaps(this)\n this.heatmaps.startIfEnabled()\n\n this.webVitalsAutocapture = new WebVitalsAutocapture(this)\n\n this.exceptionObserver = new ExceptionObserver(this)\n this.exceptionObserver.startIfEnabled()\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 this._sync_opt_out_with_persistence()\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(\n (res: Record<string, string | boolean>, key) => (\n (res[key] = config.bootstrap?.featureFlags?.[key] || false), res\n ),\n {}\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 (!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 persitence\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 window?.addEventListener?.('onpagehide' in self ? 'pagehide' : 'unload', this._handle_unload.bind(this))\n\n this.toolbar.maybeLoadToolbar()\n\n // We wan't 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)) {\n this.on('eventCaptured', (data) => this.config._onCapture(data.event, data))\n }\n\n return this\n }\n\n // Private methods\n _afterDecideResponse(response: DecideResponse) {\n this.compression = undefined\n if (response.supportedCompression && !this.config.disable_compression) {\n this.compression = includes(response['supportedCompression'], Compression.GZipJS)\n ? Compression.GZipJS\n : includes(response['supportedCompression'], Compression.Base64)\n ? Compression.Base64\n : undefined\n }\n\n if (response.analytics?.endpoint) {\n this.analyticsDefaultEndpoint = response.analytics.endpoint\n }\n\n this.sessionRecording?.afterDecideResponse(response)\n this.autocapture?.afterDecideResponse(response)\n this.heatmaps?.afterDecideResponse(response)\n this.experiments?.afterDecideResponse(response)\n this.surveys?.afterDecideResponse(response)\n this.webVitalsAutocapture?.afterDecideResponse(response)\n this.exceptions?.afterDecideResponse(response)\n this.exceptionObserver?.afterDecideResponse(response)\n }\n\n _loaded(): void {\n // Pause `reloadFeatureFlags` calls in config.loaded callback.\n // These feature flags are loaded in the decide call made right\n // afterwards\n const disableDecide = this.config.advanced_disable_decide\n if (!disableDecide) {\n this.featureFlags.setReloadingPaused(true)\n }\n\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()) {\n this._captureInitialPageview()\n }\n }, 1)\n }\n\n // Call decide to get what features are enabled and other settings.\n // As a reminder, if the /decide endpoint is disabled, feature flags, toolbar, session recording, autocapture,\n // and compression will not be available.\n if (!disableDecide) {\n new Decide(this).call()\n\n // TRICKY: Reset any decide reloads queued during config.loaded because they'll be\n // covered by the decide call right above.\n this.featureFlags.resetRequestQueue()\n }\n }\n\n _start_queue_if_opted_in(): void {\n if (!this.has_opted_out_capturing()) {\n if (this.config.request_batching) {\n this._requestQueue?.enable()\n }\n }\n }\n\n _dom_loaded(): void {\n if (!this.has_opted_out_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 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: QueuedRequestOptions): 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 }\n options.compression = options.compression === 'best-available' ? this.compression : options.compression\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: QueuedRequestOptions): 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 * ### Usage:\n * posthog.push(['register', { a: 'b' }]);\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 * Capture an event. This is the most important and\n * frequently used PostHog function.\n *\n * ### Usage:\n *\n * // capture an event named 'Registered'\n * posthog.capture('Registered', {'Gender': 'Male', 'Age': 21});\n *\n * // capture an event using navigator.sendBeacon\n * posthog.capture('Left page', {'duration_seconds': 35}, {transport: 'sendBeacon'});\n *\n * @param {String} event_name The name of the event. This can be anything the user does - 'Button Click', 'Sign Up', 'Item Purchased', etc.\n * @param {Object} [properties] A set of properties to include with the event you're sending. These describe the user who did the event or details about the event itself.\n * @param {Object} [config] Optional configuration for this capture request.\n * @param {String} [config.transport] Transport method for network request ('XHR' or 'sendBeacon').\n * @param {Date} [config.timestamp] Timestamp is a Date object. If not set, it'll automatically be set to the current time.\n */\n capture(event_name: string, properties?: Properties | null, options?: CaptureOptions): 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.consent.isOptedOut()) {\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 if (!this.config.opt_out_useragent_filter && this._is_bot()) {\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 // 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.store_google) {\n this.sessionPersistence.update_campaign_params()\n }\n if (this.config.save_referrer) {\n this.sessionPersistence.update_referrer_info()\n }\n if (this.config.store_google || 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 let data: CaptureResult = {\n uuid: uuidv7(),\n event: event_name,\n properties: this._calculate_event_properties(event_name, properties || {}, timestamp),\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 const setOnceProperties = this._calculate_set_once_properties(options?.$set_once)\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 // 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 this._internalEventEmitter.emit('eventCaptured', data)\n\n const requestOptions: QueuedRequestOptions = {\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 _calculate_event_properties(event_name: string, event_properties: Properties, timestamp?: Date): Properties {\n timestamp = timestamp || new Date()\n if (!this.persistence || !this.sessionPersistence) {\n return event_properties\n }\n\n // set defaults\n const startTimestamp = this.persistence.remove_event_timer(event_name)\n let properties = { ...event_properties }\n properties['token'] = this.config.token\n\n if (event_name === '$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 = Info.properties()\n\n if (this.sessionManager) {\n const { sessionId, windowId } = this.sessionManager.checkAndGetSessionAndWindowId()\n properties['$session_id'] = sessionId\n properties['$window_id'] = windowId\n }\n\n if (this.requestRouter.region === RequestRouterRegion.CUSTOM) {\n properties['$lib_custom_api_host'] = this.config.api_host\n }\n\n if (\n this.sessionPropsManager &&\n this.config.__preview_send_client_session_params &&\n (event_name === '$pageview' || event_name === '$pageleave' || event_name === '$autocapture')\n ) {\n const sessionProps = this.sessionPropsManager.getSessionProps()\n properties = extend(properties, sessionProps)\n }\n\n if (!this.config.disable_scroll_properties) {\n let performanceProperties: Record<string, any> = {}\n if (event_name === '$pageview') {\n performanceProperties = this.pageViewManager.doPageView(timestamp)\n } else if (event_name === '$pageleave') {\n performanceProperties = this.pageViewManager.doPageLeave(timestamp)\n }\n properties = extend(properties, performanceProperties)\n }\n\n if (event_name === '$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 properties = sanitize_properties(properties, event_name)\n }\n\n // add person processing flag as very last step, so it cannot be overridden. process_person=true is default\n properties['$process_person_profile'] = this._hasPersonProcessing()\n\n return properties\n }\n\n _calculate_set_once_properties(dataSetOnce?: Properties): Properties | undefined {\n if (!this.persistence || !this._hasPersonProcessing()) {\n return dataSetOnce\n }\n // if we're an identified person, send initial params with every event\n let setOnceProperties = extend({}, this.persistence.get_initial_props(), dataSetOnce || {})\n const sanitize_properties = this.config.sanitize_properties\n if (sanitize_properties) {\n setOnceProperties = sanitize_properties(setOnceProperties, '$set_once')\n }\n if (isEmptyObject(setOnceProperties)) {\n return undefined\n }\n return setOnceProperties\n }\n\n /**\n * Register a set of super properties, which are included with all\n * events. This will overwrite previous super property values, except\n * for session properties (see `register_for_session(properties)`).\n *\n * ### Usage:\n *\n * // register 'Gender' as a super property\n * posthog.register({'Gender': 'Female'});\n *\n * // register several super properties when a user signs up\n * posthog.register({\n * 'Email': 'jdoe@example.com',\n * 'Account Type': 'Free'\n * });\n *\n * // Display the properties\n * console.log(posthog.persistence.properties())\n *\n * @param {Object} properties An associative array of 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 * Register a set of super properties only once. These will not\n * overwrite previous super property values, unlike register().\n *\n * ### Usage:\n *\n * // register a super property for the first time only\n * posthog.register_once({\n * 'First Login Date': new Date().toISOString()\n * });\n *\n * // Display the properties\n * console.log(posthog.persistence.properties())\n *\n * ### Notes:\n *\n * If default_value is specified, current super properties\n * with that value will be overwritten.\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 * Register a set of super properties, which are included with all events, but only\n * for THIS SESSION. These will overwrite all other super property values.\n *\n * Unlike regular super properties, which last in LocalStorage for a long time,\n * session super properties get cleared after a session ends.\n *\n * ### Usage:\n *\n * // register on all events this session\n * posthog.register_for_session({'referer': customGetReferer()});\n *\n * // register several session super properties when a user signs up\n * posthog.register_for_session({\n * 'selectedPlan': 'pro',\n * 'completedSteps': 4,\n * });\n *\n * // Display the properties\n * console.log(posthog.sessionPersistence.properties())\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 * Delete a super property stored with the current user.\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 * Delete a session super property stored with the current user.\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 * Get feature flag value for user (supports multivariate flags).\n *\n * ### Usage:\n *\n * if(posthog.getFeatureFlag('beta-feature') === 'some-value') { // do something }\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 * ### Usage:\n *\n * if(posthog.getFeatureFlag('beta-feature') === 'some-value') {\n * const someValue = posthog.getFeatureFlagPayload('beta-feature')\n * // do something\n * }\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 * See if feature flag is enabled for user.\n *\n * ### Usage:\n *\n * if(posthog.isFeatureEnabled('beta-feature')) { // do something }\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?: IsFeatureEnabledOptions): boolean | undefined {\n return this.featureFlags.isFeatureEnabled(key, options)\n }\n\n reloadFeatureFlags(): void {\n this.featureFlags.reloadFeatureFlags()\n }\n\n /** Opt the user in or out of an early access feature. */\n updateEarlyAccessFeatureEnrollment(key: string, isEnrolled: boolean): void {\n this.featureFlags.updateEarlyAccessFeatureEnrollment(key, isEnrolled)\n }\n\n /** Get the list of early access features. To check enrollment status, use `isFeatureEnabled`. */\n getEarlyAccessFeatures(callback: EarlyAccessFeatureCallback, force_reload = false): void {\n return this.featureFlags.getEarlyAccessFeatures(callback, force_reload)\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 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 *\n * ### Usage:\n *\n * posthog.onFeatureFlags(function(featureFlags) { // do something })\n *\n * @param {Function} [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.\n * @returns {Function} A function that can be called to unsubscribe the listener. Used by useEffect when the component unmounts.\n */\n onFeatureFlags(callback: (flags: string[], variants: Record<string, string | boolean>) => void): () => void {\n return this.featureFlags.onFeatureFlags(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 * ### Usage:\n *\n * posthog.onSessionId(function(sessionId, windowId) { // do something })\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 /** Get list of all surveys. */\n getSurveys(callback: SurveyCallback, forceReload = false): void {\n this.surveys.getSurveys(callback, forceReload)\n }\n\n /** Get surveys that should be enabled for the current user. */\n getActiveMatchingSurveys(callback: SurveyCallback, forceReload = false): void {\n this.surveys.getActiveMatchingSurveys(callback, forceReload)\n }\n\n /** Render a survey on a specific element. */\n renderSurvey(surveyId: string, selector: string): void {\n this.surveys.renderSurvey(surveyId, selector)\n }\n\n /** Checks the feature flags associated with this Survey to see if the survey can be rendered. */\n canRenderSurvey(surveyId: string): void {\n this.surveys.canRenderSurvey(surveyId)\n }\n\n /** Get the next step of the survey: a question index or `end` */\n getNextSurveyStep(\n survey: Survey,\n currentQuestionIndex: number,\n response: string | string[] | number | null\n ): number | SurveyQuestionBranchingType.End {\n return this.surveys.getNextSurveyStep(survey, currentQuestionIndex, response)\n }\n\n /**\n * Identify a user with a unique ID instead of a PostHog\n * randomly generated distinct_id. If the method is never called,\n * then unique visitors will be identified by a UUID that is generated\n * the first time they visit the site.\n *\n * If user properties are passed, they are also sent to posthog.\n *\n * ### Usage:\n *\n * posthog.identify('[user unique id]')\n * posthog.identify('[user unique id]', { email: 'john@example.com' })\n * posthog.identify('[user unique id]', {}, { referral_code: '12345' })\n *\n * ### Notes:\n *\n * You can call this function to overwrite a previously set\n * unique ID for the current user.\n *\n * If the user has been identified ($user_state in persistence is set to 'identified'),\n * then capture of $identify is skipped to avoid merging users. For example,\n * if your system allows an admin user to impersonate another user.\n *\n * Then a single browser instance can have:\n *\n * `identify('a') -> capture(1) -> identify('b') -> capture(2)`\n *\n * and capture 1 and capture 2 will have the correct distinct_id.\n * but users a and b will NOT be merged in posthog.\n *\n * However, if reset is called then:\n *\n * `identify('a') -> capture(1) -> reset() -> capture(2) -> identify('b') -> capture(3)`\n *\n * users a and b are not merged.\n * Capture 1 is associated with user a.\n * A new distinct id is generated for capture 2.\n * which is merged with user b.\n * So, capture 2 and 3 are associated with user b.\n *\n * If you want to merge two identified users, you can call posthog.alias\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\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\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(userPropertiesToSet || {}, false)\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 // 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 go for a $set event\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 for the Person associated with the current distinct_id. If config.person_profiles is set to\n * identified_only, and a Person profile has not been created yet, this will create one.\n *\n *\n * @param {Object} [userPropertiesToSet] Optional: An associative array of properties to store about the user\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 // Update current user properties\n this.setPersonPropertiesForFlags(userPropertiesToSet || {})\n\n this.capture('$set', { $set: userPropertiesToSet || {}, $set_once: userPropertiesToSetOnce || {} })\n }\n\n /**\n * Sets group analytics information for subsequent events and reloads feature flags.\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 if (!this._requirePersonProcessing('posthog.group')) {\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 */\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 * Set override person properties for feature flags.\n * This is used when dealing with new persons / where you don't want to wait for ingestion\n * to update user properties.\n */\n setPersonPropertiesForFlags(properties: Properties, reloadFeatureFlags = true): void {\n if (!this._requirePersonProcessing('posthog.setPersonPropertiesForFlags')) {\n return\n }\n this.featureFlags.setPersonPropertiesForFlags(properties, reloadFeatureFlags)\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 * For example:\n * setGroupPropertiesForFlags({'organization': { name: 'CYZ', employees: '11' } })\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 resetGroupPropertiesForFlags(group_type?: string): void {\n this.featureFlags.resetGroupPropertiesForFlags(group_type)\n }\n\n /**\n * Clears super properties and generates a new random distinct_id for this instance.\n * Useful for clearing data when a user logs out.\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.persistence?.set_property(USER_STATE, 'anonymous')\n this.sessionManager?.resetSessionId()\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 /**\n * Returns the current distinct id of the user. This is either the id automatically\n * generated by the library or the id that has been passed by a call to identify().\n *\n * ### Notes:\n *\n * get_distinct_id() can only be called after the PostHog library has finished loading.\n * init() has a loaded function available to handle this automatically. For example:\n *\n * // set distinct_id after the posthog library has loaded\n * posthog.init('YOUR PROJECT TOKEN', {\n * loaded: function(posthog) {\n * distinct_id = posthog.get_distinct_id();\n * }\n * });\n */\n get_distinct_id(): string {\n return this.get_property('distinct_id')\n }\n\n getGroups(): Record<string, any> {\n return this.get_property('$groups') || {}\n }\n\n /**\n * Returns the current session_id.\n *\n * NOTE: 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\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 * @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 * Create an alias, which PostHog will use to link two distinct_ids going forward (not retroactively).\n * Multiple aliases can map to the same original ID, but not vice-versa. Aliases can also be chained - the\n * following is a valid scenario:\n *\n * posthog.alias('new_id', 'existing_id');\n * ...\n * posthog.alias('newer_id', 'new_id');\n *\n * If the original ID is not passed in, we will use the current distinct_id - probably the auto-generated GUID.\n *\n * ### Notes:\n *\n * The best practice is to call alias() when a unique ID is first created for a user\n * (e.g., when a user first registers for an account and provides an email address).\n * alias() should never be called more than once for a given user, except to\n * chain a newer ID to a previously new ID, as described above.\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 * Update the configuration of a posthog library instance.\n *\n * The default config is:\n *\n * {\n * // PostHog API host\n * api_host: 'https://us.i.posthog.com',\n * *\n * // PostHog web app host, currently only used by the Sentry integration.\n * // This will only be different from api_host when using a reverse-proxied API host – in that case\n * // the original web app host needs to be passed here so that links to the web app are still convenient.\n * ui_host: 'https://us.posthog.com',\n *\n * // Automatically capture clicks, form submissions and change events\n * autocapture: true\n *\n * // Capture rage clicks\n * rageclick: true\n *\n * // transport for sending requests ('XHR' or 'sendBeacon')\n * // NB: sendBeacon should only be used for scenarios such as\n * // page unload where a \"best-effort\" attempt to send is\n * // acceptable; the sendBeacon API does not support callbacks\n * // or any way to know the result of the request. PostHog\n * // capturing via sendBeacon will not support any event-\n * // batching or retry mechanisms.\n * api_transport: 'XHR'\n *\n * // super properties cookie expiration (in days)\n * cookie_expiration: 365\n *\n * // super properties span subdomains\n * cross_subdomain_cookie: true\n *\n * // debug mode\n * debug: false\n *\n * // if this is true, the posthog cookie or localStorage entry\n * // will be deleted, and no user persistence will take place\n * disable_persistence: false\n *\n * // if this is true, PostHog will automatically determine\n * // City, Region and Country data using the IP address of\n * //the client\n * ip: true\n *\n * // opt users out of capturing by this PostHog instance by default\n * opt_out_capturing_by_default: false\n *\n * // opt users out of browser data storage by this PostHog instance by default\n * opt_out_persistence_by_default: false\n *\n * // opt out of user agent filtering such as googlebot or other bots\n * opt_out_useragent_filter: false\n *\n * // persistence mechanism used by opt-in/opt-out methods - cookie\n * // or localStorage - falls back to cookie if localStorage is unavailable\n * opt_out_capturing_persistence_type: 'localStorage'\n *\n * // customize the name of cookie/localStorage set by opt-in/opt-out methods\n * opt_out_capturing_cookie_prefix: null\n *\n * // type of persistent store for super properties (cookie/\n * // localStorage) if set to 'localStorage', any existing\n * // posthog cookie value with the same persistence_name\n * // will be transferred to localStorage and deleted\n * persistence: 'cookie'\n *\n * // name for super properties persistent store\n * persistence_name: ''\n *\n * // deprecated, use property_denylist instead.\n * // names of properties/superproperties which should never\n * // be sent with capture() calls.\n * property_blacklist: []\n *\n * // names of properties/superproperties which should never\n * // be sent with capture() calls.\n * property_denylist: []\n *\n * // if this is true, posthog cookies will be marked as\n * // secure, meaning they will only be transmitted over https\n * secure_cookie: false\n *\n * // should we capture a page view on page load\n * capture_pageview: true\n *\n * // if you set upgrade to be true, the library will check for\n * // a cookie from our old js library and import super\n * // properties from it, then the old cookie is deleted\n * // The upgrade config option only works in the initialization,\n * // so make sure you set it when you create the library.\n * upgrade: false\n *\n * // if this is true, session recording is always disabled.\n * disable_session_recording: false,\n *\n * // extra HTTP request headers to set for each API request, in\n * // the format {'Header-Name': value}\n * response_headers: {}\n *\n * // protocol for fetching in-app message resources, e.g.\n * // 'https://' or 'http://'; defaults to '//' (which defers to the\n * // current page's protocol)\n * inapp_protocol: '//'\n *\n * // whether to open in-app message link in new tab/window\n * inapp_link_new_window: false\n *\n * // a set of rrweb config options that PostHog users can configure\n * // see https://github.com/rrweb-io/rrweb/blob/master/guide.md\n * session_recording: {\n * blockClass: 'ph-no-capture',\n * blockSelector: null,\n * ignoreClass: 'ph-ignore-input',\n * maskAllInputs: true,\n * maskInputOptions: {password: true},\n * maskInputFn: null,\n * slimDOMOptions: {},\n * collectFonts: false,\n * inlineStylesheet: true,\n * }\n *\n * // prevent autocapture from capturing any attribute names on elements\n * mask_all_element_attributes: false\n *\n * // prevent autocapture from capturing textContent on all elements\n * mask_all_text: false\n *\n * // Anonymous users get a random UUID as their device by default.\n * // This option allows overriding that option.\n * get_device_id: (uuid) => uuid\n * }\n *\n *\n * @param {Object} config A dictionary of new configuration values to update\n */\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 this.persistence?.update_config(this.config, oldConfig)\n this.sessionPersistence =\n this.config.persistence === 'sessionStorage'\n ? this.persistence\n : new PostHogPersistence({ ...this.config, persistence: 'sessionStorage' })\n\n if (localStore.is_supported() && localStore.get('ph_debug') === 'true') {\n this.config.debug = true\n }\n if (this.config.debug) {\n Config.DEBUG = true\n logger.info('set_config', {\n config,\n oldConfig,\n newConfig: { ...this.config },\n })\n }\n\n this.sessionRecording?.startIfEnabledOrStop()\n this.autocapture?.startIfEnabled()\n this.heatmaps?.startIfEnabled()\n this.surveys.loadIfEnabled()\n this._sync_opt_out_with_persistence()\n }\n }\n\n /**\n * turns session recording on, and updates the config option `disable_session_recording` to false\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 - 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(override?: { sampling?: boolean; linked_flag?: boolean } | true): void {\n const overrideAll = isBoolean(override) && override\n if (overrideAll || override?.sampling) {\n // allow the session id check to rotate session id if necessary\n const ids = this.sessionManager?.checkAndGetSessionAndWindowId()\n this.persistence?.register({\n // short-circuits the `makeSamplingDecision` function in the session recording module\n [SESSION_RECORDING_IS_SAMPLED]: true,\n })\n logger.info('Session recording started with sampling override for session: ', ids?.sessionId)\n }\n if (overrideAll || override?.linked_flag) {\n this.sessionRecording?.overrideLinkedFlag()\n logger.info('Session recording started with linked_flags override')\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 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 sessionRecordingStarted(): boolean {\n return !!this.sessionRecording?.started\n }\n\n /** Capture a caught exception manually */\n captureException(error: Error, additionalProperties?: Properties): void {\n const properties: Properties = isFunction(assignableWindow.__PosthogExtensions__?.parseErrorAsProperties)\n ? assignableWindow.__PosthogExtensions__.parseErrorAsProperties([\n error.message,\n undefined,\n undefined,\n undefined,\n error,\n ])\n : {\n $exception_type: error.name,\n $exception_message: error.message,\n $exception_level: 'error',\n ...additionalProperties,\n }\n\n this.exceptions.sendExceptionEvent(properties)\n }\n\n /**\n * returns a boolean indicating whether the toolbar loaded\n * @param toolbarParams\n */\n\n loadToolbar(params: ToolbarParams): boolean {\n return this.toolbar.loadToolbar(params)\n }\n\n /**\n * Returns the value of the super property named property_name. If no such\n * property is set, get_property() will return the undefined value.\n *\n * ### Notes:\n *\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. For example:\n *\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 * @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 * ### Notes:\n *\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. For example:\n *\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 * @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 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' && this.config.capture_pageview)\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'.\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 /**\n * Enable or disable persistence based on options\n * only enable/disable if persistence is not already in this state\n * @param {boolean} [disabled] If true, will re-enable sdk persistence\n */\n private _sync_opt_out_with_persistence(): void {\n const isOptedOut = this.consent.isOptedOut()\n const defaultPersistenceDisabled = this.config.opt_out_persistence_by_default\n\n // TRICKY: We want a deterministic state for persistence so that a new pageload has the same persistence\n const persistenceDisabled = this.config.disable_persistence || (isOptedOut && !!defaultPersistenceDisabled)\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 }\n\n /**\n * Opt the user in to data capturing and cookies/localstorage for this PostHog instance\n * If the config.opt_out_persistence_by_default is set to false, the SDK persistence will be enabled.\n *\n * ### Usage\n *\n * // opt user in\n * posthog.opt_in_capturing();\n *\n * // opt user in with specific event name, properties, cookie configuration\n * posthog.opt_in_capturing({\n * capture_event_name: 'User opted in',\n * capture_event_properties: {\n * 'email': 'jdoe@example.com'\n * }\n * });\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?: string | 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 this.consent.optInOut(true)\n this._sync_opt_out_with_persistence()\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 * Opt the user out of data capturing and cookies/localstorage for this PostHog instance.\n * If the config.opt_out_persistence_by_default is set to true, the SDK persistence will be disabled.\n *\n * ### Usage\n *\n * // opt user out\n * posthog.opt_out_capturing()\n */\n opt_out_capturing(): void {\n this.consent.optInOut(false)\n this._sync_opt_out_with_persistence()\n }\n\n /**\n * Check whether the user has opted in to data capturing and cookies/localstorage for this PostHog instance\n *\n * ### Usage\n *\n * const has_opted_in = posthog.has_opted_in_capturing();\n * // use has_opted_in value\n *\n * @returns {boolean} current opt-in status\n */\n has_opted_in_capturing(): boolean {\n return this.consent.isOptedIn()\n }\n\n /**\n * Check whether the user has opted out of data capturing and cookies/localstorage for this PostHog instance\n *\n * ### Usage\n *\n * const has_opted_out = posthog.has_opted_out_capturing();\n * // use has_opted_out value\n *\n * @returns {boolean} current opt-out status\n */\n has_opted_out_capturing(): boolean {\n return this.consent.isOptedOut()\n }\n\n /**\n * Clear the user's opt in/out status of data capturing and cookies/localstorage for this PostHog instance\n *\n * ### Usage\n *\n * // clear user's opt-in/out status\n * posthog.clear_opt_in_out_capturing();\n * *\n * @param {Object} [config] A dictionary of config options to override\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 && !this._initialPageviewCaptured) {\n this._initialPageviewCaptured = true\n this.capture('$pageview', { title: document.title }, { send_instantly: true })\n }\n }\n\n debug(debug?: boolean): void {\n if (debug === false) {\n window?.console.log(\"You've disabled debug mode.\")\n localStorage && localStorage.removeItem('ph_debug')\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 localStorage && localStorage.setItem('ph_debug', 'true')\n this.set_config({ debug: true })\n }\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 document.addEventListener('DOMContentLoaded', dom_loaded_handler, false)\n }\n }\n\n // fallback handler, always will work\n if (window) {\n registerEvent(window, 'load', dom_loaded_handler, true)\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"]}