Back to docs

Category: developer

Custom fields

Attaching custom fields to a response is a powerful way to enrich responses with data that is relevant to your business. You can use this data to further segment and analyse responses, or build automation on it by combining custom fields with webhooks.

This is how you can set up and use custom fields:

Step 1: Create custom fields in the dashboard

Go to your Survey, then to Settings and then to Advanced.

Here you can turn on and off custom fields which is useful if you want to temporarily disable them.

When you add custom fields, the snake case key name for the fields will be automatically generated. You'll need these in the next step to pass the data.

Custom Fields settings

We'll check if the passed fields in your code match the ones you've set. This is to prevent unexpected data coming in.

Step 2: Attach custom fields

If you've set the widget to trigger programmatically, you'll use the show method. If you have any other trigger, like on page load or if you use the side sticky widget, you can use the setOptions method

The setOptions method

You can attach the custom fields as key: value in the setOptions method. Make sure to pass the data after the Freddy script is loaded. This can be achieved by wrapping the setOptions method in the load event:

window.addEventListener('load', function() {
      custom_fields: {
          user_id: 42,
          email: ''
When using jQuery make sure you use $(window).on("load", function() { ... }) instead of $(document).ready( function() { ... })

The show method

If you've set your widget to trigger programmatically then you can trigger the widget and pass custom fields in one go using the show method. Here's an example of triggering the survey on a button click:

document.getElementById('my-button').addEventListener('click', function() {{
      custom_fields: {
          user_id: 42,
          email: ''

You can of course trigger the widget on other moments in a customer journey, for instance after a certain interaction has finished.

That's all there is to setting up and passing custom fields. Make sure to read on for some important info, and information on using custom fields with webhooks.

Important points

Please keep in mind:

  • If custom fields are turned off in the settings, no custom fields will be stored (even if they are passed)
  • Each custom field that is passed in your code is only stored when its key matches the keys that you created in the survey settings

Custom fields in the dashboard

When a response with custom fields comes in it will show up in your dashboard like you're used to. You'll see the custom fields right below the score and comment that the customer has submitted. If you hover the custom fields you'll see its name.

A custom field with a valid email address as a value will be automatically turned into a mailto: link.

Custom Fields for a response

Using custom fields with webhooks

Imagine this customer journey:

  • Customer logs in
  • You ask what they think about a certain new feature
  • You pass these custom fields: email, user_id and life_time_value
  • Customer gives a low score

Wouldn't it be great to automatically send an email to a customer that has a high life time value but gives a low score? Or send this customer's info to an account manager? Or create a ticket?

With webhooks, you can build such automation. Any custom fields that you pass will be included in our webhooks.

You can read all about webhooks here.

Start today

Collect feedback from your most valuable source: your visitors and customers.

Get started for free

Free 30 day trial • No credit card required

Subscribe to Freddy's updates

Get insights on how to best get feedback from your customers, updates on new features and maybe even a joke from Freddy.