How to capture Custom Data on Direct Uploader
Overview
Often, you would like to capture additional data from your audience via the Direct Uploader widget for your events or competitions. This guide will show you how to setup custom inputs on your Direct Uploader widget. First thing first, navigate to the Direct Uploader management screen - Aggregate > Direct Uploader, select your favourite Direct Uploader widget. When you are on your Direct Uploader widget, click "Configure" tab, and choose a template where you would like to add your own custom input fields.
Adding Custom fields
Direct Uploader accepts input fields that are prefixed with "custom-data-" and followed by the name of the input field. Note: The name of the input field must contain alphanumeric or underscore characters only. e.g custom-data-**gender**
is correct, custom-data-**your-gender**
is incorrect. See following sample code, which captures Company, Gender and About from the audience
Save your settings to see additional fields appear on your Direct Uploader widget or click on the preview.
</br/> When content come through from your Direct Uploader widget, your custom input will be captured in the __external_data
column on the Nosto's UGC Tile object.
Custom validation
Now that you have added your custom input fields, It's time to add some validation to those input fields. By default, your custom input will be validated against our server by the following rules:
Field name must not exceed 1024 characters
Input value must not exceed 1024 characters
Input must not contain HTML elements
Message field supports up to 32000 characters
Custom_input field supports up to 250 characters
However, You can also provide your own validation by adding a callback in the Custom JS tab
Note the callback onBeforeSave will be passed with 2 parameters when the beforeSave event is fired.
formData is the data to be sent to Nosto's UGC for validation before save happens.
errorMessagesFromServer is an error object Nosto's UGC server returns when data is validated by Nosto's UGC. If you would like to add your own validation logic, simply adding for modifying this object.
Remember to return true or false from your callback to indicate whether or not to go ahead with saving the data to Nosto's UGC
Returning Custom Data from Nosto's UGC
In Nosto'sual UGC, we take security seriously, custom inputs from your Direct Uploader widget will be hidden from all Nosto's UGC public endpoints. However, there are some situations where you would like certain input to be exposed to the public, for example, you are capturing "company" from your Direct Uploader widget, and you want "company" data to be displayed on your widget. You can achieve this by adding data-permission="public" to your "company" input on the Direct Uploader widget prior to your Direct Uploader widget go live.
When you adding data-permission="public" data attribute to your custom inputs, you indicate to the Direct Uploader widget that these fields will be exposed to the public. Visual UGC will capture your public data in the external_data column on your Visual UGC Tile object.
Note that you can find your public data in the external_data column on the Visual UGC Tile Object, external_data is a subset of the __external_data column. __external_data on the other hand is private and it is hidden from all public endpoints by default, you can only access it on Moderation View or from Visual UGC API
Last updated