Custom attributes

With UserEngage you can send custom attributes to gather the information you need. It means that you can filter your users based on the criteria important for your busines. For example, if you’re running an online shop with shoes, you can send us over the size or color of shoes being purchased. So, you then send a message to the group of people who already bought green shoes in size 8 and recommend them another color in the same size.

How do I do it?

You send custom attributes by adding it to the custom script on your website as additional key/value pairs. Remember to check if your keys have a JSON-valid value: quotes around strings and sending null as a value when there isn't a value for that user. Be aware that your keys are CASE-sensitive!


Example

Our widget code has to be modified as shown below (we added custom_attribute_1 and zip_code):

<script>
  window.civchat = {
    apiKey: 'YOUR_API_KEY',
    email: 'johndoe@mydomain.com',
    name: 'John Doe Smith',
    custom_attribute_1: 'this is string',
    zip_code: 90210
  };
</script>

Where are the custom attributes added?

Each custom attribute will be added as a column in people view, to be used in actions, filters, user profile and it will be shown under App Settings -> Attributes

Columns
Filters
User profile

How do I change the value type?

To create a new attribute with a fixed tpe, head over to https://app.userengage.io/clients/custom-attributes/ and click Create new button. Here, you can change the value type:

  • boolean - example: true / false
  • integer - example: 23
  • date - example: 2016-08-03
  • string - example: "this is sample string, just a regular text line"
  • date and time - example (ISO 8601 format): 2016-08-03 12:00:00+00:00

Remember: If you want to use those attributes with our widget, you'll have to create them first, THEN use them in window.civchat object on your website. Otherwise, the widget will create new attributes itself with the string type:

  • Name: set the name of your new attribute.
  • Value type: from the select menu, choose which type you want to use for your new attribute.

Examples

Let's create a few example attributes and use them with UserEngage widget.

  • Name: test_boolean, set the value type to Boolean
  • Name: test_integer, set the value type to Integer
  • Name: test_date, set the value type to Date
  • Name: test_string, set the value type to String
  • Name: test_dateandtime, set the value type to Date and time
Settings - attributes

Edit your code with window.civchat object to match this:

<script>
  window.civchat = {
    apiKey: 'YOUR_API_KEY',
    email: 'johndoe@mydomain.com',
    test_boolean: true,
    test_integer: 4923,
    test_date: '2016-08-03',
    test_string: "Casual string with some number like 1094"
    test_dateandtime: '2016-08-03 11:49'
  };
</script>

You should be ready and set to go with new attributes!

If you feel confused or have any suggestions please let us know!