Product Availability
Not included in your plan? Want to learn more about the benefits? Leave us a message! If you're viewing this on our Help Center, click the Support bubble in the lower-right of this page.
With the In-App Widget (learn more about the widget here), you can pass User and Account traits from your application using the Widget JavaScript SDK quietly in the background using Identify();
Things To Be Aware Of
- You must have the user's data available in the front-end of your application/website. In most cases, this means they must be signed in.
- User and Account traits passed via the widget will not show in the UI until the user interacts with your UserVoice either via the Web Portal or the Widget — votes, comments, creates an idea, or gives an NPS rating; or, until feedback is captured on their behalf by a Contributor.
- The widget only supports passing one user profile and associated account. If you need to pass in multiple external users, you will need to use the API or the CSV import.
- Your site must be public for this to work. Public or private forums can be used with identify.
Please note: If you want to use the post idea widget with a private forum, you will need to use a token-based single sign-on (JWT) and pass an SSO token in the widget.
Passing Traits with Identify();
You can find the script you need in the Admin Console → Settings → Widgets. You won't need all of that script if you're just passing traits so follow the steps below if that's all you're looking to do.
Include the JS SDK
- Copy and add the following script to your application/website.
- Replace
{subdomain}
with your UserVoice subdomain, e.g.acme.uservoice.com
would be,acme
. - Replace
{JS key}
with your JavaScript SDK Key, found in Admin Console → Settings → Widgets → (Scroll down) Advanced setup.
UserVoice = window.UserVoice || [];
(() => {
const uv = document.createElement('script');
uv.type = 'text/javascript';
uv.async = true;
uv.src = 'https://{subdomain}.uservoice.com/widget_environment/{JS key}.js';
let s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(uv,s);
})();
Add the Identify Object to Pass Traits
The following script uses hard coded values. When you implement this script, you would assign variables for the currently signed in user to the attributes instead. You do not need to pass account traits, but if you do, account id
and name
are required.
- Copy the below script and add it to your application/website so that it runs only if you have user data available.
- Remove the example values and replace with variables.
UserVoice.push(['identify', {
email: 'john.doe@example.com', // Required: User’s email address
id: 123, // Required: Unique id of the user from your platform
name: 'John Doe', // User’s real name
created_at: 1364406966, // Unix timestamp for the date the user signed up to your platform
type: 'Owner', // Segment your users by type
account: {
id: 123, // Required: Unique id of the account from your platform
name: 'Acme, Co.', // Required: Account name
created_at: 1364406966, // Unix timestamp for the date the account was created in your platform
revenue: 9.99, // Decimal; MRR or ARR of the account
ltv: 1495.00, // Decimal; lifetime value of the account
plan: 'Enhanced', // Plan name for the account
}
}]);
Test
To test, run the code in a staging environment. Most local environments do not support the cookies needed for our Identify() feature to work. We strongly recommend testing in a live environment.
- Sign into your application/website. When the page loads, the script will run. If done successfully, the data populated in the identify object will be passed to UserVoice.
- Submit an idea as that same user, e.g. if you passed traits for
john@acme.com,
submit an idea asjohn@acme.com
. -- This is easily done via the Widget. - Visit the Admin Console User & Account area found in, More (side nav) → Users & Accounts -OR-
/admin/v3/users
, and search for the user by email. - You should see traits populated in the User view (on the left).