GetFeedback Digital for Web feedback can be supplemented with information you already acquired about your user or your website. This information can be passed on to GetFeedback Digital through Custom Variables so that it will be included in feedback items and campaign results.
Please follow these steps to include Custom Variables in your feedback items and campaign results.
1. Define the data you would like to pass on to GetFeedback Digital.
Examples of Custom Variables are user names, session IDs, A/B-testing variables from other tools, demographic data and membership statuses.
2. Include the variables with a JavaScript API call.
The following JavaScript API call can be included on every page on which you would like to include Custom Variables. Please ensure the call is installed on every page below the GetFeedback Digital code.
<script type="text/javascript">
window.usabilla_live("data", {"custom": {
"Username": username, "SessionID": session_id
}
});
</script>
In this example, "Username" and "SessionID" are the custom variables names that will appear in GetFeedback Digital, while the values indicate a reference to the variable.
If your website is JavaScript heavy it should be noted that the API call can be used multiple times, any call replacing the data of the previous call. So the last call’s data will be used when the feedback process is started.
Append and update Custom Variables
You can make the Custom Variables for GetFeedback Digital for Websites easily update-able by using a JavaScript Object for storing the Custom Variables. If you update the object and resend the Custom Variables using the JavaScript object you can easily keep custom variables up-to-date or even append values. Below you'll find an example of how you could achieve this:
Note for Salesforce users:
If you have purchased our Salesforce app, and would like to push custom variables with your feedback into your Organization, you will need to use one of the pre-defined custom variable field names instead of defining your own. There are a total of five pre-defined field names for variables in the Salesforce app. For more information on these fields, please see the section titled "Custom Variable Lookup field" in our installation guide here.
If we go back to the Username and Session ID example above, in order for these variables to become available in Salesforce, your code should use one the pre-defined variable field names like this:
<script type="text/javascript">
window.usabilla_live("data", {"custom": {
integration_sf_01: username, integration_sf_02: session_id
}
});
</script>
Allowed values for Custom Variables
When you use our JavaScript API call for sending Custom Variables to GetFeedback Digital you can pass on the following 2 objects:
email: The user’s email address, if your button asks the user for his email address the field will be pre-filled with the data you set here, otherwise, the email address will be sent as is.
custom: A JavaScript object containing custom data. The below data types are permitted in custom variables.
- Boolean
- Integer
- Float
- Double
- String – A string can include up to 500 characters.
- Array
- NULL
- Object
Arrays and objects can have a maximum depth of 2 and must consist of uniform values (only strings, only integers etc.).
Tip: We highly recommend that you don't use any object and or arrays. Using only uniform values allows to easily compare and export the feedback and campaign results that you gathered.
3. Success!
The Custom Variables will now be included in every feedback item and campaign result. Also, you will be able to target campaigns to users that have certain Custom Variables.