Pass custom data through the widget and into the Helpdesk

In order to pass custom data through your widget and into the ticketing system, follow these steps:

Create the custom field in your UserVoice Account

  1. Click on "Settings" in the Admin Header
  2. Choose "Tickets" from the drop down menu
  3. Scroll down to "Custom Fields" and click "Add a new custom field."
  4. Choose the "Read-Only option" and name your field.
For this example, let’s say you add a custom field named ‘Customer Name’, which accepts open-ended values, and isn’t shown to the user on the widget.

Install the widget on your website

Add the following to the widget code on your website

UserVoice = window.UserVoice || [];
UserVoice.push(['setCustomFields', {'Customer Name': 'John Smith'}])

To put this into context, the full embed code for the widget plus custom field data would look something like this (though please note that this is just an example, using sample widget and custom field values):

<!-- A tab to launch the Classic Widget -->
<script>
UserVoice = window.UserVoice || [];
UserVoice.push(['setCustomFields', {'Customer Name': 'John Smith'}]);
UserVoice.push(['showTab', 'classic_widget', {
  mode: 'full',
  primary_color: '#cc6d00',
  link_color: '#007dbf',
  default_mode: 'support',
  forum_id: 121373,
  tab_label: 'Feedback & Support',
  tab_color: '#cc6d00',
  tab_position: 'middle-right',
  tab_inverted: false
}]);
</script>


If you are embedding the widget directly on the page, it will work the same way except there would be no "showTab" block. It could go in its own script tag below the embed script. Here is how it would look:
<script> 
(function() { 
var uv = document.createElement('script'); 
uv.type = 'text/javascript'; 
uv.async = true; 
uv.src = '//widget.uservoice.com/xxxxxxxxxxx.js'; 
var s = document.getElementsByTagName('script')[0]; 
s.parentNode.insertBefore(uv, s) 
})() 
</script>
<script> UserVoice = window.UserVoice || []; UserVoice.push(['setCustomFields', {'Customer Name': 'John Smith'}]) </script>
That’s it! When your customer clicks on the widget, their information will be passed through the widget and into the UserVoice Helpdesk system.

Other Articles You Might Find Helpful:


Set up the widget



Feedback and Knowledge Base