Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Del all assignments #2436

Merged
merged 4 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/client/React/_reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<string, unknown>` - JSON object, generated by a Statsig Server SDK. See [Server Side Rendering](#ssr).

Expand Down
2 changes: 1 addition & 1 deletion docs/client/ReactNative/_reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/client/Roku/_initialize.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Next, you can initialize the library in your init() function, and add a listener
m.statsig.initialize("<STATSIG_CLIENT_SDK_KEY>", 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:
Expand Down
6 changes: 3 additions & 3 deletions docs/client/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion docs/experiments-plus/differential-impact-detection.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.

---

Expand Down
2 changes: 1 addition & 1 deletion docs/experiments-plus/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
18 changes: 17 additions & 1 deletion docs/faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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 server your needs.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small typo: "server" should be "serve" in "may server your needs"

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: Change server to serve since it's being used as a verb ("may serve your needs")

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.


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).
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Python SDK link incorrectly points to node-js-server-sdk repository. Please update it to reference the Python SDK repository at statsig-io/python-sdk to ensure users can find the correct implementation details.

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.


```node
const assignments = statsig.getClientInitializeResponse(userObj, "client-key", {hash: "none"});
```

---

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/logging-events.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
4 changes: 2 additions & 2 deletions docs/integrations/data-connectors/segment.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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`
Expand Down
2 changes: 1 addition & 1 deletion docs/integrations/data-imports/azure_upload-deprecated.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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:

```
{
Expand Down
2 changes: 1 addition & 1 deletion docs/integrations/data-imports/redshift-deprecated.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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:

```
{
Expand Down
4 changes: 2 additions & 2 deletions docs/integrations/openai.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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():

Expand Down
2 changes: 1 addition & 1 deletion docs/integrations/snippets/integration_event_formats.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
2 changes: 1 addition & 1 deletion docs/integrations/snippets/stitch_event_formats.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
2 changes: 1 addition & 1 deletion docs/sdks/client-vs-server.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/server/concepts/user.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion docs/session-replay/install.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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:

<Tabs
groupId="session-replay-js-framework"
Expand Down
Loading
Loading