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

Niko/node new template #547

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f0c924d
Updating versions and lock
nikomancy Dec 5, 2024
cbcc809
Updating mdx-js dep
nikomancy Dec 5, 2024
d85d6ca
Fixing prismjs theme import.
nikomancy Dec 5, 2024
573235b
Updating package, lock, and config for 3.x Katex support.
nikomancy Dec 5, 2024
8191af9
Changing SDK docs over to mdx and correcting 3.x upgrade breaking cha…
nikomancy Dec 5, 2024
5f5078a
Fixing more 3.x update breaking changess.
nikomancy Dec 5, 2024
c4c38fe
Last couple of new MDX syntax errors from 3.x upgrade.
nikomancy Dec 5, 2024
415dae4
Fixing broken links.
nikomancy Dec 5, 2024
a2abf18
Link fix
nikomancy Dec 5, 2024
26bfa82
add precomputed assignments documentation for JS client (#541)
leoromanovsky Dec 5, 2024
17705de
typo subject attributes
leoromanovsky Dec 5, 2024
3d4b060
Update precomputed-assignments.mdx evaluation example (#544)
leoromanovsky Dec 6, 2024
0ebd6dc
Merge branch 'main' into niko/upgrade-docusaurus2-to-docusaurus3
nikomancy Dec 7, 2024
c86656c
Fixing MDX syntax issue.
nikomancy Dec 7, 2024
a1e64f1
Adding intro.
nikomancy Dec 9, 2024
872f8e1
add precomputed assignments documentation for JS client (#541)
leoromanovsky Dec 5, 2024
52bace7
Copying Client JS to
nikomancy Dec 9, 2024
238ee35
Removing client only topics.
nikomancy Dec 9, 2024
acc8d66
* Adding initialization with edits for node specific details.
nikomancy Dec 9, 2024
16da6d2
* Creating assginments page.
nikomancy Dec 9, 2024
ce270d3
* Adding bandits.
nikomancy Dec 9, 2024
f50a16e
* ategory.json to make the new docs show up in the TOC.
nikomancy Dec 9, 2024
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/data-management/metrics/simple-metric.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,12 @@ where fact_timestamp >= assignment_timestamp + X days
and assignment_timestamp < current_date - X days
```

Additionally, a maximum number of days (Y) can be set on the retention period by enabling "add a timeframe to aggregate". When this is enabled, the aggregation will include events by subjects after the minimum number of days defined by the retention period (>=X) and before the max timeframe to aggregate (<Y).
Additionally, a maximum number of days (Y) can be set on the retention period by enabling "add a timeframe to aggregate". When this is enabled, the aggregation will include events by subjects after the minimum number of days defined by the retention period (>=X) and before the max timeframe to aggregate (`<Y`).


#### Conversion

Conversion metrics measure the proportion of entities with at least one fact event within a fixed number of days (X) from experiment assignment. For example, a 7-day conversion metric would measure the proportion of users who sign up for a free trial within 7 days of being assigned to the experiment.
Conversion metrics measure the proportion of entities with at least one fact event within a fixed number of days (`X`) from experiment assignment. For example, a 7-day conversion metric would measure the proportion of users who sign up for a free trial within 7 days of being assigned to the experiment.

$\frac{\text{Number of entities with a non-NULL fact within X days}}{\text{Number of unique entities assigned}}$

Expand Down
2 changes: 1 addition & 1 deletion docs/feature-flagging/concepts/audiences.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Audiences allow you to easily define reusable targeting criteria such that you d
![Audience page](/img/feature-flagging/audiences/audience-overview.png)

## Creating an Audience
In the Configuration section, click the "Create" button and select "Audience". Input a title, description (optional), and the [targeting rules](/feature-flagging/concepts/targeting.md).
In the Configuration section, click the "Create" button and select "Audience". Input a title, description (optional), and the [targeting rules](/feature-flagging/concepts/targeting).

![Creating an Audience](/img/feature-flagging/audiences/create-audience.png)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Each rule may have multiple conditions. The rule is only satisfied if all the co

| Operator | Attribute Type | Meaning |
| :----------------------------------------------------------------------------------------- | :---------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| greater than (>), less than (<), greater than or equal to (>=), less than or equal to (<=) | number, SemVer | Numeric comparison |
| greater than (`>`), less than (`<`), greater than or equal to (`>=`), less than or equal to (`<=`) | number, SemVer | Numeric comparison |
| matches regex | string | Regular expression match |
| one of / not one of | string, number, boolean | Is one of (or not one of) an array of strings. Non-string inputs (number and boolean) are cast to string before performing the comparison. Comparisons are case-sensitive. |

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/marketing/integrating-with-shopify.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ You can use JavaScript to initialize the SDK and check the status of the feature
- Replace `"<YOUR-SDK-KEY>"` with the [SDK key](/sdks/sdk-keys/) you created in Eppo.
- Replace `"<YOUR-FLAG-KEY>"` with the specific [flag key](/feature-flag-quickstart/#create-a-flag) you configured in Eppo for the feature.
- Replace `"<YOUR-SUBJECT-KEY>"` with the id you are using to randomize users. This can be a cookie id, device id, or an id from your analytics platform such as Heap or Rudderstack to name a few. We encourage our customers to keep this id consistent to ensure that bucketing remains consistent. If you will randomizing users who are logged out, see our guidance here on [Subject Keys in a Pre-Authenticated Experiment](/guides/engineering/preauth-experiments/).
- The Eppo client stores your flag configuration locally; it remains available for as many calls, flags and users as you need. You can refresh the cached configuration as often as you need to update flags by setting the `intervalmaxCacheAgeSeconds`. Shopify Classic is not a single-page app. You do not need to re-instantiate the client for every page, but by refreshing the local client, you keep each new page load up-to-date with your configuration. In this example we have arbitrarily set `intervalmaxCacheAgeSeconds` to `180` seconds, which will wait 180 seconds before refreshing the Eppo configuration from our CDN. Feel free to update this interval whatever time frame makes sense for your use case. Read more about the advanced initialization options [here](/sdks/client-sdks/javascript/initialization).
- The Eppo client stores your flag configuration locally; it remains available for as many calls, flags and users as you need. You can refresh the cached configuration as often as you need to update flags by setting the `intervalmaxCacheAgeSeconds`. Shopify Classic is not a single-page app. You do not need to re-instantiate the client for every page, but by refreshing the local client, you keep each new page load up-to-date with your configuration. In this example we have arbitrarily set `intervalmaxCacheAgeSeconds` to `180` seconds, which will wait 180 seconds before refreshing the Eppo configuration from our CDN. Feel free to update this interval whatever time frame makes sense for your use case. Read more about the advanced initialization options [here](/sdks/client-sdks/javascript/Initialization).

### **Shopify Hydrogen (React-Based Storefront)**

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/migrations/optimizely-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
});
```

*[Eppo](/sdks/client-sdks/javascript/initialization):*
*[Eppo](/sdks/client-sdks/javascript/Initialization):*

```tsx
await init({
Expand Down
16 changes: 0 additions & 16 deletions docs/reference/webhook.md

This file was deleted.

88 changes: 88 additions & 0 deletions docs/reference/webhook.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Experiment Update Webhook

Webhooks let your integrations take action in response to events that occur in Eppo. The Experiment Update Webhook is a good solution when a custom application needs to display or take action on the most up to date state of an experiment.

## Webhook Events
The webhook sends four types of experiment update events. If you only want to take action based on certain types of events, you can filter to just the events you are interested in subscribing to based on their event type in the request body.

### Experiment Metric Updated
**Triggers when:**
- Metric is added or removed
- Metric collection is added or removed

**Request body:**

```json
{
"event": "experiment.metric.updated",
"data": {
"experiment_id": "<experiment_id>",
"experiment_key": "<experiment_key>"
},
"signature": "<signature>"
}
```

### Experiment Configuration Updated
**Triggers when:**
- User edits any configuration

**Request body:**

```json
{
"event": "experiment.configuration.updated",
"data": {
"experiment_id": "<experiment_id>",
"experiment_key": "<experiment_key>"
},
"signature": "<signature>"
}
```

### Experiment Status Updated
**Triggers when:**
- Experiment's status changes

**Request body:**

```json
{
"event": "experiment.status.updated",
"data": {
"experiment_id": "<experiment_id>",
"experiment_key": "<experiment_key>"
},
"signature": "<signature>"
}
```

### Experiment Calculated Metrics Updated
**Triggers when:**
- Data pipeline run irrespective of success or failure and mode of trigger manual or scheduled


**Request body:**

```json
{
"event": "experiment.calculated_metrics.updated",
"data": {
"experiment_id": "<experiment_id>",
"experiment_key": "<experiment_key>",
"meta_data": {
"status": "<success | failure>",
"is_manual_refresh": "<boolean>",
"is_data_updated": "<boolean>",
"time_taken_seconds": "<number>",
"is_traffic_imbalance": "<boolean>",
"assignments_scan_start_date": "<date>",
"assignments_scan_end_date": "<date>"
}
},
"signature": "<signature>"
}
```

## Configuring the webhook
To use the webhook, you first need to setup a URL on your side to receive the webhook payload. Once that is done, contact [Eppo support](emailto:[email protected]) to set and enable the webhook.
5 changes: 1 addition & 4 deletions docs/sdks/client-sdks/javascript/Initialization.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ sidebar_position: 3

import ApiOptionRef from '@site/src/components/ApiOptionRef';


The Eppo JavaScript SDK is easy to initialize while offering robust customization options, making it adaptable to various use cases such as offline mode, custom caching requirements, and ultra-low-latency initialization.

## Initialize the SDK

To complete basic initialization, you only need to provide an SDK key which you can created in the Eppo UI under **Configuration** > **Environments** > **API Keys**.
To complete basic initialization, you only need to provide an SDK key. [Create an SDK key](/sdks/sdk-keys) if you don't already have one.

```javascript
import * as EppoSdk from "@eppo/js-client-sdk";

import { init } from "@eppo/js-client-sdk";

await init({
Expand Down
4 changes: 2 additions & 2 deletions docs/sdks/client-sdks/javascript/bandits.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ The SDK will invoke the `logBanditAction()` function with an `IBanditEvent` obje
| `actionProbability` (number) | The weight between 0 and 1 the bandit valued the assigned action | 0.25 |
| `optimalityGap` (number) | The difference between the score of the selected action and the highest-scored action | 456 |
| `modelVersion` (string) | Unique identifier for the version (iteration) of the bandit parameters used to determine the action probability | "v123" |
| `metaData` Record<string, unknown> | Any additional freeform meta data, such as the version of the SDK | `{ "sdkLibVersion": "3.5.1" }` |
| `metaData` Record\<string, unknown\> | Any additional freeform meta data, such as the version of the SDK | `{ "sdkLibVersion": "3.5.1" }` |

### Querying the bandit for an action

To query the bandit for an action, you can use the `getBanditAction()` function. This function takes the following parameters:
- `flagKey` (string): The key of the feature flag corresponding to the bandit
- `subjectKey` (string): The key of the subject or user assigned to the experiment variation
- `subjectAttributes` (Attributes | ContextAttributes): The context of the subject
- `actions` (string[] | Record<string, Attributes | ContextAttributes>): Available actions, optionally mapped to their respective contexts
- `actions` (string\[\] | Record\<string, Attributes | ContextAttributes\>): Available actions, optionally mapped to their respective contexts
- `defaultValue` (string): The default *variation* to return if the flag is not successfully evaluated

:::note
Expand Down
4 changes: 2 additions & 2 deletions docs/sdks/client-sdks/javascript/nextjs-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ offlineInit({

This function is synchronous and ready to handle assignments after it returns.

Additional details are available in the [offline initialization documentation](/sdks/client-sdks/javascript/initialization#offline-initialization) for the client SDK.
Additional details are available in the [offline initialization documentation](/sdks/client-sdks/javascript/Initialization#offline-initialization) for the client SDK.

## Start a new Next.js React App

Expand Down Expand Up @@ -77,7 +77,7 @@ Open a browser to the location output for `local` (e.g., [http://localhost:3000]
## Eppo flag setup

1. [Create and copy an SDK key](/sdks/sdk-keys.md) in your Eppo app if you don't already have one.
2. [Create a feature flag](/quick-starts/feature-flag-quickstart.md/#2-create-a-flag) in your Eppo app.
2. [Create a feature flag](/feature-flag-quickstart#create-a-flag) in your Eppo app.
3. Make sure your flag is turned on in the environment that correlates to your SDK key.

## Client rendered component setup
Expand Down
2 changes: 1 addition & 1 deletion docs/sdks/client-sdks/javascript/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ For full steps to create a bandit including UI steps, see the [bandit quickstart
Now that you've seen how to make assignments with the Eppo JavaScript SDK, we strongly recommend familiarizing yourself with the following topics:

- [High Level concepts for the client API](/sdks/client-sdks)
- [Initialization Configuration](/sdks/client-sdks/javascript/initialization)
- [Initialization Configuration](/sdks/client-sdks/javascript/Initialization)
- [Assignment details](/sdks/client-sdks/javascript/assignments)
- [Using the SDK with React](/sdks/client-sdks/javascript/react)
- [Using the SDK with Next.js](/sdks/client-sdks/javascript/nextjs-setup) if you are using Next.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ Therefore, the logger should write to a table with the following columns (they c
| timestamp (TIMESTAMP) | Timestamp of the bandit assignment in UTC | 2024-08-14 12:19:25.959 |
| key (VARCHAR/STRING) | The key (unique identifier) of the bandit | ad-bandit-1 |
| subject (VARCHAR/STRING) | The unique identifier for the subject being assigned | ed6f85019080 |
| subject_numeric_attributes (JSON) | Metadata about numeric attributes of the subject; Mapping of attribute names to their values | {"age": 30} |
| subject_categorical_attributes (JSON) | Metadata about non-numeric attributes of the subject; Mapping of attribute names to their values | {"loyalty_tier": "gold"} |
| subject_numeric_attributes (JSON) | Metadata about numeric attributes of the subject; Mapping of attribute names to their values | \{"age": 30\} |
| subject_categorical_attributes (JSON) | Metadata about non-numeric attributes of the subject; Mapping of attribute names to their values | \{"loyalty_tier": "gold"\} |
| action (VARCHAR/STRING) | The action assigned by the bandit | promo-20%-off |
| action_numeric_attributes (JSON) | Metadata about numeric attributes of the assigned action; Mapping of attribute names to their values | {"discount": 0.2} |
| action_categorical_attributes (JSON) | Metadata about non-numeric attributes of the assigned action; Mapping of attribute names to their values | {"promoTextColor": "white"} |
| action_numeric_attributes (JSON) | Metadata about numeric attributes of the assigned action; Mapping of attribute names to their values | \{"discount": 0.2\} |
| action_categorical_attributes (JSON) | Metadata about non-numeric attributes of the assigned action; Mapping of attribute names to their values | \{"promoTextColor": "white"\} |

:::note
Assignment attributes must be single-level. Eppo's bandits do not support multiple levels of JSON attributes.
Expand All @@ -101,7 +101,7 @@ We also recommend storing additional information that is provided to the bandit
| model_version (VARCHAR/STRING) | Unique identifier for the version (iteration) of the bandit parameters used to determine the action probability | v123 |
| action_probability (NUMBER/NUMERIC) | The weight between 0 and 1 the bandit valued the assigned action | 0.567 |
| optimality_gap (NUMBER/NUMERIC) | The difference between the score of the selected action and the highest-scored action | 78.9 |
| metadata (JSON) | Any additional freeform metadata, such as the version of the SDK; Mapping of the property names to their string values | { "sdkLibVersion": "3.5.1" } |
| metadata (JSON) | Any additional freeform metadata, such as the version of the SDK; Mapping of the property names to their string values | \{ "sdkLibVersion": "3.5.1" \} |

The bandit assignment logger should be provided along with the variation assignment logger.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ The `value` field in `conditions` may or may not be hashed depending on the conf
| is one of | hashed |
| is not one of | hashed |
| is null | hashed |
| less than (<) | encoded |
| less than or equal (<=) | encoded |
| greater than (>) | encoded |
| greater than or equal (>=) | encoded |
| less than (`<`) | encoded |
| less than or equal (`<=`) | encoded |
| greater than (`>`) | encoded |
| greater than or equal (`>=`) | encoded |
| matches regex | encoded |

The targeting rule's `operator` is configured in the UI during allocation setup.
Expand Down
Loading