posthog-js 1.78.2 → 1.78.3

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,KAAK,EACL,UAAU,EACV,OAAO,EACP,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,eAAe,EACf,eAAe,EACf,QAAQ,EACR,MAAM,EACN,SAAS,EACT,MAAM,GACT,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAClG,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAC/D,OAAO,EAAE,cAAc,EAAE,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xB,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,wCAAI,IAAI,UAAC,CAAA;SAC7C;IACL,CAAC,CAAC,CAAA;IAEF,qBAAqB,EAAE,CACtB;IAAC,cAAc,CAAC,MAAM,CAAS,EAAE,CAAA;IAElC,gEAAgE;IAChE,KAAK,CAAC,SAAS,EAAE,UAAU,QAAQ;QAC/B,QAAQ,CAAC,OAAO,EAAE,CAAA;IACtB,CAAC,CAAC,CAAA;IAEF,sBAAsB,EAAE,CAAA;AAC5B,CAAC;AAED,MAAM,UAAU,cAAc;IAC1B,SAAS,GAAG,QAAQ,CAAC,WAAW,CAC/B;IAAC,cAAsB,GAAG,IAAI,OAAO,EAAE,CAAA;IAExC,qBAAqB,EAAE,CACtB;IAAC,cAAc,CAAC,MAAM,CAAS,EAAE,CAAA;IAClC,sBAAsB,EAAE,CAAA;IAExB,OAAO,cAAqB,CAAA;AAChC,CAAC","sourcesContent":["import Config from './config'\nimport {\n _copyAndTruncateStrings,\n _each,\n _eachArray,\n _extend,\n _info,\n _isArray,\n _isBlockedUA,\n _isObject,\n _isUndefined,\n _register_event,\n _safewrap_class,\n document,\n logger,\n userAgent,\n window,\n} from './utils'\nimport { autocapture } from './autocapture'\nimport { PostHogFeatureFlags } from './posthog-featureflags'\nimport { PostHogPersistence } from './posthog-persistence'\nimport { ALIAS_ID_KEY, FLAG_CALL_REPORTED, PEOPLE_DISTINCT_ID_KEY } from './constants'\nimport { SessionRecording } from './extensions/sessionrecording'\nimport { WebPerformanceObserver } from './extensions/web-performance'\nimport { Decide } from './decide'\nimport { Toolbar } from './extensions/toolbar'\nimport { clearOptInOut, hasOptedIn, hasOptedOut, optIn, optOut, userOptedOut } from './gdpr-utils'\nimport { cookieStore, localStore } from './storage'\nimport { RequestQueue } from './request-queue'\nimport { compressData, decideCompression } from './compression'\nimport { addParamsToURL, encodePostData, xhr } from './send-request'\nimport { RetryQueue } from './retry-queue'\nimport { SessionIdManager } from './sessionid'\nimport {\n AutocaptureConfig,\n CaptureOptions,\n CaptureResult,\n Compression,\n EarlyAccessFeatureCallback,\n GDPROptions,\n isFeatureEnabledOptions,\n JSC,\n JsonType,\n OptInOutCapturingOptions,\n PostHogConfig,\n Properties,\n Property,\n RequestCallback,\n SessionIdChangedCallback,\n SnippetArrayItem,\n ToolbarParams,\n XHROptions,\n} from './types'\nimport { SentryIntegration } from './extensions/sentry-integration'\nimport { createSegmentIntegration } from './extensions/segment-integration'\nimport { PageViewManager } from './page-view'\nimport { ExceptionObserver } from './extensions/exceptions/exception-autocapture'\nimport { PostHogSurveys, SurveyCallback } from './posthog-surveys'\nimport { RateLimiter } from './rate-limiter'\nimport { uuidv7 } from './uuidv7'\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\nenum InitType {\n INIT_MODULE = 0,\n INIT_SNIPPET = 1,\n}\n\nlet init_type: InitType\n\n// TODO: the type of this is very loose. Sometimes it's also PostHogLib itself\nlet posthog_master: Record<string, PostHog> & {\n init: (token: string, config: Partial<PostHogConfig>, name: string) => void\n}\n\n// some globals for comparisons\nconst __NOOP = () => {}\nconst __NOOPTIONS = {}\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\nconst USE_XHR = window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()\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 = !USE_XHR && userAgent.indexOf('MSIE') === -1 && userAgent.indexOf('Mozilla') === -1\n\nconst defaultConfig = (): PostHogConfig => ({\n api_host: 'https://app.posthog.com',\n api_method: 'POST',\n api_transport: 'XHR',\n ui_host: null,\n token: '',\n autocapture: true,\n rageclick: true,\n cross_subdomain_cookie: document?.location?.hostname?.indexOf('herokuapp.com') === -1,\n persistence: 'cookie',\n persistence_name: '',\n cookie_name: '',\n loaded: __NOOP,\n store_google: true,\n custom_campaign_params: [],\n custom_blocked_useragents: [],\n save_referrer: true,\n test: false,\n verbose: false,\n capture_pageview: true,\n capture_pageleave: true, // We'll only capture pageleave events if capture_pageview is also true\n debug: false,\n cookie_expiration: 365,\n upgrade: false,\n disable_session_recording: false,\n disable_persistence: false,\n disable_cookie: 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_capturing_persistence_type: 'localStorage',\n opt_out_capturing_cookie_prefix: null,\n opt_in_site_apps: false,\n property_blacklist: [],\n respect_dnt: false,\n sanitize_properties: null,\n xhr_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 on_xhr_error: (req) => {\n const error = 'Bad HTTP status: ' + req.status + ' ' + req.statusText\n console.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 callback_fn: 'posthog._jsc',\n bootstrap: {},\n disable_compression: false,\n session_idle_timeout_seconds: 30 * 60, // 30 minutes\n})\n\n/**\n * create_phlib(token:string, config:object, name:string)\n *\n * This function is used by the init method of PostHogLib objects\n * as well as the main initializer at the end of the JSLib (that\n * initializes document.posthog as well as any additional instances\n * declared before this file has loaded).\n */\nconst create_phlib = function (\n token: string,\n config?: Partial<PostHogConfig>,\n name?: string,\n createComplete?: (instance: PostHog) => void\n): PostHog {\n let instance: PostHog\n const target =\n name === PRIMARY_INSTANCE_NAME || !posthog_master ? posthog_master : name ? posthog_master[name] : undefined\n const callbacksHandled = {\n initComplete: false,\n syncCode: false,\n }\n const handleCallback = (callbackName: keyof typeof callbacksHandled) => (instance: PostHog) => {\n if (!callbacksHandled[callbackName]) {\n callbacksHandled[callbackName] = true\n if (callbacksHandled.initComplete && callbacksHandled.syncCode) {\n createComplete?.(instance)\n }\n }\n }\n\n if (target && init_type === InitType.INIT_MODULE) {\n instance = target as any\n } else {\n if (target && !_isArray(target)) {\n console.error('You have already initialized ' + name)\n // TODO: throw something instead?\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return\n }\n instance = new PostHog()\n }\n\n instance._init(token, config, name, handleCallback('initComplete'))\n instance.toolbar.maybeLoadToolbar()\n\n instance.sessionRecording = new SessionRecording(instance)\n instance.sessionRecording.startRecordingIfEnabled()\n\n instance.webPerformance = new WebPerformanceObserver(instance)\n instance.webPerformance.startObservingIfEnabled()\n\n if (instance.get_config('__preview_measure_pageview_stats')) {\n instance.pageViewManager.startMeasuringScrollPosition()\n }\n\n instance.exceptionAutocapture = new ExceptionObserver(instance)\n\n instance.__autocapture = instance.get_config('autocapture')\n autocapture._setIsAutocaptureEnabled(instance)\n if (autocapture._isAutocaptureEnabled) {\n instance.__autocapture = instance.get_config('autocapture')\n const num_buckets = 100\n const num_enabled_buckets = 100\n if (!autocapture.enabledForProject(instance.get_config('token'), num_buckets, num_enabled_buckets)) {\n instance.__autocapture = false\n logger.log('Not in active bucket: disabling Automatic Event Collection.')\n } else if (!autocapture.isBrowserSupported()) {\n instance.__autocapture = false\n logger.log('Disabling Automatic Event Collection because this browser is not supported')\n } else {\n autocapture.init(instance)\n }\n }\n\n // if any instance on the page has debug = true, we set the\n // global debug to be true\n Config.DEBUG = Config.DEBUG || instance.get_config('debug')\n\n // if target is not defined, we called init after the lib already\n // loaded, so there won't be an array of things to execute\n if (typeof target !== 'undefined' && _isArray(target)) {\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, (target as any).people)\n instance._execute_array(target)\n }\n\n handleCallback('syncCode')(instance)\n return instance\n}\n\n/**\n * PostHog Library Object\n * @constructor\n */\nexport class PostHog {\n __loaded: boolean\n __loaded_recorder_version: 'v1' | 'v2' | undefined // flag that keeps track of which version of recorder is loaded\n config: PostHogConfig\n\n rateLimiter: RateLimiter\n pageViewManager: PageViewManager\n featureFlags: PostHogFeatureFlags\n surveys: PostHogSurveys\n toolbar: Toolbar\n\n // These are instance-specific state created after initialisation\n persistence?: PostHogPersistence\n sessionPersistence?: PostHogPersistence\n sessionManager?: SessionIdManager\n\n _requestQueue?: RequestQueue\n _retryQueue?: RetryQueue\n sessionRecording?: SessionRecording\n webPerformance?: WebPerformanceObserver\n exceptionAutocapture?: ExceptionObserver\n\n _triggered_notifs: any\n compression: Partial<Record<Compression, boolean>>\n _jsc: JSC\n __captureHooks: ((eventName: string) => void)[]\n __request_queue: [url: string, data: Record<string, any>, options: XHROptions, callback?: RequestCallback][]\n __autocapture: boolean | AutocaptureConfig | undefined\n decideEndpointWasHit: boolean\n\n SentryIntegration: typeof SentryIntegration\n segmentIntegration: () => any\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 this.compression = {}\n this.decideEndpointWasHit = false\n this.SentryIntegration = SentryIntegration\n this.segmentIntegration = () => createSegmentIntegration(this)\n this.__captureHooks = []\n this.__request_queue = []\n this.__loaded = false\n this.__loaded_recorder_version = undefined\n this.__autocapture = undefined\n this._jsc = function () {} as JSC\n\n this.featureFlags = new PostHogFeatureFlags(this)\n this.toolbar = new Toolbar(this)\n this.pageViewManager = new PageViewManager()\n this.surveys = new PostHogSurveys(this)\n this.rateLimiter = new RateLimiter()\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 = typeof prop === 'string' ? { [prop]: to } : prop\n this.setPersonProperties(setProps)\n callback?.({})\n },\n set_once: (prop: string | Properties, to?: string, callback?: RequestCallback) => {\n const setProps = typeof prop === 'string' ? { [prop]: to } : prop\n this.setPersonProperties(undefined, setProps)\n callback?.({})\n },\n }\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(token: string, config?: Partial<PostHogConfig>, name?: string): PostHog | void {\n if (_isUndefined(name)) {\n console.error('You must name your new library: init(token, config, name)')\n return\n }\n if (name === PRIMARY_INSTANCE_NAME) {\n console.error('You must initialize the main posthog object right after you include the PostHog js snippet')\n return\n }\n\n const instance: PostHog = create_phlib(token, config, name, (instance: PostHog) => {\n posthog_master[name] = instance\n instance._loaded()\n })\n posthog_master[name] = instance\n\n return instance\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(\n token: string,\n config: Partial<PostHogConfig> = {},\n name?: string,\n initComplete?: (instance: PostHog) => void\n ): void {\n this.__loaded = true\n this.config = {} as PostHogConfig // will be set right below\n this._triggered_notifs = []\n\n // To avoid using Promises and their helper functions, we instead keep\n // track of which callbacks have been called, and then call initComplete\n // when all of them have been called. To add additional async code, add\n // to `callbacksHandled` and pass updateInitComplete as a callback to\n // the async code.\n const callbacksHandled = { segmentRegister: false, syncCode: false }\n const updateInitComplete = (callbackName: keyof typeof callbacksHandled) => () => {\n // Update the register of callbacks that have been called, and if\n // they have all been called, then we are ready to call\n // initComplete.\n if (!callbacksHandled[callbackName]) {\n callbacksHandled[callbackName] = true\n if (callbacksHandled.segmentRegister && callbacksHandled.syncCode) {\n initComplete?.(this)\n }\n }\n }\n\n this.set_config(\n _extend({}, defaultConfig(), config, {\n name: name,\n token: token,\n callback_fn: (name === PRIMARY_INSTANCE_NAME ? name : PRIMARY_INSTANCE_NAME + '.' + name) + '._jsc',\n })\n )\n\n this._jsc = function () {} as JSC\n\n // Check if recorder.js is already loaded\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (window?.rrweb?.record || window?.rrwebRecord) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this.__loaded_recorder_version = window?.rrweb?.version\n }\n\n this.persistence = new PostHogPersistence(this.config)\n\n this._requestQueue = new RequestQueue(this._handle_queued_event.bind(this))\n this._retryQueue = new RetryQueue(this.get_config('on_xhr_error'), this.rateLimiter)\n this.__captureHooks = []\n this.__request_queue = []\n\n this.sessionManager = new SessionIdManager(this.config, this.persistence)\n this.sessionPersistence =\n this.config.persistence === 'sessionStorage'\n ? this.persistence\n : new PostHogPersistence({ ...this.config, persistence: 'sessionStorage' })\n\n this._gdpr_init()\n\n if (config.segment) {\n // Use segments anonymousId instead\n this.config.get_device_id = () => config.segment.user().anonymousId()\n\n // If a segment user ID exists, set it as the distinct_id\n if (config.segment.user().id()) {\n this.register({\n distinct_id: config.segment.user().id(),\n })\n this.persistence.set_user_state('identified')\n }\n\n config.segment.register(this.segmentIntegration()).then(updateInitComplete('segmentRegister'))\n } else {\n updateInitComplete('segmentRegister')()\n }\n\n if (config.bootstrap?.distinctID !== undefined) {\n const uuid = this.get_config('get_device_id')(uuidv7())\n const deviceID = config.bootstrap?.isIdentifiedID ? uuid : config.bootstrap.distinctID\n this.persistence.set_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.get_config('get_device_id')(uuidv7())\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_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 &&\n window.addEventListener('onpagehide' in self ? 'pagehide' : 'unload', this._handle_unload.bind(this))\n\n // Make sure that we also call the initComplete callback at the end of\n // the synchronous code as well.\n updateInitComplete('syncCode')()\n }\n\n // Private methods\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.get_config('advanced_disable_decide')\n if (!disableDecide) {\n this.featureFlags.setReloadingPaused(true)\n }\n\n try {\n this.get_config('loaded')(this)\n } catch (err) {\n console.error('`loaded` function failed', err)\n }\n\n this._start_queue_if_opted_in()\n\n // this happens after so a user can call identify in\n // the loaded callback\n if (this.get_config('capture_pageview')) {\n this.capture('$pageview', { title: document.title }, { send_instantly: true })\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 }\n\n _start_queue_if_opted_in(): void {\n if (!this.has_opted_out_capturing()) {\n if (this.get_config('request_batching')) {\n this._requestQueue?.poll()\n }\n }\n }\n\n _dom_loaded(): void {\n if (!this.has_opted_out_capturing()) {\n _eachArray(this.__request_queue, (item) => {\n this._send_request(...item)\n })\n }\n\n this.__request_queue = []\n\n this._start_queue_if_opted_in()\n }\n\n /**\n * _prepare_callback() should be called by callers of _send_request for use\n * as the callback argument.\n *\n * If there is no callback, this returns null.\n * If we are going to make XHR/XDR requests, this returns a function.\n * If we are going to use script tags, this returns a string to use as the\n * callback GET param.\n */\n // TODO: get rid of the \"| string\"\n _prepare_callback(callback?: RequestCallback, data?: Properties): RequestCallback | null | string {\n if (_isUndefined(callback)) {\n return null\n }\n\n if (USE_XHR) {\n return function (response) {\n callback(response, data)\n }\n } else {\n // if the user gives us a callback, we store as a random\n // property on this instances jsc function and update our\n // callback string to reflect that.\n const jsc = this._jsc\n const randomized_cb = '' + Math.floor(Math.random() * 100000000)\n const callback_string = this.get_config('callback_fn') + '[' + randomized_cb + ']'\n jsc[randomized_cb] = function (response: any) {\n delete jsc[randomized_cb]\n callback(response, data)\n }\n return callback_string\n }\n }\n\n _handle_unload(): void {\n if (!this.get_config('request_batching')) {\n if (this.get_config('capture_pageview') && this.get_config('capture_pageleave')) {\n this.capture('$pageleave', null, { transport: 'sendBeacon' })\n }\n return\n }\n\n if (this.get_config('capture_pageview') && this.get_config('capture_pageleave')) {\n this.capture('$pageleave')\n }\n\n this._requestQueue?.unload()\n this._retryQueue?.unload()\n }\n\n _handle_queued_event(url: string, data: Record<string, any>, options?: XHROptions): void {\n const jsonData = JSON.stringify(data)\n this.__compress_and_send_json_request(url, jsonData, options || __NOOPTIONS, __NOOP)\n }\n\n __compress_and_send_json_request(\n url: string,\n jsonData: string,\n options: XHROptions,\n callback?: RequestCallback\n ): void {\n const [data, _options] = compressData(decideCompression(this.compression), jsonData, options)\n this._send_request(url, data, _options, callback)\n }\n\n _send_request(url: string, data: Record<string, any>, options: CaptureOptions, callback?: RequestCallback): void {\n if (!this.__loaded || !this._retryQueue) {\n return\n }\n if (this.rateLimiter.isRateLimited(options._batchKey)) {\n if (this.get_config('debug')) {\n console.warn('[PostHog SendRequest] is quota limited. Dropping request.')\n }\n return\n }\n\n if (ENQUEUE_REQUESTS) {\n this.__request_queue.push([url, data, options, callback])\n return\n }\n\n const DEFAULT_OPTIONS = {\n method: this.get_config('api_method'),\n transport: this.get_config('api_transport'),\n verbose: this.get_config('verbose'),\n }\n\n options = _extend(DEFAULT_OPTIONS, options || {})\n if (!USE_XHR) {\n options.method = 'GET'\n }\n\n const useSendBeacon = 'sendBeacon' in window.navigator && options.transport === 'sendBeacon'\n url = addParamsToURL(url, options.urlQueryArgs || {}, {\n ip: this.get_config('ip'),\n })\n\n if (useSendBeacon) {\n // beacon documentation https://w3c.github.io/beacon/\n // beacons format the message and use the type property\n try {\n window.navigator.sendBeacon(url, encodePostData(data, { ...options, sendBeacon: true }))\n } catch (e) {\n // send beacon is a best-effort, fire-and-forget mechanism on page unload,\n // we don't want to throw errors here\n }\n } else if (USE_XHR) {\n try {\n xhr({\n url: url,\n data: data,\n headers: this.get_config('xhr_headers'),\n options: options,\n callback,\n retriesPerformedSoFar: 0,\n retryQueue: this._retryQueue,\n onXHRError: this.get_config('on_xhr_error'),\n onRateLimited: this.rateLimiter.on429Response,\n })\n } catch (e) {\n console.error(e)\n }\n } else {\n const script = document.createElement('script')\n script.type = 'text/javascript'\n script.async = true\n script.defer = true\n script.src = url\n const s = document.getElementsByTagName('script')[0]\n s.parentNode?.insertBefore(script, s)\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 (typeof item === 'function') {\n ;(item as any).call(this)\n } else if (_isArray(item) && fn_name === 'alias') {\n alias_calls.push(item)\n } else if (\n _isArray(item) &&\n fn_name.indexOf('capture') !== -1 &&\n typeof (this as any)[fn_name] === 'function'\n ) {\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 * PostHog supports exception autocapture, however, this function\n * is used to manually capture an exception\n * and can be used to add more context to that exception\n *\n * Properties passed as the second option will be merged with the properties\n * of the exception event.\n * Where there is a key in both generated exception and passed properties,\n * the generated exception property takes precedence.\n */\n captureException(exception: Error, properties?: Properties): void {\n this.exceptionAutocapture?.captureException(\n [exception.name, undefined, undefined, undefined, exception],\n properties\n )\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} [options] Optional configuration for this capture request.\n * @param {String} [options.transport] Transport method for network request ('XHR' or 'sendBeacon').\n * @param {Date} [options.timestamp] Timestamp is a Date object. If not set, it'll automatically be set to the current time.\n */\n capture(\n event_name: string,\n properties?: Properties | null,\n options: CaptureOptions = __NOOPTIONS\n ): CaptureResult | void {\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.sessionPersistence || !this._requestQueue) {\n return logger.unintializedWarning('posthog.capture')\n }\n\n if (userOptedOut(this, false)) {\n return\n }\n\n options = options || __NOOPTIONS\n const transport = options['transport'] // external API, don't minify 'transport' prop\n if (transport) {\n options.transport = transport // 'transport' prop name can be minified internally\n }\n\n // typing doesn't prevent interesting data\n if (_isUndefined(event_name) || typeof event_name !== 'string') {\n console.error('No event name provided to posthog.capture')\n return\n }\n\n if (_isBlockedUA(userAgent, this.get_config('custom_blocked_useragents'))) {\n return\n }\n\n // update persistence\n this.sessionPersistence.update_search_keyword()\n\n if (this.get_config('store_google')) {\n this.sessionPersistence.update_campaign_params()\n }\n if (this.get_config('save_referrer')) {\n this.sessionPersistence.update_referrer_info()\n }\n\n let data: CaptureResult = {\n uuid: uuidv7(),\n event: event_name,\n properties: this._calculate_event_properties(event_name, properties || {}),\n }\n\n if (event_name === '$identify') {\n data['$set'] = options['$set']\n data['$set_once'] = options['$set_once']\n }\n\n data = _copyAndTruncateStrings(\n data,\n options._noTruncate ? null : this.get_config('properties_string_max_length')\n )\n data.timestamp = options.timestamp || new Date()\n\n if (this.get_config('debug')) {\n logger.log('PostHog.js send', data)\n }\n const jsonData = JSON.stringify(data)\n\n const url = this.get_config('api_host') + (options.endpoint || '/e/')\n\n const has_unique_traits = options !== __NOOPTIONS\n\n if (\n this.get_config('request_batching') &&\n (!has_unique_traits || options._batchKey) &&\n !options.send_instantly\n ) {\n this._requestQueue.enqueue(url, data, options)\n } else {\n this.__compress_and_send_json_request(url, jsonData, options)\n }\n\n this._invokeCaptureHooks(event_name, data)\n\n return data\n }\n\n _addCaptureHook(callback: (eventName: string) => void): void {\n this.__captureHooks.push(callback)\n }\n\n _invokeCaptureHooks(eventName: string, eventData: CaptureResult): void {\n this.config._onCapture(eventName, eventData)\n _each(this.__captureHooks, (callback) => callback(eventName))\n }\n\n _calculate_event_properties(event_name: string, event_properties: Properties): Properties {\n if (!this.persistence || !this.sessionPersistence) {\n return event_properties\n }\n\n // set defaults\n const start_timestamp = this.persistence.remove_event_timer(event_name)\n let properties = { ...event_properties }\n properties['token'] = this.get_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 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.get_config('__preview_measure_pageview_stats')) {\n let performanceProperties: Record<string, any> = {}\n if (event_name === '$pageview') {\n performanceProperties = this.pageViewManager.doPageView()\n } else if (event_name === '$pageleave') {\n performanceProperties = this.pageViewManager.doPageLeave()\n }\n properties = _extend(properties, performanceProperties)\n }\n\n if (event_name === '$pageview') {\n properties['title'] = document.title\n }\n\n if (event_name === '$performance_event') {\n const persistenceProps = this.persistence.properties()\n // Early exit for $performance_event as we only need session and $current_url\n properties['distinct_id'] = persistenceProps.distinct_id\n properties['$current_url'] = infoProperties.$current_url\n return properties\n }\n\n // set $duration if time_event was previously called for this event\n if (typeof start_timestamp !== 'undefined') {\n const duration_in_ms = new Date().getTime() - start_timestamp\n properties['$duration'] = parseFloat((duration_in_ms / 1000).toFixed(3))\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 _info.properties(),\n this.persistence.properties(),\n this.sessionPersistence.properties(),\n properties\n )\n\n const property_blacklist = this.get_config('property_blacklist')\n if (_isArray(property_blacklist)) {\n _each(property_blacklist, function (blacklisted_prop) {\n delete properties[blacklisted_prop]\n })\n } else {\n console.error('Invalid value for property_blacklist config: ' + property_blacklist)\n }\n\n const sanitize_properties = this.get_config('sanitize_properties')\n if (sanitize_properties) {\n properties = sanitize_properties(properties, event_name)\n }\n\n return properties\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 * 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 /**\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.unintializedWarning('posthog.identify')\n }\n //if the new_distinct_id has not been set ignore the identify event\n if (!new_distinct_id) {\n console.error('Unique user id has not been set in 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_user_state() === 'anonymous'\n\n // send an $identify event any time the distinct_id is changing and the old ID is an anoymous 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_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.\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 // Update current user properties\n this.setPersonPropertiesForFlags(userPropertiesToSet || {})\n\n this.capture('$set', { $set: userPropertiesToSet || {}, $set_once: userPropertiesToSetOnce || {} })\n }\n\n /**\n * Alpha feature: don't use unless you know what you're doing!\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 console.error('posthog.group requires a group type and group key')\n return\n }\n\n const existingGroups = this.getGroups()\n\n // if group key changes, remove stored group properties\n if (existingGroups[groupType] !== groupKey) {\n this.resetGroupPropertiesForFlags(groupType)\n }\n\n this.register({ $groups: { ...existingGroups, [groupType]: groupKey } })\n\n if (groupPropertiesToSet) {\n this.capture('$groupidentify', {\n $group_type: groupType,\n $group_key: groupKey,\n $group_set: groupPropertiesToSet,\n })\n this.setGroupPropertiesForFlags({ [groupType]: groupPropertiesToSet })\n }\n\n // If groups change and no properties change, reload feature flags.\n // The property change reload case is handled in setGroupPropertiesForFlags.\n if (existingGroups[groupType] !== groupKey && !groupPropertiesToSet) {\n this.reloadFeatureFlags()\n }\n }\n\n /**\n * Resets only the group properties of the user currently logged in.\n */\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 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 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 if (!this.__loaded) {\n return logger.unintializedWarning('posthog.reset')\n }\n const device_id = this.get_property('$device_id')\n this.persistence?.clear()\n this.sessionPersistence?.clear()\n this.persistence?.set_user_state('anonymous')\n this.sessionManager?.resetSessionId()\n const uuid = this.get_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 host = this.config.ui_host || this.config.api_host\n const { sessionId, sessionStartTimestamp } = this.sessionManager.checkAndGetSessionAndWindowId(true)\n let url = host + '/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\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 console.error('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://app.posthog.com',\n *\n * // HTTP method for capturing requests\n * api_method: 'POST'\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://app.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 * // 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 * // names of properties/superproperties which should never\n * // be sent with capture() calls\n * property_blacklist: []\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 * xhr_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: {},\n * maskInputFn: null,\n * slimDOMOptions: {},\n * collectFonts: false\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, config)\n\n if (!this.get_config('persistence_name')) {\n this.config.persistence_name = this.config.cookie_name\n }\n if (!this.get_config('disable_persistence')) {\n this.config.disable_persistence = this.config.disable_cookie\n }\n\n this.persistence?.update_config(this.config)\n this.sessionPersistence?.update_config(this.config)\n\n if (localStore.is_supported() && localStore.get('ph_debug') === 'true') {\n this.config.debug = true\n }\n if (this.get_config('debug')) {\n Config.DEBUG = true\n }\n\n if (this.sessionRecording && typeof config.disable_session_recording !== 'undefined') {\n if (oldConfig.disable_session_recording !== config.disable_session_recording) {\n if (config.disable_session_recording) {\n this.sessionRecording.stopRecording()\n } else {\n this.sessionRecording.startRecordingIfEnabled()\n }\n }\n }\n }\n }\n\n /**\n * turns session recording on, and updates the config option\n * disable_session_recording to false\n */\n startSessionRecording(): void {\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 /**\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 current config object for the library.\n */\n get_config<K extends keyof PostHogConfig>(prop_name: K): PostHogConfig[K] {\n return this.config?.[prop_name]\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.get_config('name') ?? PRIMARY_INSTANCE_NAME\n if (name !== PRIMARY_INSTANCE_NAME) {\n name = PRIMARY_INSTANCE_NAME + '.' + name\n }\n return name\n }\n\n // perform some housekeeping around GDPR opt-in/out state\n _gdpr_init(): void {\n const is_localStorage_requested = this.get_config('opt_out_capturing_persistence_type') === 'localStorage'\n\n // try to convert opt-in/out cookies to localStorage if possible\n if (is_localStorage_requested && localStore.is_supported()) {\n if (!this.has_opted_in_capturing() && this.has_opted_in_capturing({ persistence_type: 'cookie' })) {\n this.opt_in_capturing({ enable_persistence: false })\n }\n if (!this.has_opted_out_capturing() && this.has_opted_out_capturing({ persistence_type: 'cookie' })) {\n this.opt_out_capturing({ clear_persistence: false })\n }\n this.clear_opt_in_out_capturing({\n persistence_type: 'cookie',\n enable_persistence: false,\n })\n }\n\n // check whether the user has already opted out - if so, clear & disable persistence\n if (this.has_opted_out_capturing()) {\n this._gdpr_update_persistence({ clear_persistence: true })\n\n // check whether we should opt out by default\n // note: we don't clear persistence here by default since opt-out default state is often\n // used as an initial state while GDPR information is being collected\n } else if (\n !this.has_opted_in_capturing() &&\n (this.get_config('opt_out_capturing_by_default') || cookieStore.get('ph_optout'))\n ) {\n cookieStore.remove('ph_optout')\n this.opt_out_capturing({\n clear_persistence: this.get_config('opt_out_persistence_by_default'),\n })\n }\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} [options.clear_persistence] If true, will delete all data stored by the sdk in persistence and disable it\n * @param {boolean} [options.enable_persistence] If true, will re-enable sdk persistence\n */\n _gdpr_update_persistence(options: Partial<OptInOutCapturingOptions>): void {\n let disabled\n if (options && options['clear_persistence']) {\n disabled = true\n } else if (options && options['enable_persistence']) {\n disabled = false\n } else {\n return\n }\n\n if (!this.get_config('disable_persistence') && this.persistence?.disabled !== disabled) {\n this.persistence?.set_disabled(disabled)\n }\n if (!this.get_config('disable_persistence') && this.sessionPersistence?.disabled !== disabled) {\n this.sessionPersistence?.set_disabled(disabled)\n }\n }\n\n // call a base gdpr function after constructing the appropriate token and options args\n _gdpr_call_func<R = any>(\n func: (token: string, options: GDPROptions) => R,\n options?: Partial<OptInOutCapturingOptions>\n ): R {\n options = _extend(\n {\n capture: this.capture.bind(this),\n persistence_type: this.get_config('opt_out_capturing_persistence_type'),\n cookie_prefix: this.get_config('opt_out_capturing_cookie_prefix'),\n cookie_expiration: this.get_config('cookie_expiration'),\n cross_subdomain_cookie: this.get_config('cross_subdomain_cookie'),\n secure_cookie: this.get_config('secure_cookie'),\n },\n options || {}\n )\n\n // check if localStorage can be used for recording opt out status, fall back to cookie if not\n if (!localStore.is_supported() && options['persistence_type'] === 'localStorage') {\n options['persistence_type'] = 'cookie'\n }\n\n return func(this.get_config('token'), {\n capture: options['capture'],\n captureEventName: options['capture_event_name'],\n captureProperties: options['capture_properties'],\n persistenceType: options['persistence_type'],\n persistencePrefix: options['cookie_prefix'],\n cookieExpiration: options['cookie_expiration'],\n crossSubdomainCookie: options['cross_subdomain_cookie'],\n secureCookie: options['secure_cookie'],\n })\n }\n\n /**\n * Opt the user in to data capturing and cookies/localstorage for this PostHog instance\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 * cookie_expiration: 30,\n * secure_cookie: true\n * });\n *\n * @param {Object} [options] A dictionary of config options to override\n * @param {function} [options.capture] Function used for capturing a PostHog event to record the opt-in action (default is this PostHog instance's capture method)\n * @param {string} [options.capture_event_name=$opt_in] Event name to be used for capturing the opt-in action\n * @param {Object} [options.capture_properties] Set of properties to be captured along with the opt-in action\n * @param {boolean} [options.enable_persistence=true] If true, will re-enable sdk persistence\n * @param {string} [options.persistence_type=localStorage] Persistence mechanism used - cookie or localStorage - falls back to cookie if localStorage is unavailable\n * @param {string} [options.cookie_prefix=__ph_opt_in_out] Custom prefix to be used in the cookie/localstorage name\n * @param {Number} [options.cookie_expiration] Number of days until the opt-in cookie expires (overrides value specified in this PostHog instance's config)\n * @param {boolean} [options.cross_subdomain_cookie] Whether the opt-in cookie is set as cross-subdomain or not (overrides value specified in this PostHog instance's config)\n * @param {boolean} [options.secure_cookie] Whether the opt-in cookie is set as secure or not (overrides value specified in this PostHog instance's config)\n */\n opt_in_capturing(options?: Partial<OptInOutCapturingOptions>): void {\n options = _extend(\n {\n enable_persistence: true,\n },\n options || {}\n )\n\n this._gdpr_call_func(optIn, options)\n this._gdpr_update_persistence(options)\n }\n\n /**\n * Opt the user out of data capturing and cookies/localstorage for this PostHog instance\n *\n * ### Usage\n *\n * // opt user out\n * posthog.opt_out_capturing();\n *\n * // opt user out with different cookie configuration from PostHog instance\n * posthog.opt_out_capturing({\n * cookie_expiration: 30,\n * secure_cookie: true\n * });\n *\n * @param {Object} [options] A dictionary of config options to override\n * @param {boolean} [options.clear_persistence=true] If true, will delete all data stored by the sdk in persistence\n * @param {string} [options.persistence_type=localStorage] Persistence mechanism used - cookie or localStorage - falls back to cookie if localStorage is unavailable\n * @param {string} [options.cookie_prefix=__ph_opt_in_out] Custom prefix to be used in the cookie/localstorage name\n * @param {Number} [options.cookie_expiration] Number of days until the opt-in cookie expires (overrides value specified in this PostHog instance's config)\n * @param {boolean} [options.cross_subdomain_cookie] Whether the opt-in cookie is set as cross-subdomain or not (overrides value specified in this PostHog instance's config)\n * @param {boolean} [options.secure_cookie] Whether the opt-in cookie is set as secure or not (overrides value specified in this PostHog instance's config)\n */\n opt_out_capturing(options?: Partial<OptInOutCapturingOptions>): void {\n const _options = _extend(\n {\n clear_persistence: true,\n },\n options || {}\n )\n\n this._gdpr_call_func(optOut, _options)\n this._gdpr_update_persistence(_options)\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 * @param {Object} [options] A dictionary of config options to override\n * @param {string} [options.persistence_type=localStorage] Persistence mechanism used - cookie or localStorage - falls back to cookie if localStorage is unavailable\n * @param {string} [options.cookie_prefix=__ph_opt_in_out] Custom prefix to be used in the cookie/localstorage name\n * @returns {boolean} current opt-in status\n */\n has_opted_in_capturing(options?: Partial<OptInOutCapturingOptions>): boolean {\n return this._gdpr_call_func(hasOptedIn, options)\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 * @param {Object} [options] A dictionary of config options to override\n * @param {string} [options.persistence_type=localStorage] Persistence mechanism used - cookie or localStorage - falls back to cookie if localStorage is unavailable\n * @param {string} [options.cookie_prefix=__ph_opt_in_out] Custom prefix to be used in the cookie/localstorage name\n * @returns {boolean} current opt-out status\n */\n has_opted_out_capturing(options?: Partial<OptInOutCapturingOptions>): boolean {\n return this._gdpr_call_func(hasOptedOut, options)\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 * // clear user's opt-in/out status with specific cookie configuration - should match\n * // configuration used when opt_in_capturing/opt_out_capturing methods were called.\n * posthog.clear_opt_in_out_capturing({\n * cookie_expiration: 30,\n * secure_cookie: true\n * });\n *\n * @param {Object} [options] A dictionary of config options to override\n * @param {boolean} [options.enable_persistence=true] If true, will re-enable sdk persistence\n * @param {string} [options.persistence_type=localStorage] Persistence mechanism used - cookie or localStorage - falls back to cookie if localStorage is unavailable\n * @param {string} [options.cookie_prefix=__ph_opt_in_out] Custom prefix to be used in the cookie/localstorage name\n * @param {Number} [options.cookie_expiration] Number of days until the opt-in cookie expires (overrides value specified in this PostHog instance's config)\n * @param {boolean} [options.cross_subdomain_cookie] Whether the opt-in cookie is set as cross-subdomain or not (overrides value specified in this PostHog instance's config)\n * @param {boolean} [options.secure_cookie] Whether the opt-in cookie is set as secure or not (overrides value specified in this PostHog instance's config)\n */\n clear_opt_in_out_capturing(options?: Partial<OptInOutCapturingOptions>): void {\n const _options: Partial<OptInOutCapturingOptions> = _extend(\n {\n enable_persistence: true,\n },\n options ?? {}\n )\n this._gdpr_call_func(clearOptInOut, _options)\n this._gdpr_update_persistence(_options)\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\n_safewrap_class(PostHog, ['identify'])\n\nconst instances: Record<string, PostHog> = {}\nconst extend_mp = function () {\n // add all the sub posthog instances\n _each(instances, function (instance, name) {\n if (name !== PRIMARY_INSTANCE_NAME) {\n posthog_master[name] = instance\n }\n })\n}\n\nconst override_ph_init_func = function () {\n // we override the snippets init function to handle the case where a\n // user initializes the posthog library after the script loads & runs\n posthog_master['init'] = function (token?: string, config?: Partial<PostHogConfig>, name?: string) {\n if (name) {\n // initialize a sub library\n if (!posthog_master[name]) {\n posthog_master[name] = instances[name] = create_phlib(\n token || '',\n config || {},\n name,\n (instance: PostHog) => {\n posthog_master[name] = instances[name] = instance\n instance._loaded()\n }\n )\n }\n return posthog_master[name]\n } else {\n let instance: PostHog = posthog_master as any as PostHog\n\n if (instances[PRIMARY_INSTANCE_NAME]) {\n // main posthog lib already initialized\n instance = instances[PRIMARY_INSTANCE_NAME]\n } else if (token) {\n // intialize the main posthog lib\n instance = create_phlib(token, config || {}, PRIMARY_INSTANCE_NAME, (instance: PostHog) => {\n instances[PRIMARY_INSTANCE_NAME] = instance\n instance._loaded()\n })\n instances[PRIMARY_INSTANCE_NAME] = instance\n }\n\n ;(posthog_master as any) = instance\n if (init_type === InitType.INIT_SNIPPET) {\n ;(window as any)[PRIMARY_INSTANCE_NAME] = posthog_master\n }\n extend_mp()\n return instance\n }\n }\n}\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 _register_event(window, 'load', dom_loaded_handler, true)\n}\n\nexport function init_from_snippet(): void {\n init_type = InitType.INIT_SNIPPET\n if (_isUndefined((window as any).posthog)) {\n ;(window as any).posthog = []\n }\n posthog_master = (window as any).posthog\n\n if (posthog_master['__loaded'] || (posthog_master['config'] && posthog_master['persistence'])) {\n // lib has already been loaded at least once; we don't want to override the global object this time so bomb early\n console.error('PostHog library has already been downloaded at least once.')\n return\n }\n\n // Load instances of the PostHog Library\n _each(posthog_master['_i'], function (item: [token: string, config: Partial<PostHogConfig>, name: string]) {\n if (item && _isArray(item)) {\n instances[item[2]] = create_phlib(...item)\n }\n })\n\n override_ph_init_func()\n ;(posthog_master['init'] as any)()\n\n // Fire loaded events after updating the window's posthog object\n _each(instances, function (instance) {\n instance._loaded()\n })\n\n add_dom_loaded_handler()\n}\n\nexport function init_as_module(): PostHog {\n init_type = InitType.INIT_MODULE\n ;(posthog_master as any) = new PostHog()\n\n override_ph_init_func()\n ;(posthog_master['init'] as any)()\n add_dom_loaded_handler()\n\n return posthog_master as any\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,KAAK,EACL,UAAU,EACV,OAAO,EACP,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,eAAe,EACf,eAAe,EACf,QAAQ,EACR,MAAM,EACN,SAAS,EACT,MAAM,GACT,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,E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AAA;QAC3E,OAAM;KACT;IAED,wCAAwC;IACxC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,UAAU,IAAmE;QACrG,IAAI,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,EAAE;YACxB,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,wCAAI,IAAI,UAAC,CAAA;SAC7C;IACL,CAAC,CAAC,CAAA;IAEF,qBAAqB,EAAE,CACtB;IAAC,cAAc,CAAC,MAAM,CAAS,EAAE,CAAA;IAElC,gEAAgE;IAChE,KAAK,CAAC,SAAS,EAAE,UAAU,QAAQ;QAC/B,QAAQ,CAAC,OAAO,EAAE,CAAA;IACtB,CAAC,CAAC,CAAA;IAEF,sBAAsB,EAAE,CAAA;AAC5B,CAAC;AAED,MAAM,UAAU,cAAc;IAC1B,SAAS,GAAG,QAAQ,CAAC,WAAW,CAC/B;IAAC,cAAsB,GAAG,IAAI,OAAO,EAAE,CAAA;IAExC,qBAAqB,EAAE,CACtB;IAAC,cAAc,CAAC,MAAM,CAAS,EAAE,CAAA;IAClC,sBAAsB,EAAE,CAAA;IAExB,OAAO,cAAqB,CAAA;AAChC,CAAC","sourcesContent":["import Config from './config'\nimport {\n _copyAndTruncateStrings,\n _each,\n _eachArray,\n _extend,\n _info,\n _isArray,\n _isBlockedUA,\n _isObject,\n _isUndefined,\n _register_event,\n _safewrap_class,\n document,\n logger,\n userAgent,\n window,\n} from './utils'\nimport { autocapture } from './autocapture'\nimport { PostHogFeatureFlags } from './posthog-featureflags'\nimport { PostHogPersistence } from './posthog-persistence'\nimport { ALIAS_ID_KEY, FLAG_CALL_REPORTED, PEOPLE_DISTINCT_ID_KEY } from './constants'\nimport { SessionRecording } from './extensions/sessionrecording'\nimport { WebPerformanceObserver } from './extensions/web-performance'\nimport { Decide } from './decide'\nimport { Toolbar } from './extensions/toolbar'\nimport { clearOptInOut, hasOptedIn, hasOptedOut, optIn, optOut, userOptedOut } from './gdpr-utils'\nimport { cookieStore, localStore } from './storage'\nimport { RequestQueue } from './request-queue'\nimport { compressData, decideCompression } from './compression'\nimport { addParamsToURL, encodePostData, xhr } from './send-request'\nimport { RetryQueue } from './retry-queue'\nimport { SessionIdManager } from './sessionid'\nimport {\n AutocaptureConfig,\n CaptureOptions,\n CaptureResult,\n Compression,\n EarlyAccessFeatureCallback,\n GDPROptions,\n isFeatureEnabledOptions,\n JSC,\n JsonType,\n OptInOutCapturingOptions,\n PostHogConfig,\n Properties,\n Property,\n RequestCallback,\n SessionIdChangedCallback,\n SnippetArrayItem,\n ToolbarParams,\n XHROptions,\n} from './types'\nimport { SentryIntegration } from './extensions/sentry-integration'\nimport { createSegmentIntegration } from './extensions/segment-integration'\nimport { PageViewManager } from './page-view'\nimport { ExceptionObserver } from './extensions/exceptions/exception-autocapture'\nimport { PostHogSurveys, SurveyCallback } from './posthog-surveys'\nimport { RateLimiter } from './rate-limiter'\nimport { uuidv7 } from './uuidv7'\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\nenum InitType {\n INIT_MODULE = 0,\n INIT_SNIPPET = 1,\n}\n\nlet init_type: InitType\n\n// TODO: the type of this is very loose. Sometimes it's also PostHogLib itself\nlet posthog_master: Record<string, PostHog> & {\n init: (token: string, config: Partial<PostHogConfig>, name: string) => void\n}\n\n// some globals for comparisons\nconst __NOOP = () => {}\nconst __NOOPTIONS = {}\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\nconst USE_XHR = window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()\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 = !USE_XHR && userAgent.indexOf('MSIE') === -1 && userAgent.indexOf('Mozilla') === -1\n\nconst defaultConfig = (): PostHogConfig => ({\n api_host: 'https://app.posthog.com',\n api_method: 'POST',\n api_transport: 'XHR',\n ui_host: null,\n token: '',\n autocapture: true,\n rageclick: true,\n cross_subdomain_cookie: document?.location?.hostname?.indexOf('herokuapp.com') === -1,\n persistence: 'cookie',\n persistence_name: '',\n cookie_name: '',\n loaded: __NOOP,\n store_google: true,\n custom_campaign_params: [],\n custom_blocked_useragents: [],\n save_referrer: true,\n test: false,\n verbose: false,\n capture_pageview: true,\n capture_pageleave: true, // We'll only capture pageleave events if capture_pageview is also true\n debug: false,\n cookie_expiration: 365,\n upgrade: false,\n disable_session_recording: false,\n disable_persistence: false,\n disable_cookie: 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_capturing_persistence_type: 'localStorage',\n opt_out_capturing_cookie_prefix: null,\n opt_in_site_apps: false,\n property_blacklist: [],\n respect_dnt: false,\n sanitize_properties: null,\n xhr_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 on_xhr_error: (req) => {\n const error = 'Bad HTTP status: ' + req.status + ' ' + req.statusText\n console.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 callback_fn: 'posthog._jsc',\n bootstrap: {},\n disable_compression: false,\n session_idle_timeout_seconds: 30 * 60, // 30 minutes\n})\n\n/**\n * create_phlib(token:string, config:object, name:string)\n *\n * This function is used by the init method of PostHogLib objects\n * as well as the main initializer at the end of the JSLib (that\n * initializes document.posthog as well as any additional instances\n * declared before this file has loaded).\n */\nconst create_phlib = function (\n token: string,\n config?: Partial<PostHogConfig>,\n name?: string,\n createComplete?: (instance: PostHog) => void\n): PostHog {\n let instance: PostHog\n const target =\n name === PRIMARY_INSTANCE_NAME || !posthog_master ? posthog_master : name ? posthog_master[name] : undefined\n const callbacksHandled = {\n initComplete: false,\n syncCode: false,\n }\n const handleCallback = (callbackName: keyof typeof callbacksHandled) => (instance: PostHog) => {\n if (!callbacksHandled[callbackName]) {\n callbacksHandled[callbackName] = true\n if (callbacksHandled.initComplete && callbacksHandled.syncCode) {\n createComplete?.(instance)\n }\n }\n }\n\n if (target && init_type === InitType.INIT_MODULE) {\n instance = target as any\n } else {\n if (target && !_isArray(target)) {\n console.error('You have already initialized ' + name)\n // TODO: throw something instead?\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return\n }\n instance = new PostHog()\n }\n\n instance._init(token, config, name, handleCallback('initComplete'))\n instance.toolbar.maybeLoadToolbar()\n\n instance.sessionRecording = new SessionRecording(instance)\n instance.sessionRecording.startRecordingIfEnabled()\n\n instance.webPerformance = new WebPerformanceObserver(instance)\n instance.webPerformance.startObservingIfEnabled()\n\n if (instance.get_config('__preview_measure_pageview_stats')) {\n instance.pageViewManager.startMeasuringScrollPosition()\n }\n\n instance.exceptionAutocapture = new ExceptionObserver(instance)\n\n instance.__autocapture = instance.get_config('autocapture')\n autocapture._setIsAutocaptureEnabled(instance)\n if (autocapture._isAutocaptureEnabled) {\n instance.__autocapture = instance.get_config('autocapture')\n const num_buckets = 100\n const num_enabled_buckets = 100\n if (!autocapture.enabledForProject(instance.get_config('token'), num_buckets, num_enabled_buckets)) {\n instance.__autocapture = false\n logger.log('Not in active bucket: disabling Automatic Event Collection.')\n } else if (!autocapture.isBrowserSupported()) {\n instance.__autocapture = false\n logger.log('Disabling Automatic Event Collection because this browser is not supported')\n } else {\n autocapture.init(instance)\n }\n }\n\n // if any instance on the page has debug = true, we set the\n // global debug to be true\n Config.DEBUG = Config.DEBUG || instance.get_config('debug')\n\n // if target is not defined, we called init after the lib already\n // loaded, so there won't be an array of things to execute\n if (typeof target !== 'undefined' && _isArray(target)) {\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, (target as any).people)\n instance._execute_array(target)\n }\n\n handleCallback('syncCode')(instance)\n return instance\n}\n\n/**\n * PostHog Library Object\n * @constructor\n */\nexport class PostHog {\n __loaded: boolean\n __loaded_recorder_version: 'v1' | 'v2' | undefined // flag that keeps track of which version of recorder is loaded\n config: PostHogConfig\n\n rateLimiter: RateLimiter\n pageViewManager: PageViewManager\n featureFlags: PostHogFeatureFlags\n surveys: PostHogSurveys\n toolbar: Toolbar\n\n // These are instance-specific state created after initialisation\n persistence?: PostHogPersistence\n sessionPersistence?: PostHogPersistence\n sessionManager?: SessionIdManager\n\n _requestQueue?: RequestQueue\n _retryQueue?: RetryQueue\n sessionRecording?: SessionRecording\n webPerformance?: WebPerformanceObserver\n exceptionAutocapture?: ExceptionObserver\n\n _triggered_notifs: any\n compression: Partial<Record<Compression, boolean>>\n _jsc: JSC\n __captureHooks: ((eventName: string) => void)[]\n __request_queue: [url: string, data: Record<string, any>, options: XHROptions, callback?: RequestCallback][]\n __autocapture: boolean | AutocaptureConfig | undefined\n decideEndpointWasHit: boolean\n\n SentryIntegration: typeof SentryIntegration\n segmentIntegration: () => any\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 this.compression = {}\n this.decideEndpointWasHit = false\n this.SentryIntegration = SentryIntegration\n this.segmentIntegration = () => createSegmentIntegration(this)\n this.__captureHooks = []\n this.__request_queue = []\n this.__loaded = false\n this.__loaded_recorder_version = undefined\n this.__autocapture = undefined\n this._jsc = function () {} as JSC\n\n this.featureFlags = new PostHogFeatureFlags(this)\n this.toolbar = new Toolbar(this)\n this.pageViewManager = new PageViewManager()\n this.surveys = new PostHogSurveys(this)\n this.rateLimiter = new RateLimiter()\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 = typeof prop === 'string' ? { [prop]: to } : prop\n this.setPersonProperties(setProps)\n callback?.({})\n },\n set_once: (prop: string | Properties, to?: string, callback?: RequestCallback) => {\n const setProps = typeof prop === 'string' ? { [prop]: to } : prop\n this.setPersonProperties(undefined, setProps)\n callback?.({})\n },\n }\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(token: string, config?: Partial<PostHogConfig>, name?: string): PostHog | void {\n if (_isUndefined(name)) {\n console.error('You must name your new library: init(token, config, name)')\n return\n }\n if (name === PRIMARY_INSTANCE_NAME) {\n console.error('You must initialize the main posthog object right after you include the PostHog js snippet')\n return\n }\n\n const instance: PostHog = create_phlib(token, config, name, (instance: PostHog) => {\n posthog_master[name] = instance\n instance._loaded()\n })\n posthog_master[name] = instance\n\n return instance\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(\n token: string,\n config: Partial<PostHogConfig> = {},\n name?: string,\n initComplete?: (instance: PostHog) => void\n ): void {\n this.__loaded = true\n this.config = {} as PostHogConfig // will be set right below\n this._triggered_notifs = []\n\n // To avoid using Promises and their helper functions, we instead keep\n // track of which callbacks have been called, and then call initComplete\n // when all of them have been called. To add additional async code, add\n // to `callbacksHandled` and pass updateInitComplete as a callback to\n // the async code.\n const callbacksHandled = { segmentRegister: false, syncCode: false }\n const updateInitComplete = (callbackName: keyof typeof callbacksHandled) => () => {\n // Update the register of callbacks that have been called, and if\n // they have all been called, then we are ready to call\n // initComplete.\n if (!callbacksHandled[callbackName]) {\n callbacksHandled[callbackName] = true\n if (callbacksHandled.segmentRegister && callbacksHandled.syncCode) {\n initComplete?.(this)\n }\n }\n }\n\n this.set_config(\n _extend({}, defaultConfig(), config, {\n name: name,\n token: token,\n callback_fn: (name === PRIMARY_INSTANCE_NAME ? name : PRIMARY_INSTANCE_NAME + '.' + name) + '._jsc',\n })\n )\n\n this._jsc = function () {} as JSC\n\n // Check if recorder.js is already loaded\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (window?.rrweb?.record || window?.rrwebRecord) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this.__loaded_recorder_version = window?.rrweb?.version\n }\n\n this.persistence = new PostHogPersistence(this.config)\n\n this._requestQueue = new RequestQueue(this._handle_queued_event.bind(this))\n this._retryQueue = new RetryQueue(this.get_config('on_xhr_error'), this.rateLimiter)\n this.__captureHooks = []\n this.__request_queue = []\n\n this.sessionManager = new SessionIdManager(this.config, this.persistence)\n this.sessionPersistence =\n this.config.persistence === 'sessionStorage'\n ? this.persistence\n : new PostHogPersistence({ ...this.config, persistence: 'sessionStorage' })\n\n this._gdpr_init()\n\n if (config.segment) {\n // Use segments anonymousId instead\n this.config.get_device_id = () => config.segment.user().anonymousId()\n\n // If a segment user ID exists, set it as the distinct_id\n if (config.segment.user().id()) {\n this.register({\n distinct_id: config.segment.user().id(),\n })\n this.persistence.set_user_state('identified')\n }\n\n config.segment.register(this.segmentIntegration()).then(updateInitComplete('segmentRegister'))\n } else {\n updateInitComplete('segmentRegister')()\n }\n\n if (config.bootstrap?.distinctID !== undefined) {\n const uuid = this.get_config('get_device_id')(uuidv7())\n const deviceID = config.bootstrap?.isIdentifiedID ? uuid : config.bootstrap.distinctID\n this.persistence.set_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.get_config('get_device_id')(uuidv7())\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_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 &&\n window.addEventListener('onpagehide' in self ? 'pagehide' : 'unload', this._handle_unload.bind(this))\n\n // Make sure that we also call the initComplete callback at the end of\n // the synchronous code as well.\n updateInitComplete('syncCode')()\n }\n\n // Private methods\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.get_config('advanced_disable_decide')\n if (!disableDecide) {\n this.featureFlags.setReloadingPaused(true)\n }\n\n try {\n this.get_config('loaded')(this)\n } catch (err) {\n console.error('`loaded` function failed', err)\n }\n\n this._start_queue_if_opted_in()\n\n // this happens after so a user can call identify in\n // the loaded callback\n if (this.get_config('capture_pageview')) {\n this.capture('$pageview', { title: document.title }, { send_instantly: true })\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 }\n\n _start_queue_if_opted_in(): void {\n if (!this.has_opted_out_capturing()) {\n if (this.get_config('request_batching')) {\n this._requestQueue?.poll()\n }\n }\n }\n\n _dom_loaded(): void {\n if (!this.has_opted_out_capturing()) {\n _eachArray(this.__request_queue, (item) => {\n this._send_request(...item)\n })\n }\n\n this.__request_queue = []\n\n this._start_queue_if_opted_in()\n }\n\n /**\n * _prepare_callback() should be called by callers of _send_request for use\n * as the callback argument.\n *\n * If there is no callback, this returns null.\n * If we are going to make XHR/XDR requests, this returns a function.\n * If we are going to use script tags, this returns a string to use as the\n * callback GET param.\n */\n // TODO: get rid of the \"| string\"\n _prepare_callback(callback?: RequestCallback, data?: Properties): RequestCallback | null | string {\n if (_isUndefined(callback)) {\n return null\n }\n\n if (USE_XHR) {\n return function (response) {\n callback(response, data)\n }\n } else {\n // if the user gives us a callback, we store as a random\n // property on this instances jsc function and update our\n // callback string to reflect that.\n const jsc = this._jsc\n const randomized_cb = '' + Math.floor(Math.random() * 100000000)\n const callback_string = this.get_config('callback_fn') + '[' + randomized_cb + ']'\n jsc[randomized_cb] = function (response: any) {\n delete jsc[randomized_cb]\n callback(response, data)\n }\n return callback_string\n }\n }\n\n _handle_unload(): void {\n if (!this.get_config('request_batching')) {\n if (this.get_config('capture_pageview') && this.get_config('capture_pageleave')) {\n this.capture('$pageleave', null, { transport: 'sendBeacon' })\n }\n return\n }\n\n if (this.get_config('capture_pageview') && this.get_config('capture_pageleave')) {\n this.capture('$pageleave')\n }\n\n this._requestQueue?.unload()\n this._retryQueue?.unload()\n }\n\n _handle_queued_event(url: string, data: Record<string, any>, options?: XHROptions): void {\n const jsonData = JSON.stringify(data)\n this.__compress_and_send_json_request(url, jsonData, options || __NOOPTIONS, __NOOP)\n }\n\n __compress_and_send_json_request(\n url: string,\n jsonData: string,\n options: XHROptions,\n callback?: RequestCallback\n ): void {\n const [data, _options] = compressData(decideCompression(this.compression), jsonData, options)\n this._send_request(url, data, _options, callback)\n }\n\n _send_request(url: string, data: Record<string, any>, options: CaptureOptions, callback?: RequestCallback): void {\n if (!this.__loaded || !this._retryQueue) {\n return\n }\n if (this.rateLimiter.isRateLimited(options._batchKey)) {\n return\n }\n\n if (ENQUEUE_REQUESTS) {\n this.__request_queue.push([url, data, options, callback])\n return\n }\n\n const DEFAULT_OPTIONS = {\n method: this.get_config('api_method'),\n transport: this.get_config('api_transport'),\n verbose: this.get_config('verbose'),\n }\n\n options = _extend(DEFAULT_OPTIONS, options || {})\n if (!USE_XHR) {\n options.method = 'GET'\n }\n\n const useSendBeacon = 'sendBeacon' in window.navigator && options.transport === 'sendBeacon'\n url = addParamsToURL(url, options.urlQueryArgs || {}, {\n ip: this.get_config('ip'),\n })\n\n if (useSendBeacon) {\n // beacon documentation https://w3c.github.io/beacon/\n // beacons format the message and use the type property\n try {\n window.navigator.sendBeacon(url, encodePostData(data, { ...options, sendBeacon: true }))\n } catch (e) {\n // send beacon is a best-effort, fire-and-forget mechanism on page unload,\n // we don't want to throw errors here\n }\n } else if (USE_XHR) {\n try {\n xhr({\n url: url,\n data: data,\n headers: this.get_config('xhr_headers'),\n options: options,\n callback,\n retriesPerformedSoFar: 0,\n retryQueue: this._retryQueue,\n onXHRError: this.get_config('on_xhr_error'),\n onResponse: this.rateLimiter.checkForLimiting,\n })\n } catch (e) {\n console.error(e)\n }\n } else {\n const script = document.createElement('script')\n script.type = 'text/javascript'\n script.async = true\n script.defer = true\n script.src = url\n const s = document.getElementsByTagName('script')[0]\n s.parentNode?.insertBefore(script, s)\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 (typeof item === 'function') {\n ;(item as any).call(this)\n } else if (_isArray(item) && fn_name === 'alias') {\n alias_calls.push(item)\n } else if (\n _isArray(item) &&\n fn_name.indexOf('capture') !== -1 &&\n typeof (this as any)[fn_name] === 'function'\n ) {\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 * PostHog supports exception autocapture, however, this function\n * is used to manually capture an exception\n * and can be used to add more context to that exception\n *\n * Properties passed as the second option will be merged with the properties\n * of the exception event.\n * Where there is a key in both generated exception and passed properties,\n * the generated exception property takes precedence.\n */\n captureException(exception: Error, properties?: Properties): void {\n this.exceptionAutocapture?.captureException(\n [exception.name, undefined, undefined, undefined, exception],\n properties\n )\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} [options] Optional configuration for this capture request.\n * @param {String} [options.transport] Transport method for network request ('XHR' or 'sendBeacon').\n * @param {Date} [options.timestamp] Timestamp is a Date object. If not set, it'll automatically be set to the current time.\n */\n capture(\n event_name: string,\n properties?: Properties | null,\n options: CaptureOptions = __NOOPTIONS\n ): CaptureResult | void {\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.sessionPersistence || !this._requestQueue) {\n return logger.unintializedWarning('posthog.capture')\n }\n\n if (userOptedOut(this, false)) {\n return\n }\n\n options = options || __NOOPTIONS\n const transport = options['transport'] // external API, don't minify 'transport' prop\n if (transport) {\n options.transport = transport // 'transport' prop name can be minified internally\n }\n\n // typing doesn't prevent interesting data\n if (_isUndefined(event_name) || typeof event_name !== 'string') {\n console.error('No event name provided to posthog.capture')\n return\n }\n\n if (_isBlockedUA(userAgent, this.get_config('custom_blocked_useragents'))) {\n return\n }\n\n // update persistence\n this.sessionPersistence.update_search_keyword()\n\n if (this.get_config('store_google')) {\n this.sessionPersistence.update_campaign_params()\n }\n if (this.get_config('save_referrer')) {\n this.sessionPersistence.update_referrer_info()\n }\n\n let data: CaptureResult = {\n uuid: uuidv7(),\n event: event_name,\n properties: this._calculate_event_properties(event_name, properties || {}),\n }\n\n if (event_name === '$identify') {\n data['$set'] = options['$set']\n data['$set_once'] = options['$set_once']\n }\n\n data = _copyAndTruncateStrings(\n data,\n options._noTruncate ? null : this.get_config('properties_string_max_length')\n )\n data.timestamp = options.timestamp || new Date()\n\n if (this.get_config('debug')) {\n logger.log('PostHog.js send', data)\n }\n const jsonData = JSON.stringify(data)\n\n const url = this.get_config('api_host') + (options.endpoint || '/e/')\n\n const has_unique_traits = options !== __NOOPTIONS\n\n if (\n this.get_config('request_batching') &&\n (!has_unique_traits || options._batchKey) &&\n !options.send_instantly\n ) {\n this._requestQueue.enqueue(url, data, options)\n } else {\n this.__compress_and_send_json_request(url, jsonData, options)\n }\n\n this._invokeCaptureHooks(event_name, data)\n\n return data\n }\n\n _addCaptureHook(callback: (eventName: string) => void): void {\n this.__captureHooks.push(callback)\n }\n\n _invokeCaptureHooks(eventName: string, eventData: CaptureResult): void {\n this.config._onCapture(eventName, eventData)\n _each(this.__captureHooks, (callback) => callback(eventName))\n }\n\n _calculate_event_properties(event_name: string, event_properties: Properties): Properties {\n if (!this.persistence || !this.sessionPersistence) {\n return event_properties\n }\n\n // set defaults\n const start_timestamp = this.persistence.remove_event_timer(event_name)\n let properties = { ...event_properties }\n properties['token'] = this.get_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 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.get_config('__preview_measure_pageview_stats')) {\n let performanceProperties: Record<string, any> = {}\n if (event_name === '$pageview') {\n performanceProperties = this.pageViewManager.doPageView()\n } else if (event_name === '$pageleave') {\n performanceProperties = this.pageViewManager.doPageLeave()\n }\n properties = _extend(properties, performanceProperties)\n }\n\n if (event_name === '$pageview') {\n properties['title'] = document.title\n }\n\n if (event_name === '$performance_event') {\n const persistenceProps = this.persistence.properties()\n // Early exit for $performance_event as we only need session and $current_url\n properties['distinct_id'] = persistenceProps.distinct_id\n properties['$current_url'] = infoProperties.$current_url\n return properties\n }\n\n // set $duration if time_event was previously called for this event\n if (typeof start_timestamp !== 'undefined') {\n const duration_in_ms = new Date().getTime() - start_timestamp\n properties['$duration'] = parseFloat((duration_in_ms / 1000).toFixed(3))\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 _info.properties(),\n this.persistence.properties(),\n this.sessionPersistence.properties(),\n properties\n )\n\n const property_blacklist = this.get_config('property_blacklist')\n if (_isArray(property_blacklist)) {\n _each(property_blacklist, function (blacklisted_prop) {\n delete properties[blacklisted_prop]\n })\n } else {\n console.error('Invalid value for property_blacklist config: ' + property_blacklist)\n }\n\n const sanitize_properties = this.get_config('sanitize_properties')\n if (sanitize_properties) {\n properties = sanitize_properties(properties, event_name)\n }\n\n return properties\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 * 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 /**\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.unintializedWarning('posthog.identify')\n }\n //if the new_distinct_id has not been set ignore the identify event\n if (!new_distinct_id) {\n console.error('Unique user id has not been set in 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_user_state() === 'anonymous'\n\n // send an $identify event any time the distinct_id is changing and the old ID is an anoymous 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_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.\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 // Update current user properties\n this.setPersonPropertiesForFlags(userPropertiesToSet || {})\n\n this.capture('$set', { $set: userPropertiesToSet || {}, $set_once: userPropertiesToSetOnce || {} })\n }\n\n /**\n * Alpha feature: don't use unless you know what you're doing!\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 console.error('posthog.group requires a group type and group key')\n return\n }\n\n const existingGroups = this.getGroups()\n\n // if group key changes, remove stored group properties\n if (existingGroups[groupType] !== groupKey) {\n this.resetGroupPropertiesForFlags(groupType)\n }\n\n this.register({ $groups: { ...existingGroups, [groupType]: groupKey } })\n\n if (groupPropertiesToSet) {\n this.capture('$groupidentify', {\n $group_type: groupType,\n $group_key: groupKey,\n $group_set: groupPropertiesToSet,\n })\n this.setGroupPropertiesForFlags({ [groupType]: groupPropertiesToSet })\n }\n\n // If groups change and no properties change, reload feature flags.\n // The property change reload case is handled in setGroupPropertiesForFlags.\n if (existingGroups[groupType] !== groupKey && !groupPropertiesToSet) {\n this.reloadFeatureFlags()\n }\n }\n\n /**\n * Resets only the group properties of the user currently logged in.\n */\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 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 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 if (!this.__loaded) {\n return logger.unintializedWarning('posthog.reset')\n }\n const device_id = this.get_property('$device_id')\n this.persistence?.clear()\n this.sessionPersistence?.clear()\n this.persistence?.set_user_state('anonymous')\n this.sessionManager?.resetSessionId()\n const uuid = this.get_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 host = this.config.ui_host || this.config.api_host\n const { sessionId, sessionStartTimestamp } = this.sessionManager.checkAndGetSessionAndWindowId(true)\n let url = host + '/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\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 console.error('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://app.posthog.com',\n *\n * // HTTP method for capturing requests\n * api_method: 'POST'\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://app.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 * // 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 * // names of properties/superproperties which should never\n * // be sent with capture() calls\n * property_blacklist: []\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 * xhr_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: {},\n * maskInputFn: null,\n * slimDOMOptions: {},\n * collectFonts: false\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, config)\n\n if (!this.get_config('persistence_name')) {\n this.config.persistence_name = this.config.cookie_name\n }\n if (!this.get_config('disable_persistence')) {\n this.config.disable_persistence = this.config.disable_cookie\n }\n\n this.persistence?.update_config(this.config)\n this.sessionPersistence?.update_config(this.config)\n\n if (localStore.is_supported() && localStore.get('ph_debug') === 'true') {\n this.config.debug = true\n }\n if (this.get_config('debug')) {\n Config.DEBUG = true\n }\n\n if (this.sessionRecording && typeof config.disable_session_recording !== 'undefined') {\n if (oldConfig.disable_session_recording !== config.disable_session_recording) {\n if (config.disable_session_recording) {\n this.sessionRecording.stopRecording()\n } else {\n this.sessionRecording.startRecordingIfEnabled()\n }\n }\n }\n }\n }\n\n /**\n * turns session recording on, and updates the config option\n * disable_session_recording to false\n */\n startSessionRecording(): void {\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 /**\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 current config object for the library.\n */\n get_config<K extends keyof PostHogConfig>(prop_name: K): PostHogConfig[K] {\n return this.config?.[prop_name]\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.get_config('name') ?? PRIMARY_INSTANCE_NAME\n if (name !== PRIMARY_INSTANCE_NAME) {\n name = PRIMARY_INSTANCE_NAME + '.' + name\n }\n return name\n }\n\n // perform some housekeeping around GDPR opt-in/out state\n _gdpr_init(): void {\n const is_localStorage_requested = this.get_config('opt_out_capturing_persistence_type') === 'localStorage'\n\n // try to convert opt-in/out cookies to localStorage if possible\n if (is_localStorage_requested && localStore.is_supported()) {\n if (!this.has_opted_in_capturing() && this.has_opted_in_capturing({ persistence_type: 'cookie' })) {\n this.opt_in_capturing({ enable_persistence: false })\n }\n if (!this.has_opted_out_capturing() && this.has_opted_out_capturing({ persistence_type: 'cookie' })) {\n this.opt_out_capturing({ clear_persistence: false })\n }\n this.clear_opt_in_out_capturing({\n persistence_type: 'cookie',\n enable_persistence: false,\n })\n }\n\n // check whether the user has already opted out - if so, clear & disable persistence\n if (this.has_opted_out_capturing()) {\n this._gdpr_update_persistence({ clear_persistence: true })\n\n // check whether we should opt out by default\n // note: we don't clear persistence here by default since opt-out default state is often\n // used as an initial state while GDPR information is being collected\n } else if (\n !this.has_opted_in_capturing() &&\n (this.get_config('opt_out_capturing_by_default') || cookieStore.get('ph_optout'))\n ) {\n cookieStore.remove('ph_optout')\n this.opt_out_capturing({\n clear_persistence: this.get_config('opt_out_persistence_by_default'),\n })\n }\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} [options.clear_persistence] If true, will delete all data stored by the sdk in persistence and disable it\n * @param {boolean} [options.enable_persistence] If true, will re-enable sdk persistence\n */\n _gdpr_update_persistence(options: Partial<OptInOutCapturingOptions>): void {\n let disabled\n if (options && options['clear_persistence']) {\n disabled = true\n } else if (options && options['enable_persistence']) {\n disabled = false\n } else {\n return\n }\n\n if (!this.get_config('disable_persistence') && this.persistence?.disabled !== disabled) {\n this.persistence?.set_disabled(disabled)\n }\n if (!this.get_config('disable_persistence') && this.sessionPersistence?.disabled !== disabled) {\n this.sessionPersistence?.set_disabled(disabled)\n }\n }\n\n // call a base gdpr function after constructing the appropriate token and options args\n _gdpr_call_func<R = any>(\n func: (token: string, options: GDPROptions) => R,\n options?: Partial<OptInOutCapturingOptions>\n ): R {\n options = _extend(\n {\n capture: this.capture.bind(this),\n persistence_type: this.get_config('opt_out_capturing_persistence_type'),\n cookie_prefix: this.get_config('opt_out_capturing_cookie_prefix'),\n cookie_expiration: this.get_config('cookie_expiration'),\n cross_subdomain_cookie: this.get_config('cross_subdomain_cookie'),\n secure_cookie: this.get_config('secure_cookie'),\n },\n options || {}\n )\n\n // check if localStorage can be used for recording opt out status, fall back to cookie if not\n if (!localStore.is_supported() && options['persistence_type'] === 'localStorage') {\n options['persistence_type'] = 'cookie'\n }\n\n return func(this.get_config('token'), {\n capture: options['capture'],\n captureEventName: options['capture_event_name'],\n captureProperties: options['capture_properties'],\n persistenceType: options['persistence_type'],\n persistencePrefix: options['cookie_prefix'],\n cookieExpiration: options['cookie_expiration'],\n crossSubdomainCookie: options['cross_subdomain_cookie'],\n secureCookie: options['secure_cookie'],\n })\n }\n\n /**\n * Opt the user in to data capturing and cookies/localstorage for this PostHog instance\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 * cookie_expiration: 30,\n * secure_cookie: true\n * });\n *\n * @param {Object} [options] A dictionary of config options to override\n * @param {function} [options.capture] Function used for capturing a PostHog event to record the opt-in action (default is this PostHog instance's capture method)\n * @param {string} [options.capture_event_name=$opt_in] Event name to be used for capturing the opt-in action\n * @param {Object} [options.capture_properties] Set of properties to be captured along with the opt-in action\n * @param {boolean} [options.enable_persistence=true] If true, will re-enable sdk persistence\n * @param {string} [options.persistence_type=localStorage] Persistence mechanism used - cookie or localStorage - falls back to cookie if localStorage is unavailable\n * @param {string} [options.cookie_prefix=__ph_opt_in_out] Custom prefix to be used in the cookie/localstorage name\n * @param {Number} [options.cookie_expiration] Number of days until the opt-in cookie expires (overrides value specified in this PostHog instance's config)\n * @param {boolean} [options.cross_subdomain_cookie] Whether the opt-in cookie is set as cross-subdomain or not (overrides value specified in this PostHog instance's config)\n * @param {boolean} [options.secure_cookie] Whether the opt-in cookie is set as secure or not (overrides value specified in this PostHog instance's config)\n */\n opt_in_capturing(options?: Partial<OptInOutCapturingOptions>): void {\n options = _extend(\n {\n enable_persistence: true,\n },\n options || {}\n )\n\n this._gdpr_call_func(optIn, options)\n this._gdpr_update_persistence(options)\n }\n\n /**\n * Opt the user out of data capturing and cookies/localstorage for this PostHog instance\n *\n * ### Usage\n *\n * // opt user out\n * posthog.opt_out_capturing();\n *\n * // opt user out with different cookie configuration from PostHog instance\n * posthog.opt_out_capturing({\n * cookie_expiration: 30,\n * secure_cookie: true\n * });\n *\n * @param {Object} [options] A dictionary of config options to override\n * @param {boolean} [options.clear_persistence=true] If true, will delete all data stored by the sdk in persistence\n * @param {string} [options.persistence_type=localStorage] Persistence mechanism used - cookie or localStorage - falls back to cookie if localStorage is unavailable\n * @param {string} [options.cookie_prefix=__ph_opt_in_out] Custom prefix to be used in the cookie/localstorage name\n * @param {Number} [options.cookie_expiration] Number of days until the opt-in cookie expires (overrides value specified in this PostHog instance's config)\n * @param {boolean} [options.cross_subdomain_cookie] Whether the opt-in cookie is set as cross-subdomain or not (overrides value specified in this PostHog instance's config)\n * @param {boolean} [options.secure_cookie] Whether the opt-in cookie is set as secure or not (overrides value specified in this PostHog instance's config)\n */\n opt_out_capturing(options?: Partial<OptInOutCapturingOptions>): void {\n const _options = _extend(\n {\n clear_persistence: true,\n },\n options || {}\n )\n\n this._gdpr_call_func(optOut, _options)\n this._gdpr_update_persistence(_options)\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 * @param {Object} [options] A dictionary of config options to override\n * @param {string} [options.persistence_type=localStorage] Persistence mechanism used - cookie or localStorage - falls back to cookie if localStorage is unavailable\n * @param {string} [options.cookie_prefix=__ph_opt_in_out] Custom prefix to be used in the cookie/localstorage name\n * @returns {boolean} current opt-in status\n */\n has_opted_in_capturing(options?: Partial<OptInOutCapturingOptions>): boolean {\n return this._gdpr_call_func(hasOptedIn, options)\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 * @param {Object} [options] A dictionary of config options to override\n * @param {string} [options.persistence_type=localStorage] Persistence mechanism used - cookie or localStorage - falls back to cookie if localStorage is unavailable\n * @param {string} [options.cookie_prefix=__ph_opt_in_out] Custom prefix to be used in the cookie/localstorage name\n * @returns {boolean} current opt-out status\n */\n has_opted_out_capturing(options?: Partial<OptInOutCapturingOptions>): boolean {\n return this._gdpr_call_func(hasOptedOut, options)\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 * // clear user's opt-in/out status with specific cookie configuration - should match\n * // configuration used when opt_in_capturing/opt_out_capturing methods were called.\n * posthog.clear_opt_in_out_capturing({\n * cookie_expiration: 30,\n * secure_cookie: true\n * });\n *\n * @param {Object} [options] A dictionary of config options to override\n * @param {boolean} [options.enable_persistence=true] If true, will re-enable sdk persistence\n * @param {string} [options.persistence_type=localStorage] Persistence mechanism used - cookie or localStorage - falls back to cookie if localStorage is unavailable\n * @param {string} [options.cookie_prefix=__ph_opt_in_out] Custom prefix to be used in the cookie/localstorage name\n * @param {Number} [options.cookie_expiration] Number of days until the opt-in cookie expires (overrides value specified in this PostHog instance's config)\n * @param {boolean} [options.cross_subdomain_cookie] Whether the opt-in cookie is set as cross-subdomain or not (overrides value specified in this PostHog instance's config)\n * @param {boolean} [options.secure_cookie] Whether the opt-in cookie is set as secure or not (overrides value specified in this PostHog instance's config)\n */\n clear_opt_in_out_capturing(options?: Partial<OptInOutCapturingOptions>): void {\n const _options: Partial<OptInOutCapturingOptions> = _extend(\n {\n enable_persistence: true,\n },\n options ?? {}\n )\n this._gdpr_call_func(clearOptInOut, _options)\n this._gdpr_update_persistence(_options)\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\n_safewrap_class(PostHog, ['identify'])\n\nconst instances: Record<string, PostHog> = {}\nconst extend_mp = function () {\n // add all the sub posthog instances\n _each(instances, function (instance, name) {\n if (name !== PRIMARY_INSTANCE_NAME) {\n posthog_master[name] = instance\n }\n })\n}\n\nconst override_ph_init_func = function () {\n // we override the snippets init function to handle the case where a\n // user initializes the posthog library after the script loads & runs\n posthog_master['init'] = function (token?: string, config?: Partial<PostHogConfig>, name?: string) {\n if (name) {\n // initialize a sub library\n if (!posthog_master[name]) {\n posthog_master[name] = instances[name] = create_phlib(\n token || '',\n config || {},\n name,\n (instance: PostHog) => {\n posthog_master[name] = instances[name] = instance\n instance._loaded()\n }\n )\n }\n return posthog_master[name]\n } else {\n let instance: PostHog = posthog_master as any as PostHog\n\n if (instances[PRIMARY_INSTANCE_NAME]) {\n // main posthog lib already initialized\n instance = instances[PRIMARY_INSTANCE_NAME]\n } else if (token) {\n // intialize the main posthog lib\n instance = create_phlib(token, config || {}, PRIMARY_INSTANCE_NAME, (instance: PostHog) => {\n instances[PRIMARY_INSTANCE_NAME] = instance\n instance._loaded()\n })\n instances[PRIMARY_INSTANCE_NAME] = instance\n }\n\n ;(posthog_master as any) = instance\n if (init_type === InitType.INIT_SNIPPET) {\n ;(window as any)[PRIMARY_INSTANCE_NAME] = posthog_master\n }\n extend_mp()\n return instance\n }\n }\n}\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 _register_event(window, 'load', dom_loaded_handler, true)\n}\n\nexport function init_from_snippet(): void {\n init_type = InitType.INIT_SNIPPET\n if (_isUndefined((window as any).posthog)) {\n ;(window as any).posthog = []\n }\n posthog_master = (window as any).posthog\n\n if (posthog_master['__loaded'] || (posthog_master['config'] && posthog_master['persistence'])) {\n // lib has already been loaded at least once; we don't want to override the global object this time so bomb early\n console.error('PostHog library has already been downloaded at least once.')\n return\n }\n\n // Load instances of the PostHog Library\n _each(posthog_master['_i'], function (item: [token: string, config: Partial<PostHogConfig>, name: string]) {\n if (item && _isArray(item)) {\n instances[item[2]] = create_phlib(...item)\n }\n })\n\n override_ph_init_func()\n ;(posthog_master['init'] as any)()\n\n // Fire loaded events after updating the window's posthog object\n _each(instances, function (instance) {\n instance._loaded()\n })\n\n add_dom_loaded_handler()\n}\n\nexport function init_as_module(): PostHog {\n init_type = InitType.INIT_MODULE\n ;(posthog_master as any) = new PostHog()\n\n override_ph_init_func()\n ;(posthog_master['init'] as any)()\n add_dom_loaded_handler()\n\n return posthog_master as any\n}\n"]}