@capawesome/capacitor-formbricks¶
Unofficial Capacitor plugin for Formbricks.1
Newsletter¶
Stay up to date with the latest news and updates about the Capawesome, Capacitor, and Ionic ecosystem by subscribing to our Capawesome Newsletter.
Compatibility¶
| Plugin Version | Capacitor Version | Status |
|---|---|---|
| 0.1.x | >=8.x.x | Active support |
Installation¶
You can use our AI-Assisted Setup to install the plugin. Add the Capawesome Skills to your AI tool using the following command:
Then use the following prompt:
Use the `capacitor-plugins` skill from `capawesome-team/skills` to install the `@capawesome/capacitor-formbricks` plugin in my project.
If you prefer Manual Setup, install the plugin by running the following commands and follow the platform-specific instructions below:
Android¶
Variables¶
If needed, you can define the following project variable in your app's variables.gradle file to change the default version of the dependency:
$formbricksAndroidVersionversion ofcom.formbricks:android(default:1.2.0)
This can be useful if you encounter dependency conflicts with other plugins in your project.
Data Binding¶
The Formbricks Android SDK requires Data Binding to be enabled in your app's build.gradle file:
iOS¶
Minimum Deployment Target¶
If you are using Swift Package Manager, make sure that your iOS deployment target is set to at least 16.6 in your Xcode project settings (usually in ios/App/App.xcodeproj):
If you are using CocoaPods, make sure that your iOS deployment target is set to at least 16.6 in your Podfile:
Configuration¶
No configuration required for this plugin.
Usage¶
import { Formbricks } from '@capawesome/capacitor-formbricks';
const setup = async () => {
await Formbricks.setup({
appUrl: 'https://app.formbricks.com',
environmentId: 'YOUR_ENVIRONMENT_ID',
});
};
const setUserId = async () => {
await Formbricks.setUserId({
userId: 'user-123',
});
};
const setAttribute = async () => {
await Formbricks.setAttribute({
key: 'plan',
value: 'pro',
});
};
const setAttributes = async () => {
await Formbricks.setAttributes({
attributes: {
plan: 'pro',
tier: 'gold',
},
});
};
const setLanguage = async () => {
await Formbricks.setLanguage({
language: 'de',
});
};
const track = async () => {
await Formbricks.track({
action: 'button_pressed',
});
};
const logout = async () => {
await Formbricks.logout();
};
API¶
logout()setAttribute(...)setAttributes(...)setLanguage(...)setUserId(...)setup(...)track(...)- Interfaces
logout()¶
Log out the current user and clear all attributes.
Since: 0.1.0
setAttribute(...)¶
Set a single user attribute.
| Param | Type |
|---|---|
options |
SetAttributeOptions |
Since: 0.1.0
setAttributes(...)¶
Set multiple user attributes at once.
| Param | Type |
|---|---|
options |
SetAttributesOptions |
Since: 0.1.0
setLanguage(...)¶
Set the survey language.
| Param | Type |
|---|---|
options |
SetLanguageOptions |
Since: 0.1.0
setUserId(...)¶
Set the user ID of the current user.
| Param | Type |
|---|---|
options |
SetUserIdOptions |
Since: 0.1.0
setup(...)¶
Setup the Formbricks SDK with the provided options.
Attention: This method must be called before any other method.
| Param | Type |
|---|---|
options |
SetupOptions |
Since: 0.1.0
track(...)¶
Track an action that may trigger a survey.
| Param | Type |
|---|---|
options |
TrackOptions |
Since: 0.1.0
Interfaces¶
SetAttributeOptions¶
| Prop | Type | Description | Since |
|---|---|---|---|
key |
string |
The name of the attribute. | 0.1.0 |
value |
string |
The value of the attribute. | 0.1.0 |
SetAttributesOptions¶
| Prop | Type | Description | Since |
|---|---|---|---|
attributes |
{ [key: string]: string; } |
The attributes to set. | 0.1.0 |
SetLanguageOptions¶
| Prop | Type | Description | Since |
|---|---|---|---|
language |
string |
The language code of the survey language (e.g. de). |
0.1.0 |
SetUserIdOptions¶
| Prop | Type | Description | Since |
|---|---|---|---|
userId |
string |
The user ID of the current user. | 0.1.0 |
SetupOptions¶
| Prop | Type | Description | Since |
|---|---|---|---|
appUrl |
string |
The URL of your Formbricks instance. | 0.1.0 |
environmentId |
string |
The environment ID of your Formbricks project. | 0.1.0 |
TrackOptions¶
| Prop | Type | Description | Since |
|---|---|---|---|
action |
string |
The name of the action to track. | 0.1.0 |
Changelog¶
See CHANGELOG.md.
License¶
See LICENSE.
-
This project is not affiliated with, endorsed by, sponsored by, or approved by Formbricks GmbH or any of their affiliates or subsidiaries. ↩