Important for Self-Hosted Setups:Multi-Domain Setup: If you are using the multi-domain setup, the
appUrl
parameter in all SDK configurations should point to your public domain (PUBLIC_URL environment variable). This is the domain where surveys and public-facing content are served, which may be different from your admin interface domain (WEBAPP_URL).Single Domain Setup: If you are using the single domain setup, the appUrl
parameter in all SDK configurations should point to your admin domain (WEBAPP_URL environment variable).Vue.js
Learn how to use Formbricks’ React Native SDK to integrate your surveys into React Native applications.
Prerequisites
Before getting started, make sure you have:- A running web application with user authentication in your chosen framework.
- A Formbricks account with your environment ID and API host, available in the Setup Checklist under Settings.
HTML
All you need to do is copy a<script>
tag to your HTML head:
Required Customizations
Name | Type | Description |
---|---|---|
environment-id | string | Formbricks Environment ID. |
app-url | string | URL of the hosted Formbricks instance. |
React.js
Install the Formbricks SDK using one of the following package managers:npm
, pnpm
, or yarn
.
Note that zod
is required as a peer dependency and must also be installed in your project.
npm
pnpm
yarn
App.js/ts
file to initialize Formbricks.
src/App.js
Required Customizations
Name | Type | Description |
---|---|---|
environment-id | string | Formbricks Environment ID. |
app-url | string | URL of the hosted Formbricks instance. |
Next.js
Next.js projects use either the App Directory or the Pages Directory. Since the Formbricks SDK runs on the client side, follow these steps based on your setup:-
App Directory: Create a new component in
app/formbricks.tsx
and call it inapp/layout.tsx
. -
Pages Directory: Initialize Formbricks directly in
_app.tsx
.
npm
pnpm
yarn
App directory
app/formbricks.tsx
app/layout.tsx
Pages directory
src/pages/_app.tsx
Required Customizations
Name | Type | Description |
---|---|---|
environment-id | string | Formbricks Environment ID. |
app-url | string | URL of the hosted Formbricks instance. |
Vue.js
Integrating the Formbricks SDK with Vue.js is easy. We’ll ensure the SDK is only loaded and used on the client side, as it’s not meant for server-side use.npm
pnpm
yarn
src/formbricks.js
src/main.js
Required Customizations
Name | Type | Description |
---|---|---|
environment-id | string | Formbricks Environment ID. |
app-url | string | URL of the hosted Formbricks instance. |
React Native
Install the Formbricks React Native SDK using one of the package managers, i.e., npm, pnpm, or yarn.npm
pnpm
yarn
App.js/App.tsx
file to initialize Formbricks:
src/App.js
Required Customizations
Name | Type | Description |
---|---|---|
environment-id | string | Formbricks Environment ID. |
app-url | string | URL of the hosted Formbricks instance. |
Swift
Install the Formbricks iOS SDK using the following steps: Swift Package Manager- In Xcode choose File → Add Packages…
-
Enter your repo URL (e.g.
https://github.com/formbricks/ios.git
) -
Choose version rule (e.g. “Up to Next Major” starting at
1.0.0
). -
Import in your code:
-
Add the following to your
Podfile
: -
Run
pod install
in your project directory -
Import in your code:
Required Customizations
Name | Type | Description |
---|---|---|
environment-id | string | Formbricks Environment ID. |
app-url | string | URL of the hosted Formbricks instance. |
Android
Install the Formbricks Android SDK using the following steps:Installation
Add the Maven Central repository and the Formbricks SDK dependency to your application’sbuild.gradle.kts
:
Usage
Required Customizations
Name | Type | Description |
---|---|---|
environment-id | string | Formbricks Environment ID. |
app-url | string | URL of the hosted Formbricks instance. |
Validate your setup
Once you’ve completed the steps above, validate your setup by checking the Setup Checklist in the Settings. The widget status indicator should change from this:

Debugging Formbricks Integration
The debug mode is only available in the JavaScript SDK and works exclusively in the browser. It is not
supported in mobile SDKs such as React Native, iOS, or Android.
Activate Debug Mode
To enable debug mode, add?formbricksDebug=true
to your app’s URL (e.g., https://example.com?formbricksDebug=true)
.
View Debug Logs
- Open your browser’s developer tools:
-
Google Chrome/Edge: Press
F12
or right-click and select “Inspect” > “Console”. -
Firefox: Press
F12
or right-click and select “Inspect Element” > “Console”. -
Safari: Press
Option + Command + C
to open developer tools and go to the “Console” tab.
Common Use Cases
Debug mode is helpful for:- Verifying Formbricks initialization.
- Identifying issues with survey triggers.
- Troubleshooting unexpected behavior.
Debug Log Messages
Logs provide insights into:- API calls and responses.
- Survey triggers and form interactions.
- Initialization errors.