posthog-node 6.2.0 → 6.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.ts +252 -125
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +35 -6
- package/dist/client.mjs +35 -6
- package/dist/entrypoints/otel.d.ts +20 -0
- package/dist/entrypoints/otel.d.ts.map +1 -1
- package/dist/exports.d.ts +2 -1
- package/dist/exports.d.ts.map +1 -1
- package/dist/extensions/context/listeners.d.ts +3 -2
- package/dist/extensions/context/listeners.d.ts.map +1 -1
- package/dist/extensions/context/types.d.ts +2 -0
- package/dist/extensions/context/types.d.ts.map +1 -1
- package/dist/extensions/express.d.ts +30 -4
- package/dist/extensions/express.d.ts.map +1 -1
- package/dist/extensions/feature-flags/feature-flags-v2.d.ts +254 -0
- package/dist/extensions/feature-flags/feature-flags-v2.d.ts.map +1 -0
- package/dist/extensions/feature-flags/feature-flags-v2.js +1408 -0
- package/dist/extensions/feature-flags/feature-flags-v2.mjs +1331 -0
- package/dist/extensions/feature-flags/feature-flags.d.ts +15 -4
- package/dist/extensions/feature-flags/feature-flags.d.ts.map +1 -1
- package/dist/extensions/feature-flags/feature-flags.js +55 -7
- package/dist/extensions/feature-flags/feature-flags.mjs +55 -7
- package/dist/extensions/nestjs.d.ts +23 -0
- package/dist/extensions/nestjs.d.ts.map +1 -1
- package/dist/feature-flag-evaluations.d.ts +8 -6
- package/dist/feature-flag-evaluations.d.ts.map +1 -1
- package/dist/flag-events.d.ts +2 -2
- package/dist/flag-events.d.ts.map +1 -1
- package/dist/flag-events.js +2 -1
- package/dist/flag-events.mjs +2 -1
- package/dist/types.d.ts +120 -95
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +4 -4
- package/src/client.ts +293 -136
- package/src/entrypoints/otel.ts +20 -0
- package/src/exports.ts +2 -1
- package/src/extensions/context/listeners.ts +3 -2
- package/src/extensions/context/types.ts +2 -0
- package/src/extensions/express.ts +30 -4
- package/src/extensions/feature-flags/feature-flags-v2.ts +2086 -0
- package/src/extensions/feature-flags/feature-flags.ts +110 -20
- package/src/extensions/nestjs.ts +23 -0
- package/src/feature-flag-evaluations.ts +8 -6
- package/src/flag-events.ts +3 -2
- package/src/types.ts +125 -104
- package/src/version.ts +1 -1
package/src/types.ts
CHANGED
|
@@ -27,8 +27,11 @@ import type { FeatureFlagEvaluations } from './feature-flag-evaluations'
|
|
|
27
27
|
import type { FlagDefinitionCacheInput, FlagDefinitionCacheProvider } from './extensions/feature-flags/cache'
|
|
28
28
|
|
|
29
29
|
export type IdentifyMessage = {
|
|
30
|
+
/** User distinct ID matching your frontend `posthog.identify()` call. */
|
|
30
31
|
distinctId: string
|
|
32
|
+
/** Person properties to set directly, or via `$set`, `$set_once`, and `$anon_distinct_id`. */
|
|
31
33
|
properties?: Record<string | number, any>
|
|
34
|
+
/** Overrides the client's `disableGeoip` setting for this event. */
|
|
32
35
|
disableGeoip?: boolean
|
|
33
36
|
/**
|
|
34
37
|
* Processing options sent with this event to capture v1.
|
|
@@ -37,8 +40,11 @@ export type IdentifyMessage = {
|
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
export type SetPersonPropertiesMessage = {
|
|
43
|
+
/** User distinct ID. Falls back to `withContext()` when missing or blank. */
|
|
40
44
|
distinctId: string
|
|
45
|
+
/** Person properties to overwrite (`$set`). */
|
|
41
46
|
properties?: Record<string | number, any>
|
|
47
|
+
/** Person properties to write only when unset (`$set_once`). */
|
|
42
48
|
propertiesOnce?: Record<string | number, any>
|
|
43
49
|
/**
|
|
44
50
|
* Processing options sent with this event to capture v1.
|
|
@@ -47,7 +53,9 @@ export type SetPersonPropertiesMessage = {
|
|
|
47
53
|
}
|
|
48
54
|
|
|
49
55
|
export type UnsetPersonPropertiesMessage = {
|
|
56
|
+
/** User distinct ID. Falls back to `withContext()` when missing or blank. */
|
|
50
57
|
distinctId: string
|
|
58
|
+
/** Property name or list of property names to remove from the person profile (`$unset`). */
|
|
51
59
|
properties: string | string[]
|
|
52
60
|
/**
|
|
53
61
|
* Processing options sent with this event to capture v1.
|
|
@@ -56,24 +64,30 @@ export type UnsetPersonPropertiesMessage = {
|
|
|
56
64
|
}
|
|
57
65
|
|
|
58
66
|
export type SendFeatureFlagsOptions = {
|
|
67
|
+
/** Skip remote `/flags` fallback and evaluate only against locally loaded flag definitions. */
|
|
59
68
|
onlyEvaluateLocally?: boolean
|
|
69
|
+
/** Person properties used during flag evaluation instead of stored server properties. */
|
|
60
70
|
personProperties?: Properties
|
|
71
|
+
/** Group properties keyed by group type for evaluating group-targeted flags. */
|
|
61
72
|
groupProperties?: Record<string, Properties>
|
|
73
|
+
/** Restrict evaluation to these flag keys. */
|
|
62
74
|
flagKeys?: string[]
|
|
63
75
|
}
|
|
64
76
|
|
|
65
|
-
export type EventMessage =
|
|
77
|
+
export type EventMessage = {
|
|
66
78
|
/**
|
|
67
|
-
* The event's distinct
|
|
68
|
-
* is used; without one, the event gets a generated id and `options.process_person_profile: false`.
|
|
79
|
+
* The event's distinct ID. When missing, empty, or whitespace, uses `withContext()`, else generates a UUIDv7 and sets `options.process_person_profile: false`.
|
|
69
80
|
*/
|
|
70
81
|
distinctId?: string
|
|
82
|
+
/** Event name (such as `'order_placed'` or `'$pageview'`). Must be 200 UTF-8 bytes or fewer. */
|
|
71
83
|
event: string
|
|
72
|
-
|
|
84
|
+
/** Event properties (also accepts `$set`, `$set_once`, and `$current_url`). */
|
|
85
|
+
properties?: Record<string | number, any>
|
|
86
|
+
/** Group types and keys to associate with this event (for example `{ company: 'acme' }`, up to 5 per project). */
|
|
87
|
+
groups?: Record<string, string | number>
|
|
73
88
|
/**
|
|
74
89
|
* Attach feature flag values evaluated via `posthog.evaluateFlags()` to this event.
|
|
75
|
-
* Prefer this over `sendFeatureFlags`
|
|
76
|
-
* values the code branched on and avoids a hidden `/flags` request on every capture.
|
|
90
|
+
* Prefer this over `sendFeatureFlags` so the event carries the exact values your code branched on without a hidden `/flags` request.
|
|
77
91
|
*/
|
|
78
92
|
flags?: FeatureFlagEvaluations
|
|
79
93
|
/**
|
|
@@ -86,6 +100,10 @@ export type EventMessage = Omit<IdentifyMessage, 'distinctId'> & {
|
|
|
86
100
|
timestamp?: Date
|
|
87
101
|
/** If provided overrides the auto-generated event UUID. Must be a valid UUID. */
|
|
88
102
|
uuid?: string
|
|
103
|
+
/** Overrides the client's `disableGeoip` setting for this event. */
|
|
104
|
+
disableGeoip?: boolean
|
|
105
|
+
/** Processing options sent with this event to capture v1. */
|
|
106
|
+
options?: EventOptions
|
|
89
107
|
/**
|
|
90
108
|
* Internal flag set by captureException() to indicate this $exception
|
|
91
109
|
* event originated from the proper exception capture path. Used to warn users who call
|
|
@@ -122,25 +140,34 @@ export type CaptureExceptionOptions = {
|
|
|
122
140
|
* resolved and the properties and options filled from every layer, after `beforeSend`.
|
|
123
141
|
*/
|
|
124
142
|
export type PreparedEventMessage = {
|
|
143
|
+
/** Resolved distinct ID after checking the call, `withContext()`, and personless fallback. */
|
|
125
144
|
distinctId: string
|
|
145
|
+
/** Final event name after SDK normalization (such as `$bot_pageview` preview renames). */
|
|
126
146
|
event: string
|
|
147
|
+
/** Merged event properties after context, `register()`, SDK defaults, and `beforeSend`. */
|
|
127
148
|
properties: PostHogEventProperties
|
|
128
149
|
/** The event's options, sent to capture unchanged. */
|
|
129
150
|
options?: EventOptions
|
|
151
|
+
/** Canonical event UUID. */
|
|
130
152
|
uuid?: string
|
|
153
|
+
/** Explicit event timestamp, if provided or set by `beforeSend`. */
|
|
131
154
|
timestamp?: Date
|
|
155
|
+
/** Per-call `disableGeoip` flag, if provided. */
|
|
132
156
|
disableGeoip?: boolean
|
|
133
157
|
}
|
|
134
158
|
|
|
135
159
|
export type GroupIdentifyMessage = {
|
|
160
|
+
/** Group type name (such as `'company'`). Projects support up to 5 group types. */
|
|
136
161
|
groupType: string
|
|
137
|
-
|
|
162
|
+
/** Unique identifier for the group within `groupType`. */
|
|
163
|
+
groupKey: string
|
|
164
|
+
/** Group properties (`$group_set`). Set `name` for the display name in PostHog. */
|
|
138
165
|
properties?: Record<string | number, any>
|
|
139
166
|
/**
|
|
140
|
-
* The event's distinct
|
|
141
|
-
* is used, then `$<groupType>_<groupKey>`.
|
|
167
|
+
* The event's distinct ID. When missing, empty, or whitespace, uses `withContext()`, then `$<groupType>_<groupKey>`.
|
|
142
168
|
*/
|
|
143
169
|
distinctId?: string
|
|
170
|
+
/** Overrides the client's `disableGeoip` setting for this event. */
|
|
144
171
|
disableGeoip?: boolean
|
|
145
172
|
/**
|
|
146
173
|
* Processing options sent with this event to capture v1.
|
|
@@ -180,14 +207,19 @@ export type OverrideFeatureFlagsOptions =
|
|
|
180
207
|
| FeatureFlagOverrideOptions
|
|
181
208
|
|
|
182
209
|
export type BaseFlagEvaluationOptions = {
|
|
210
|
+
/** Group types and keys to evaluate group-targeted flags against (for example `{ company: 'acme' }`). */
|
|
183
211
|
groups?: Record<string, string>
|
|
212
|
+
/** Person properties used instead of stored server properties. Include `$geoip_*` keys (such as `$geoip_country_code` and `$geoip_subdivision_1_code`) to evaluate GeoIP flags using the client's location. */
|
|
184
213
|
personProperties?: Properties
|
|
214
|
+
/** Group properties keyed by group type for evaluating group-targeted flags. */
|
|
185
215
|
groupProperties?: Record<string, Properties>
|
|
186
216
|
/** Skip remote fallback and omit flags that local definitions cannot resolve. */
|
|
187
217
|
onlyEvaluateLocally?: boolean
|
|
218
|
+
/** Overrides the client's `disableGeoip` setting for this evaluation call. */
|
|
188
219
|
disableGeoip?: boolean
|
|
189
220
|
}
|
|
190
221
|
export type FlagEvaluationOptions = BaseFlagEvaluationOptions & {
|
|
222
|
+
/** Whether this call sends `$feature_flag_called`, overriding the client's `sendFeatureFlagEvent` option. */
|
|
191
223
|
sendFeatureFlagEvents?: boolean
|
|
192
224
|
}
|
|
193
225
|
|
|
@@ -234,6 +266,24 @@ export type FeatureFlagBucketingIdentifier = 'distinct_id' | 'device_id' | '' |
|
|
|
234
266
|
*/
|
|
235
267
|
export type FeatureFlagEvaluationRuntime = 'all' | 'client' | 'server'
|
|
236
268
|
|
|
269
|
+
/**
|
|
270
|
+
* Why local evaluation couldn't resolve a flag.
|
|
271
|
+
*
|
|
272
|
+
* When more than one cause applies, the SDK reports the first matching reason in this order:
|
|
273
|
+
*
|
|
274
|
+
* | Reason | Cause |
|
|
275
|
+
* | --- | --- |
|
|
276
|
+
* | `experience_continuity` | The flag uses experience continuity, which local evaluation can't resolve. |
|
|
277
|
+
* | `unsupported_definition` | The flag uses a rule local evaluation doesn't support, such as a static cohort, an unknown operator, or a circular or missing dependency. |
|
|
278
|
+
* | `unresolved_dependency` | A dependency flag has a loaded definition but stayed unresolved. |
|
|
279
|
+
* | `missing_context` | The call didn't pass a person property, group property, or device ID the flag needs, or passed an unusable value. |
|
|
280
|
+
*/
|
|
281
|
+
export type UnresolvedFlagReason =
|
|
282
|
+
| 'experience_continuity'
|
|
283
|
+
| 'unsupported_definition'
|
|
284
|
+
| 'missing_context'
|
|
285
|
+
| 'unresolved_dependency'
|
|
286
|
+
|
|
237
287
|
export type BeforeSendFn = (event: EventMessage) => EventMessage | null
|
|
238
288
|
|
|
239
289
|
export type PostHogOptions = Omit<
|
|
@@ -248,6 +298,7 @@ export type PostHogOptions = Omit<
|
|
|
248
298
|
| 'disableCompression'
|
|
249
299
|
| 'requestTimeout'
|
|
250
300
|
> & {
|
|
301
|
+
/** Storage backend for client opt-out state and super properties. Node holds state in memory only, so it resets on restart. */
|
|
251
302
|
persistence?: 'memory'
|
|
252
303
|
/**
|
|
253
304
|
* Whether to strip URL fragments (`#...`) from automatically captured request URLs.
|
|
@@ -260,10 +311,9 @@ export type PostHogOptions = Omit<
|
|
|
260
311
|
*/
|
|
261
312
|
disable_capture_url_hashes?: boolean
|
|
262
313
|
/**
|
|
263
|
-
* Whether to disable GeoIP lookups for events and feature flag requests. When
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
* own `$geoip_disable` property.
|
|
314
|
+
* Whether to disable GeoIP lookups for events and feature flag requests. When `true`, every event gets `$geoip_disable: true` unless the event, its context, or `register()` sets `$geoip_disable`.
|
|
315
|
+
*
|
|
316
|
+
* Pass `disableGeoip: false` (here or per call) and set `$ip` in event `properties` to geolocate from a client IP. Setting `$ip` alone still skips GeoIP while `disableGeoip` is `true`.
|
|
267
317
|
*
|
|
268
318
|
* @default true
|
|
269
319
|
*/
|
|
@@ -485,6 +535,11 @@ export type PostHogOptions = Omit<
|
|
|
485
535
|
* can only add redaction. Defaults to false.
|
|
486
536
|
*/
|
|
487
537
|
privacyMode?: boolean
|
|
538
|
+
/**
|
|
539
|
+
* Attach process `uncaughtException` and `unhandledRejection` listeners to capture unhandled errors automatically.
|
|
540
|
+
*
|
|
541
|
+
* @default false
|
|
542
|
+
*/
|
|
488
543
|
enableExceptionAutocapture?: boolean
|
|
489
544
|
/**
|
|
490
545
|
* The interval in milliseconds between polls for refreshing feature flag definitions. Defaults to 30 seconds.
|
|
@@ -498,9 +553,15 @@ export type PostHogOptions = Omit<
|
|
|
498
553
|
* per user. When the cache is full the least recently used distinct ids are evicted. Defaults to 50000.
|
|
499
554
|
*/
|
|
500
555
|
maxCacheSize?: number
|
|
556
|
+
/**
|
|
557
|
+
* Custom HTTP transport replacing global `fetch`. Capture requests pass `redirect: 'manual'` and follow up to 5 same-origin `307` or `308` redirects, and a custom `fetch` that follows redirects itself still works.
|
|
558
|
+
*/
|
|
501
559
|
fetch?: (url: string, options: PostHogFetchOptions) => Promise<PostHogFetchResponse>
|
|
502
|
-
|
|
503
|
-
|
|
560
|
+
/**
|
|
561
|
+
* Whether to poll feature flag definitions for local evaluation when `secretKey`, `personalApiKey`, or `flagDefinitionCacheProvider` is set. Set to `false` when `secretKey` is only for `getRemoteConfigPayload()` or `emails`.
|
|
562
|
+
*
|
|
563
|
+
* @default true
|
|
564
|
+
*/
|
|
504
565
|
enableLocalEvaluation?: boolean
|
|
505
566
|
/**
|
|
506
567
|
* Optional cache provider for feature flag definitions.
|
|
@@ -776,29 +837,20 @@ export type FeatureFlagResult = {
|
|
|
776
837
|
|
|
777
838
|
export interface IPostHog {
|
|
778
839
|
/**
|
|
779
|
-
*
|
|
780
|
-
*
|
|
781
|
-
*
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
* @param event We recommend using [verb] [noun], like movie played or movie updated to easily identify what your events mean later on.
|
|
785
|
-
* @param properties OPTIONAL | which can be a object with any information you'd like to add
|
|
786
|
-
* @param groups OPTIONAL | object of what groups are related to this event, example: { company: 'id:5' }. Can be used to analyze companies instead of users.
|
|
787
|
-
* @param flags OPTIONAL | A `FeatureFlagEvaluations` snapshot from `evaluateFlags()`. Attaches those exact flag values to the event with no extra network call.
|
|
788
|
-
* @param sendFeatureFlags OPTIONAL | Deprecated — prefer `flags`. Fires a hidden `/flags` request on capture to enrich the event with flag values.
|
|
789
|
-
*/
|
|
790
|
-
capture({ distinctId, event, properties, groups, flags, sendFeatureFlags }: EventMessage): void
|
|
840
|
+
* Queue a custom event in memory to send asynchronously.
|
|
841
|
+
*
|
|
842
|
+
* @param props - Event payload including `event`, optional `distinctId`, `properties`, `groups`, `flags`, and `options`
|
|
843
|
+
*/
|
|
844
|
+
capture(props: EventMessage): void
|
|
791
845
|
|
|
792
846
|
/**
|
|
793
|
-
*
|
|
794
|
-
*
|
|
795
|
-
*
|
|
796
|
-
*
|
|
797
|
-
* @param
|
|
798
|
-
* @param flags OPTIONAL | A `FeatureFlagEvaluations` snapshot from `evaluateFlags()`. Attaches those exact flag values to the event with no extra network call.
|
|
799
|
-
* @param sendFeatureFlags OPTIONAL | Deprecated — prefer `flags`. Fires a hidden `/flags` request on capture to enrich the event with flag values.
|
|
847
|
+
* Capture an event and wait for the HTTP send attempt to settle. Use in short-lived runtimes where the process can freeze before a background flush.
|
|
848
|
+
*
|
|
849
|
+
* Don't mix queued `capture()` and `captureImmediate()` when event order matters.
|
|
850
|
+
*
|
|
851
|
+
* @param props - Event payload including `event`, optional `distinctId`, `properties`, `groups`, `flags`, and `options`
|
|
800
852
|
*/
|
|
801
|
-
captureImmediate(
|
|
853
|
+
captureImmediate(props: EventMessage): Promise<void>
|
|
802
854
|
|
|
803
855
|
/**
|
|
804
856
|
* @description Capture an exception as a $exception event.
|
|
@@ -815,87 +867,62 @@ export interface IPostHog {
|
|
|
815
867
|
captureExceptionImmediate(error: unknown, options?: CaptureExceptionOptions): Promise<void>
|
|
816
868
|
|
|
817
869
|
/**
|
|
818
|
-
*
|
|
819
|
-
*
|
|
820
|
-
*
|
|
821
|
-
*
|
|
822
|
-
* @param
|
|
823
|
-
* @param groups OPTIONAL | object of what groups are related to this event, example: { company: 'id:5' }. Can be used to analyze companies instead of users.
|
|
824
|
-
* @param flags OPTIONAL | A `FeatureFlagEvaluations` snapshot from `evaluateFlags()`. Attaches those exact flag values to the event with no extra network call.
|
|
825
|
-
* @param sendFeatureFlags OPTIONAL | Deprecated — prefer `flags`. Fires a hidden `/flags` request on capture to enrich the event with flag values.
|
|
870
|
+
* Capture an AI event on the dedicated AI capture endpoint (`/i/v1/ai/events`).
|
|
871
|
+
*
|
|
872
|
+
* Beta: the signature is stable, while operational limits (per-event size cap, batching, endpoint) may change without notice. Delivery is async with no redaction or truncation.
|
|
873
|
+
*
|
|
874
|
+
* @param props - AI event payload including `event`, optional `distinctId`, `properties`, `groups`, `flags`, and `options`
|
|
826
875
|
* @returns The event UUID, or `undefined` when the client is disabled
|
|
827
876
|
*/
|
|
828
|
-
captureAi(
|
|
877
|
+
captureAi(props: EventMessage): string | undefined
|
|
829
878
|
|
|
830
879
|
/**
|
|
831
|
-
*
|
|
832
|
-
*
|
|
833
|
-
* @param
|
|
834
|
-
* @param properties OPTIONAL | which can be a object with any information you'd like to add
|
|
835
|
-
* @param groups OPTIONAL | object of what groups are related to this event, example: { company: 'id:5' }. Can be used to analyze companies instead of users.
|
|
836
|
-
* @param flags OPTIONAL | A `FeatureFlagEvaluations` snapshot from `evaluateFlags()`. Attaches those exact flag values to the event with no extra network call.
|
|
837
|
-
* @param sendFeatureFlags OPTIONAL | Deprecated — prefer `flags`. Fires a hidden `/flags` request on capture to enrich the event with flag values.
|
|
880
|
+
* Capture an AI event on the dedicated AI capture endpoint (`/i/v1/ai/events`) and wait for the send attempt to settle.
|
|
881
|
+
*
|
|
882
|
+
* @param props - AI event payload including `event`, optional `distinctId`, `properties`, `groups`, `flags`, and `options`
|
|
838
883
|
* @returns The event UUID, or `undefined` when the client is disabled
|
|
839
884
|
*/
|
|
840
|
-
captureAiImmediate(
|
|
841
|
-
distinctId,
|
|
842
|
-
event,
|
|
843
|
-
properties,
|
|
844
|
-
groups,
|
|
845
|
-
flags,
|
|
846
|
-
sendFeatureFlags,
|
|
847
|
-
}: EventMessage): Promise<string | undefined>
|
|
885
|
+
captureAiImmediate(props: EventMessage): Promise<string | undefined>
|
|
848
886
|
|
|
849
887
|
/**
|
|
850
|
-
*
|
|
851
|
-
*
|
|
852
|
-
*
|
|
853
|
-
* @param distinctId which uniquely identifies your user
|
|
854
|
-
* @param properties with a dict with any key: value pairs
|
|
888
|
+
* Queue an `$identify` event setting person properties for `distinctId`. Match the `distinctId` passed to frontend `posthog.identify()` so client and server activity join to one person.
|
|
889
|
+
*
|
|
890
|
+
* @param data - Identify payload with `distinctId` and optional `properties` (`$set`, `$set_once`, `$anon_distinct_id`)
|
|
855
891
|
*/
|
|
856
|
-
identify(
|
|
892
|
+
identify(data: IdentifyMessage): void
|
|
857
893
|
|
|
858
894
|
/**
|
|
859
|
-
*
|
|
860
|
-
*
|
|
861
|
-
* @param distinctId
|
|
862
|
-
* @param properties with a dict with any key: value pairs
|
|
895
|
+
* Send an `$identify` event immediately and wait for the HTTP send attempt to settle.
|
|
896
|
+
*
|
|
897
|
+
* @param data - Identify payload with `distinctId` and optional `properties` (`$set`, `$set_once`, `$anon_distinct_id`)
|
|
863
898
|
*/
|
|
864
|
-
identifyImmediate(
|
|
899
|
+
identifyImmediate(data: IdentifyMessage): Promise<void>
|
|
865
900
|
|
|
866
901
|
/**
|
|
867
|
-
*
|
|
868
|
-
*
|
|
869
|
-
* @param properties properties
|
|
870
|
-
* @param propertiesOnce properties to set once on the person profile
|
|
902
|
+
* Queue a `$set` event to set or set-once properties on a person profile.
|
|
903
|
+
*
|
|
904
|
+
* @param data - Distinct ID and properties (`properties` for `$set`, `propertiesOnce` for `$set_once`)
|
|
871
905
|
*/
|
|
872
|
-
setPersonProperties(
|
|
906
|
+
setPersonProperties(data: SetPersonPropertiesMessage): void
|
|
873
907
|
|
|
874
908
|
/**
|
|
875
|
-
*
|
|
876
|
-
*
|
|
877
|
-
* @param
|
|
909
|
+
* Queue a `$set` event carrying `$unset` to remove properties from a person profile.
|
|
910
|
+
*
|
|
911
|
+
* @param data - Distinct ID and property key or array of keys to remove
|
|
878
912
|
*/
|
|
879
|
-
unsetPersonProperties(
|
|
913
|
+
unsetPersonProperties(data: UnsetPersonPropertiesMessage): void
|
|
880
914
|
|
|
881
915
|
/**
|
|
882
|
-
*
|
|
883
|
-
*
|
|
884
|
-
*
|
|
885
|
-
* In a purely back-end implementation, this means whenever an anonymous user does something, you'll want to send a session ID with the capture call.
|
|
886
|
-
* Then, when that users signs up, you want to do an alias call with the session ID and the newly created user ID.
|
|
887
|
-
* The same concept applies for when a user logs in. If you're using PostHog in the front-end and back-end,
|
|
888
|
-
* doing the identify call in the frontend will be enough.:
|
|
889
|
-
* @param distinctId the current unique id
|
|
890
|
-
* @param alias the unique ID of the user before
|
|
916
|
+
* Queue a `$create_alias` event linking `alias` (the previous or secondary ID) to `distinctId` (the primary user ID).
|
|
917
|
+
*
|
|
918
|
+
* @param data - Primary `distinctId`, previous `alias`, and optional `disableGeoip` or `options`
|
|
891
919
|
*/
|
|
892
920
|
alias(data: { distinctId: string; alias: string; disableGeoip?: boolean; options?: EventOptions }): void
|
|
893
921
|
|
|
894
922
|
/**
|
|
895
|
-
*
|
|
896
|
-
*
|
|
897
|
-
* @param distinctId
|
|
898
|
-
* @param alias the unique ID of the user before
|
|
923
|
+
* Send a `$create_alias` event immediately to link `alias` to `distinctId`.
|
|
924
|
+
*
|
|
925
|
+
* @param data - Primary `distinctId`, previous `alias`, and optional `disableGeoip` or `options`
|
|
899
926
|
*/
|
|
900
927
|
aliasImmediate(data: {
|
|
901
928
|
distinctId: string
|
|
@@ -1096,24 +1123,18 @@ export interface IPostHog {
|
|
|
1096
1123
|
evaluateFlags(distinctId: string, options?: AllFlagsOptions): Promise<FeatureFlagEvaluations>
|
|
1097
1124
|
|
|
1098
1125
|
/**
|
|
1099
|
-
*
|
|
1100
|
-
* using my product in PostHog.
|
|
1126
|
+
* Queue a `$groupidentify` event to create or update group properties (up to 5 group types per project). Set `name` in `properties` for the UI display name.
|
|
1101
1127
|
*
|
|
1102
|
-
* @param
|
|
1103
|
-
* @param groupKey Unique identifier for that type of group (ex: 'id:5')
|
|
1104
|
-
* @param properties OPTIONAL | which can be a object with any information you'd like to add
|
|
1128
|
+
* @param data - Group identify payload with `groupType`, `groupKey`, optional `properties`, `distinctId`, and `options`
|
|
1105
1129
|
*/
|
|
1106
|
-
groupIdentify(
|
|
1130
|
+
groupIdentify(data: GroupIdentifyMessage): void
|
|
1107
1131
|
|
|
1108
1132
|
/**
|
|
1109
|
-
*
|
|
1110
|
-
* sending is not preferable. Do not mix immediate and non-immediate calls.
|
|
1133
|
+
* Send a `$groupidentify` event immediately and wait for the HTTP send attempt to settle.
|
|
1111
1134
|
*
|
|
1112
|
-
* @param
|
|
1113
|
-
* @param groupKey Unique identifier for that type of group (ex: 'id:5')
|
|
1114
|
-
* @param properties OPTIONAL | which can be a object with any information you'd like to add
|
|
1135
|
+
* @param data - Group identify payload with `groupType`, `groupKey`, optional `properties`, `distinctId`, and `options`
|
|
1115
1136
|
*/
|
|
1116
|
-
groupIdentifyImmediate(
|
|
1137
|
+
groupIdentifyImmediate(data: GroupIdentifyMessage): Promise<void>
|
|
1117
1138
|
|
|
1118
1139
|
/**
|
|
1119
1140
|
* @description Force an immediate reload of the polled feature flags. Please note that they are
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "6.2.
|
|
1
|
+
export const version = "6.2.2"
|