# Custom events

Custom events can be created by you, and contain any information you provide (quantity of product, it's price, color etc.). You can attach the information as attributes with certain value types, such as:

  • string - "this is a string"
  • integer - 492
  • boolean - True
  • date and time - 2017-09-28T12:51:33.137Z

To create custom event, implement UserComEvent

@Event(name = "custom_event")
class MyCustomEvent implements UserComEvent {
    @Override
    public Map<String, Object> toFlat() {
        Map<String, Object> eventBody = new HashMap<>();
        eventBody.put("attr1", "value1");
        return eventBody;
    }
}

With @Event annotation you can define name of your custom event that will be sent in request to User.com. Otherwise MyCustomEvent.getClass().getSimpleName() will be used.

Value types

Available value types that you can send in request to User.com are:

  • String
  • Integer
  • Double
  • Boolean