Adding New App Details
Upon installing SDK, you must add your app via the Dropthought mobile app.
Follow the below steps to add a new app:
Navigate to your Profile on the Dropthought mobile app.
Click on Manage Native SDK.
Click on Manage Applications. The section will be empty if you do not have any apps added.
If you have already added any apps earlier, they will be displayed on this screen.
Click on Browse and upload an app icon.
Enter the App Name and Version Name (optional).
Click on Add new visibility.
In the following screen, you will be prompted to enter the page name and element name that should redirect the user to the linked program.
This information will help you to easily identify which element (widget, for instance) on your app is connected to a visibility ID. You can edit the page name and element name anytime.Once you add a page and element name for later reference, click on Add Visibility.
This will give you a unique ID you must insert in the code snippet to be added to your app. This unique ID cannot be edited as it will be used to uniquely identify the element of your app where Dropthought will collect feedback.
Open Program
Use the following snippet to open the Dropthought survey based on an action performed by a user on your app.
Copy the visibility ID and paste it into the code snippet below, replacing YOUR_VISIBILITY_ID.
Pre-requisite:
Declare const openSurvey = useOpenSurvey()
and use openSurvey
whenever you need to open the program.
import { useOpenSurvey } from '@dropthought/react-native-dt-sdk';
// ...
const onButtonPress = () => {
// declare this hook
const openSurvey = useOpenSurvey();
// survey screen will be open by calling the below method
openSurvey({
visibilityId: 'YOUR_VISIBILITY_ID',
});
};
Set Program Metadata
Use the below APIs to capture metadata from the responses received.
import { useOpenSurvey } from '@dropthought/react-native-dt-sdk';
// ...
const onButtonPress = () => {
// declare this hook
const openSurvey = useOpenSurvey();
// declare the metadata you desire
const metadata = { name: 'barney', age: '36' };
// survey screen will be open by calling the method below
openSurvey({
visibilityId: 'YOUR_VISIBILITY_ID',
metadata: metadata,
});
};
Learn more: Associate a Program to an App
