Framework Guides
Integrate the Formbricks App Survey SDK into your app using multiple options. Explore the available choices below. If you need something else, open a GitHub Discussion, and we’ll be happy to help!
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. |
api-host | string | URL of the hosted Formbricks instance. |
Now, visit the Validate Your Setup section to verify your setup!
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.
Update your App.js/ts
file to initialize Formbricks.
Required Customizations
Name | Type | Description |
---|---|---|
environment-id | string | Formbricks Environment ID. |
api-host | string | URL of the hosted Formbricks instance. |
Now, visit the Validate Your Setup section to verify your setup!
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
.
Code snippets for the integration for both conventions are provided to further assist you.
App directory
Pages directory
Required Customizations
Name | Type | Description |
---|---|---|
environment-id | string | Formbricks Environment ID. |
api-host | string | URL of the hosted Formbricks instance. |
First, initialize the Formbricks SDK to run only on the client side. To track page changes, register the route change event with the Next.js router.
Next, go to the Validate Your Setup section to verify your setup!
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.
Required Customizations
Name | Type | Description |
---|---|---|
environment-id | string | Formbricks Environment ID. |
api-host | string | URL of the hosted Formbricks instance. |
Now, visit the Validate Your Setup section to verify your setup!
React Native
Install the Formbricks React Native SDK using one of the package managers, i.e., npm, pnpm, or yarn.
Now, update your App.js/App.tsx
file to initialize Formbricks:
Required Customizations
Name | Type | Description |
---|---|---|
environment-id | string | Formbricks Environment ID. |
api-host | 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:
To this:
Debugging Formbricks Integration
Enabling debug mode in your browser can help troubleshoot issues with Formbricks. Here’s how to activate it and what to look for in the logs.
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.
If you’re stuck, visit GitHub Discussions for assistance.
Was this page helpful?