Skip to content

Commit

Permalink
Finalize statsig example (#1095)
Browse files Browse the repository at this point in the history
### Description

<!--
✍️ Write a short summary of your work. Screenshots and videos are
welcome!
-->

### Demo URL

<!--
Provide a URL to a live deployment where we can test your PR. If a demo
isn't possible feel free to omit this section.
-->

### Type of Change

- [ ] New Example
- [ ] Example updates (Bug fixes, new features, etc.)
- [ ] Other (changes to the codebase, but not to examples)

### New Example Checklist

- [ ] 🛫 `npm run new-example` was used to create the example
- [ ] 📚 The template wasn't used but I carefuly read the [Adding a new
example](https://github.com/vercel/examples#adding-a-new-example) steps
and implemented them in the example
- [ ] 📱 Is it responsive? Are mobile and tablets considered?

---------

Co-authored-by: Dominik Ferber <[email protected]>
  • Loading branch information
chriswdmr and dferber90 authored Feb 27, 2025
1 parent 8a8ac83 commit 0dd790c
Show file tree
Hide file tree
Showing 5 changed files with 1,725 additions and 26 deletions.
12 changes: 2 additions & 10 deletions flags-sdk/experimentation-statsig/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
{
"root": true,
"extends": "next/core-web-vitals",
"rules": {
"@typescript-eslint/require-await": "off",
"@typescript-eslint/no-misused-promises": "off",
"import/order": "off",
"camelcase": "off",
"no-console": "off"
}
}
"extends": "next/core-web-vitals"
}
8 changes: 5 additions & 3 deletions flags-sdk/experimentation-statsig/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,16 @@ vercel env pull

Head over to the [Statsig Console](console.statsig.com) and create the two feature flags under Feature Gates:

- `Summer Sale` with the gate id `summer_sale`
- `Free Shipping` with the gate id `free_delivery`
- `Summer Sale` with the gate id `summer_sale`, targeting the `Stable ID`
- `Free Shipping` with the gate id `free_delivery`, targeting the `Stable ID`

Note: please make sure you select the `Stable ID` instead of the `User ID` which is selected by default.

You can also find the gate ids in the `flags.ts` file.

### Step 4: Configure the Feature Gates

Select the `Free Delivery` and `Free Shipping` feature gates and configure them on the Statsig Console.
Select the `Summer Sale` and `Free Shipping` feature gates and configure them on the Statsig Console.

Create a new rule by clicking on "+ Add New Rule" and set the percentage to 50%.

Expand Down
2 changes: 1 addition & 1 deletion flags-sdk/experimentation-statsig/flags.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { statsigAdapter, type StatsigUser } from "@flags-sdk/statsig";
import { Identify } from "flags";
import type { Identify } from "flags";
import { dedupe, flag } from "flags/next";
import { getStableId } from "./utils/get-stable-id";

Expand Down
1 change: 1 addition & 0 deletions flags-sdk/experimentation-statsig/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"@types/react": "^19.0.10",
"@types/react-dom": "^19.0.4",
"eslint": "^9.21.0",
"eslint-config-next": "^15.2.0",
"postcss": "^8.5.3",
"tailwindcss": "^4.0.8",
"typescript": "^5.7.3"
Expand Down
Loading

0 comments on commit 0dd790c

Please sign in to comment.