diff --git a/packages/js/README.md b/packages/js/README.md index 841f2834d5..6d2a75265b 100644 --- a/packages/js/README.md +++ b/packages/js/README.md @@ -18,10 +18,12 @@ Formbricks is your go-to solution for in-product micro-surveys that will superch npm install -s @formbricks/js ``` -2. Import Formbricks and initialize the widget in your main component (e.g., App.tsx or App.js): +1. Import Formbricks and initialize the widget in your main component (e.g., App.tsx or App.js): + +For `Website` surveys: ```javascript -import formbricks from "@formbricks/js"; +import formbricks from "@formbricks/js/website"; if (typeof window !== "undefined") { formbricks.init({ @@ -31,6 +33,20 @@ if (typeof window !== "undefined") { } ``` -Replace your-environment-id with your actual environment ID. You can find your environment ID in the **Setup Checklist** in the Formbricks settings. +For `App` surveys: + +```javascript +import formbricks from "@formbricks/js/app"; + +if (typeof window !== "undefined") { + formbricks.init({ + environmentId: "your-environment-id", + apiHost: "https://app.formbricks.com", + userId: "REPLACE_WITH_DYNAMIC_ID", + }); +} +``` + +Replace your-environment-id with your actual environment ID. You can find your environment ID in the **Setup Checklist** in the Formbricks settings. If you are using `App` surveys please make sure to pass a unique user identifier to the Formbricks SDK. For more detailed guides for different frameworks, check out our [Framework Guides](https://formbricks.com/docs/getting-started/framework-guides). diff --git a/packages/js/package.json b/packages/js/package.json index 907998d64b..e9b065ba25 100644 --- a/packages/js/package.json +++ b/packages/js/package.json @@ -1,7 +1,7 @@ { "name": "@formbricks/js", "license": "MIT", - "version": "2.0.0-beta.0", + "version": "2.0.0-beta.1", "description": "Formbricks-js allows you to connect your app to Formbricks, display surveys and trigger events.", "homepage": "https://formbricks.com", "repository": {