Learn how to use advanced SDK features in Featurebase to perform actions after user identification and attach metadata to feedback for additional context.
Written By Markus Palm
Last updated 6 months ago
👨💻 You'll need to write custom code for the setup process. If you're uncomfortable with this, share this guide with a technical team member who can assist.
You may want to perform some actions once a user has been successfully identified. For example, you may want to redirect them to your board once the identify call has completed.
Each identify call takes a callback parameter that runs once the identify function is finished.
Examplefunction featurebaseIdentifyCallback(err) {
if (err) {
console.log("Could not identify user")
return
}
// Perform follow-up actions here.
}
Featurebase(
"identify",
{
// Required. Replace with your customers data.
email: "yourcustomer@example.com",
name: "Your Customer",
id: "123456",
},
featurebaseIdentifyCallback
);
Adding metadata to feedback posts
You can attach metadata to user feedback to provide additional context about the users session (e.g. App version, Device type, etc) from all the widgets that support feedback posting.
To set it up, pass a metadata object to the feedback, all-in-one or the board embed widget.
The data object must be a key-value pair of strings. Here's an example:
Examplemetadata: {
"app_version": "1.0.0",
"device_type": "iPhone 12",
"error": "Could not connect to server",
}
Extra: Adding metadata without a widget
When using Featurebase via the public url (or as a WebView on a mobile app), you can pass the metadata to the url. It will be attached to the user's session and included when they post feedback.
Exampleconst metadata = {
"app_version": "1.0.0",
"device_type": "iPhone 12",
"error": "Could not connect to server",
}
// Attach the stringified metadata to the url
const url = 'https://yourboard.featurebase.app?metaData=' + JSON.stringify(metadata)
// Now use this url for linking to your board
Updating metadata on the go
To update metadata ongoingly, you can call the following function when using any of the widgets.
window.postMessage({
target: 'FeaturebaseWidget',
data: {
action: 'updateMetadata',
metadata: {
"app_version": "1.0.1",
"device_type": "iPhone 13",
"error": "Could not connect to server",
}
}
})