diff --git a/docs/client/React/_reference.mdx b/docs/client/React/_reference.mdx index 140422afb..7b2a81d74 100644 --- a/docs/client/React/_reference.mdx +++ b/docs/client/React/_reference.mdx @@ -56,7 +56,7 @@ The StatsigProvider is a [react context provider](https://reactjs.org/docs/conte - `children: React.ReactNode | React.ReactNode[]` - One or more child components - `sdkKey: string` - A client SDK key from the Statsig Console -- `user: StatsigUser` - A [StatsigUser](/client/concepts/user) object. Changing this will update the experiment and gate values, causing a re-initialization and rerender +- `user: StatsigUser` - A [StatsigUser](/server/concepts/user) object. Changing this will update the experiment and gate values, causing a re-initialization and rerender - `options?: StatsigOptions` - See [StatsigOptions](/client/deprecated/reactSDK#statsig-options). An optional bag of initialization properties (mostly shared with the statsig-js sdk) for advanced configuration. - `waitForInitialization?: boolean` - - `initializingComponent?: React.ReactNode | React.ReactNode[]` - A loading component to render if and only if `waitForInitialization` is set to `true` and the SDK is initializing @@ -70,7 +70,7 @@ also be leveraged for apps that do not require loading states. - `children: React.ReactNode | React.ReactNode[]` - One or more child components - `sdkKey: string` - A client SDK key from the Statsig Console -- `user: StatsigUser` - A [StatsigUser](/client/concepts/user) object. Changing this will update the experiment and gate values, causing a re-initialization and rerender +- `user: StatsigUser` - A [StatsigUser](/server/concepts/user) object. Changing this will update the experiment and gate values, causing a re-initialization and rerender - `options?: StatsigOptions` - See [StatsigOptions](/client/deprecated/reactSDK#statsig-options). An optional bag of initialization properties (mostly shared with the statsig-js sdk) for advanced configuration. - `initializeValues: Record` - JSON object, generated by a Statsig Server SDK. See [Server Side Rendering](#ssr). diff --git a/docs/client/ReactNative/_reference.mdx b/docs/client/ReactNative/_reference.mdx index 0c66b55f0..6a143a254 100644 --- a/docs/client/ReactNative/_reference.mdx +++ b/docs/client/ReactNative/_reference.mdx @@ -14,7 +14,7 @@ StatsigProvider is a [react context provider](https://reactjs.org/docs/context.h - `children: React.ReactNode | React.ReactNode[];` - One or more child components - `sdkKey: string;` - A client SDK key from the Statsig Console -- `user: StatsigUser;` - A [Statsig User](/client/concepts/user) object. Changing this will update the user and Gate values, causing a re-initialization +- `user: StatsigUser;` - A [Statsig User](/server/concepts/user) object. Changing this will update the user and Gate values, causing a re-initialization - `options?: StatsigOptions;` - See [StatsigOptions](/client/deprecated/reactNativeSDK#statsig-options). An optional bag of initialization properties (shared with the statsig-js sdk) for advanced configuration. - `waitForInitialization?: boolean;` - Waits for the SDK to initialize with updated values before rendering child components - `initializingComponent?: React.ReactNode | React.ReactNode[];` - A loading component to render iff waitForInitialization is set to true and the SDK is initializing diff --git a/docs/client/Roku/_initialize.mdx b/docs/client/Roku/_initialize.mdx index c51fe8ed4..79a7fd80d 100644 --- a/docs/client/Roku/_initialize.mdx +++ b/docs/client/Roku/_initialize.mdx @@ -26,7 +26,7 @@ Next, you can initialize the library in your init() function, and add a listener m.statsig.initialize("", user) ``` -For more information on all of the user fields you can use, see the [StatsigUser docs](/client/concepts/user). +For more information on all of the user fields you can use, see the [StatsigUser docs](/server/concepts/user). Before the SDK has loaded the updated values, all APIs will return default values (false for gates, empty configs and experiments). To implement a callback handler for statsig being ready, and tell the SDK to load the updated values in the `onStatsigReady` function observed above: diff --git a/docs/client/introduction.mdx b/docs/client/introduction.mdx index 4cdca7481..a48791831 100644 --- a/docs/client/introduction.mdx +++ b/docs/client/introduction.mdx @@ -15,12 +15,12 @@ As shown in the diagram below, implementing an experiment using a Statsig client ### 1. Initialization -- The client SDK's `initialize` call takes the **client SDK key** and a [**StatsigUser**](/client/concepts/user) object. First, it checks for cached values from a previous initialize in local storage, and then it makes a network request to Statsig servers; this network call fetches precomputed configuration parameters for the specified user from Statsig servers and stores these parameters in local storage on the client device. +- The client SDK's `initialize` call takes the **client SDK key** and a [**StatsigUser**](/server/concepts/user) object. First, it checks for cached values from a previous initialize in local storage, and then it makes a network request to Statsig servers; this network call fetches precomputed configuration parameters for the specified user from Statsig servers and stores these parameters in local storage on the client device. If the request fails, the previous cached values are used. - Statsig's server latency to service `initialize` calls is generally 10ms (p50); the latency for given client may vary depending on how far the device is from Statsig's servers; the client SDK has a built-in timeout of 3 seconds that you can configure using **StatsigOptions** when you initialize the SDK -- The [**StatsigUser**](/client/concepts/user) object that you provide in the `initialize` call should include the user identifier, _userID_, that you use to identify the end-user of your application; the client SDK also generates a device identifier called _stableID_ to enable experiments where users aren’t signed in and a _userID_ is not available; you can choose to override this _stableID_ through **StatsigOptions** using the _overrideStableID_ parameter when you initialize the SDK +- The [**StatsigUser**](/server/concepts/user) object that you provide in the `initialize` call should include the user identifier, _userID_, that you use to identify the end-user of your application; the client SDK also generates a device identifier called _stableID_ to enable experiments where users aren’t signed in and a _userID_ is not available; you can choose to override this _stableID_ through **StatsigOptions** using the _overrideStableID_ parameter when you initialize the SDK ### 2. Checking an Experiment @@ -49,7 +49,7 @@ If the request fails, the previous cached values are used. :::info Best Practices -**Using [**StatsigUser**](/client/concepts/user)** +**Using [**StatsigUser**](/server/concepts/user)** Learn how to use [StatsigUser](/server/concepts/user) while using a client SDK. diff --git a/docs/experiments-plus/differential-impact-detection.md b/docs/experiments-plus/differential-impact-detection.md index 0fadac771..1475f3839 100644 --- a/docs/experiments-plus/differential-impact-detection.md +++ b/docs/experiments-plus/differential-impact-detection.md @@ -11,7 +11,7 @@ Statsig will automatically flag experiments when extreme differential impacts ar ![image](https://github.com/user-attachments/assets/9783ba7a-812b-4fea-97af-4e3344f8345f) ## Enabling this -On Statsig Warehouse Native, configure the "Segments of Interest" you want automatically evaluated for Differential Impact Detection. These will either have to be configured as [Entity Properties](/statsig-warehouse-native/features/entity-properties) or passed in by a Statsig SDK as user properties in the [User Object](/client/concepts/user). +On Statsig Warehouse Native, configure the "Segments of Interest" you want automatically evaluated for Differential Impact Detection. These will either have to be configured as [Entity Properties](/statsig-warehouse-native/features/entity-properties) or passed in by a Statsig SDK as user properties in the [User Object](/server/concepts/user). ![image](https://github.com/user-attachments/assets/c1bc4f51-2c8c-4db7-87f5-7a883f7e0fcf) diff --git a/docs/experiments-plus/experimentation/choosing-randomization-unit.md b/docs/experiments-plus/experimentation/choosing-randomization-unit.md index b253077e7..1e1b23c60 100644 --- a/docs/experiments-plus/experimentation/choosing-randomization-unit.md +++ b/docs/experiments-plus/experimentation/choosing-randomization-unit.md @@ -22,7 +22,7 @@ across sessions and devices. It doesn't depend on client-side cookies, which may --- **Learn More** -You can supply a user ID as part of the ``StatsigUser`` object when you implement an feature gate or experiment on Statsig. See [Statsig Docs](/client/concepts/user) to learn more. +You can supply a user ID as part of the ``StatsigUser`` object when you implement an feature gate or experiment on Statsig. See [Statsig Docs](/server/concepts/user) to learn more. --- diff --git a/docs/experiments-plus/introduction.md b/docs/experiments-plus/introduction.md index 820e69e4c..020caf5aa 100644 --- a/docs/experiments-plus/introduction.md +++ b/docs/experiments-plus/introduction.md @@ -80,7 +80,7 @@ Advantages: - Persistent across sessions and devices. - Independent of client-side cookies, which can be cleared by users. -For more details on using User IDs with Statsig, see [Statsig Docs on User Identifiers](/client/concepts/user). +For more details on using User IDs with Statsig, see [Statsig Docs on User Identifiers](/server/concepts/user). ### 2. Device Identifiers diff --git a/docs/faq.mdx b/docs/faq.mdx index 504ea7d9f..0cb2c51b0 100644 --- a/docs/faq.mdx +++ b/docs/faq.mdx @@ -65,7 +65,23 @@ For details on flushing, check the [Node.js Server SDK documentation](/server/no --- ### I don't see my client or server language listed. Can I still use Statsig? -If none of our current SDKs meet your needs, please let us know via our [Slack community](https://statsig.com/slack)! +If none of our current SDKs meet your needs, please let us know via our [Slack community](https://statsig.com/slack)! + +--- + +### How do I get all exposures for a user? + +If you're interested in historical exposures, the console's [users tab](https://console.statsig.com/users) may serve your needs. + +If you need all hypothetical assignments, you can consider using the `getClientInitializeResponse` server sdk method. Statsig's SDKs should ideally be invoked at the time you're serving an experiment treatment, so that an exposure can be logged. If that's not possible in your case (perhaps you need to pass assignment information to other applications, or to use assignment information as cache-keys for the CDN + edge), this approach could work. + +#### Example of capturing all assignments in Node + +Note, this method is designed to [bootstrap](/client/concepts/bootstrapping) client SDKs, and as such, will hash the experiment and feature keys returned in the payload, obfuscating their names for security. You can provide an optional `hash` parameter, allowing you to disable hashing and capture all values in plain text: [Node](https://github.com/statsig-io/node-js-server-sdk/blob/ea116142221c1aa83b46eff8b5f2292c8f8e2d54/src/StatsigServer.ts#L597), [Python](https://github.com/statsig-io/node-js-server-sdk/blob/ea116142221c1aa83b46eff8b5f2292c8f8e2d54/src/StatsigServer.ts#L597), [Java](https://github.com/statsig-io/java-server-sdk/blob/7443c357c78616142de9257af9e4c55c877ca700/src/main/kotlin/com/statsig/sdk/StatsigServer.kt#L83), [Go](https://github.com/statsig-io/go-sdk/blob/3d7edcbe468efb0fc7a04b0d10202243403dce5f/client.go#L282). + +```node +const assignments = statsig.getClientInitializeResponse(userObj, "client-key", {hash: "none"}); +``` --- diff --git a/docs/guides/logging-events.mdx b/docs/guides/logging-events.mdx index 595f158bf..34ba5663a 100644 --- a/docs/guides/logging-events.mdx +++ b/docs/guides/logging-events.mdx @@ -18,7 +18,7 @@ For general guidance on event logging and core concepts, read on, or jump to the ## Identifying Users and the "StatsigUser" object {#identifying-users} Many analytics platforms have a concept of "identifying" a user. In Statsig, this is the StatsigUser object that is set a initialization time in client SDKs, or with each event in Server SDKs. -The [`StatsigUser`](/client/concepts/user) is a set of properties that describe the user. It roughly has the same json definition across all SDKs and integrations: +The [`StatsigUser`](/server/concepts/user) is a set of properties that describe the user. It roughly has the same json definition across all SDKs and integrations: ```json { diff --git a/docs/integrations/data-connectors/segment.mdx b/docs/integrations/data-connectors/segment.mdx index 8151efc49..0cd94b90d 100644 --- a/docs/integrations/data-connectors/segment.mdx +++ b/docs/integrations/data-connectors/segment.mdx @@ -157,7 +157,7 @@ Refer to the following diagram to help orient you to mapping `anonymousIds` in S ![](https://user-images.githubusercontent.com/125311112/283278011-3c22e6e8-ab36-4844-aee2-b6630ecda4de.png) -1. Initialize the Statsig SDK with your [Statsig User](/client/concepts/user) which will contain an optional `userID` value and a `customID` that you've created in the Statsig UI - `segmentAnonymousId` in this example. +1. Initialize the Statsig SDK with your [Statsig User](/server/concepts/user) which will contain an optional `userID` value and a `customID` that you've created in the Statsig UI - `segmentAnonymousId` in this example. 2. As you orchestrate features/experiments, Statsig will associate this user to a variant using the unit of randomization chosen. For anonymous users, we'll use `segmentAnonymousId`. 3. Your existing Segment implementation tracks user traffic and associates anonymous users to the top-level field `anonymousId`. 4. This `anonymousId` is mapped in Statsig (to `segmentAnonymousId`), properly associating the identifier used in experiment exposures to the same identifier used to track user actions. @@ -172,7 +172,7 @@ By using [Segment Engage Audiences](https://segment.com/docs/engage/audiences/) Once these steps have been completed, your Segment Audience will be synced, and you will be able to target those users for features you develop or experiments you run. ### Custom Properties -Passing [custom properties to a Statsig User](/client/concepts/user#user-attributes) (see `custom` field) enables targeting on specific cohorts of your users in feature gates and experimentation. +Passing [custom properties to a Statsig User](/server/concepts/user#user-attributes) (see `custom` field) enables targeting on specific cohorts of your users in feature gates and experimentation. Providing custom user properties also allows you to drill down your results to specific populations (ex: android/iOS, isVIP, etc) when [reading pulse results](/pulse/custom-queries#running-a-custom-query). If you're using custom fields to [target users](/feature-flags/conditions#custom) in your feature gates, you can provide these properties through Segment using the key `statsigCustom` as part of the Segment `properties` diff --git a/docs/integrations/data-imports/azure_upload-deprecated.mdx b/docs/integrations/data-imports/azure_upload-deprecated.mdx index 4022d9eb2..e4c4d6c7b 100644 --- a/docs/integrations/data-imports/azure_upload-deprecated.mdx +++ b/docs/integrations/data-imports/azure_upload-deprecated.mdx @@ -40,7 +40,7 @@ Please make sure your data conforms to the following schemas. | timeuuid | A unique UUID or timeUUID used for deduping. If omitted, will be generated but will not be effective for deduping | UUID format | ``` -Please refer to docs for the [Statsig User Object](/client/concepts/user#user-attributes) for available fields. An example would look like: +Please refer to docs for the [Statsig User Object](/server/concepts/user#user-attributes) for available fields. An example would look like: ``` { diff --git a/docs/integrations/data-imports/redshift-deprecated.mdx b/docs/integrations/data-imports/redshift-deprecated.mdx index f6add15e8..be86e8ce9 100644 --- a/docs/integrations/data-imports/redshift-deprecated.mdx +++ b/docs/integrations/data-imports/redshift-deprecated.mdx @@ -57,7 +57,7 @@ Please make sure your data conforms to the following schemas. | timeuuid | A unique UUID or timeUUID used for deduping. If omitted, will be generated but will not be effective for deduping | UUID format | ``` -Please refer to docs for the [Statsig User Object](/client/concepts/user#user-attributes) for available fields. An example would look like: +Please refer to docs for the [Statsig User Object](/server/concepts/user#user-attributes) for available fields. An example would look like: ``` { diff --git a/docs/integrations/openai.md b/docs/integrations/openai.md index b73481490..2683357de 100644 --- a/docs/integrations/openai.md +++ b/docs/integrations/openai.md @@ -31,7 +31,7 @@ import time openai.api_key = "your_openai_key" # Replace with your own key statsig.initialize("your_statsig_secret") # Replace with your Statsig secret -user = StatsigUser("user-id") #This is a placeholder ID - in a normal experiment Statsig recommends using a user's actual unique ID for consistency in targeting. See https://docs.statsig.com/client/concepts/user +user = StatsigUser("user-id") #This is a placeholder ID - in a normal experiment Statsig recommends using a user's actual unique ID for consistency in targeting. See https://docs.statsig.com/server/concepts/user ``` ### The ask_question Function @@ -121,7 +121,7 @@ import time openai.api_key = "your_openai_key" statsig.initialize("your_statsig_secret") -user = StatsigUser("user-id") #This is a placeholder ID - in a normal experiment Statsig recommends using a user's actual unique ID for consistency in targeting. See https://docs.statsig.com/client/concepts/user +user = StatsigUser("user-id") #This is a placeholder ID - in a normal experiment Statsig recommends using a user's actual unique ID for consistency in targeting. See https://docs.statsig.com/server/concepts/user def ask_question(): diff --git a/docs/integrations/snippets/integration_event_formats.mdx b/docs/integrations/snippets/integration_event_formats.mdx index 822654436..550f1f718 100644 --- a/docs/integrations/snippets/integration_event_formats.mdx +++ b/docs/integrations/snippets/integration_event_formats.mdx @@ -5,7 +5,7 @@ Events will be sent in batches in a JSON format. The structure of a Statsig Even | Field | Type | Description | | --------------- | ------ | -------------------------------------------------------------------- | | eventName | String | Name of the event provided | -| user | JSON | [Statsig User Object](https://docs.statsig.com/client/concepts/user) | +| user | JSON | [Statsig User Object](https://docs.statsig.com/server/concepts/user) | | userID | String | User ID provided | | timestamp | Number | Timestamp in MS of the event | | value | String | Value of the event provided | diff --git a/docs/integrations/snippets/stitch_event_formats.mdx b/docs/integrations/snippets/stitch_event_formats.mdx index fb3587b4d..f351a16c1 100644 --- a/docs/integrations/snippets/stitch_event_formats.mdx +++ b/docs/integrations/snippets/stitch_event_formats.mdx @@ -5,7 +5,7 @@ Events will be sent in batches in a JSON format. The structure of a Statsig Even | Field | Type | Description | | --------------- | ------ | ------------------------------------------------------------------------------------------------ | | event | String | Name of the event provided | -| user | JSON | [Statsig User Object](/client/concepts/user) | +| user | JSON | [Statsig User Object](/server/concepts/user) | | userId | String | User ID provided | | stableId | String | Stable ID | | timestamp | Number | Timestamp in MS of the event | diff --git a/docs/sdks/client-vs-server.mdx b/docs/sdks/client-vs-server.mdx index 153af64a2..6ebf5ec50 100644 --- a/docs/sdks/client-vs-server.mdx +++ b/docs/sdks/client-vs-server.mdx @@ -38,7 +38,7 @@ At a high level, here are some of the key differences between the two types of S **Client SDKs:** - Use a **client SDK key** -- Take a [StatsigUser](/client/concepts/user) object +- Take a [StatsigUser](/server/concepts/user) object - Check for cached values in local storage - Fetch precomputed configuration parameters for the specified user diff --git a/docs/server/concepts/user.mdx b/docs/server/concepts/user.mdx index 33401205c..158543f04 100644 --- a/docs/server/concepts/user.mdx +++ b/docs/server/concepts/user.mdx @@ -114,7 +114,7 @@ In Server SDKs, a StatsigUser with a userID (or customID) is required for checkG Still don't want to pass an ID? Here are our suggestions for different use cases: 1. If you plan to only use one/off feature gates, or non-percent-based rules (like countries) -While you're still losing functionality, you can **pass any non-empty identifier, hard coded string, or **a random ID less than 100 if you do not have the actual user ID.** Don't pass a purely random ID - as we won't be able to dedupe your events, you'll explode your event usage, and your Statsig bill. +While you're still losing functionality, you can pass any non-empty identifier, hard coded string, or **a random ID less than 100 if you do not have the actual user ID.** Don't pass a purely random ID - as we won't be able to dedupe your events, you'll explode your event usage, and your Statsig bill. 2. If you want to rollout a feature partially, check for regressions, then roll out to everyone, you must pass an ID in your checkGate/getConfig/getExperiment calls, as well as any logEvent calls you make. Otherwise, we're not able to attribute the events you log to the correct users who saw or didn't see your new feature, or calculate metrics correctly to help you see any regressions. diff --git a/docs/session-replay/install.mdx b/docs/session-replay/install.mdx index 98327539e..d2b7afb2d 100644 --- a/docs/session-replay/install.mdx +++ b/docs/session-replay/install.mdx @@ -71,7 +71,7 @@ yarn add @statsig/session-replay @statsig/web-analytics @statsig/react-bindings We recommend using autocapture as a great way to get started, but if you don’t want to automatically log and send events, you can remove the runStatsigAutoCapture option from the Javascript snippet or skip the `@statsig/web-analytics` package installation. -Next, following the [instructions for the Statsig Javascript SDK](/client/javascript-sdk), initialize Statsig with your SDK key, [user](/client/concepts/user) and options: +Next, following the [instructions for the Statsig Javascript SDK](/client/javascript-sdk), initialize Statsig with your SDK key, [user](/server/concepts/user) and options: