# Custom events

Custom events can be created by you, and contain any information you provide (quantity of product, it's price, color etc.).

Define your custom events.

You can send to User.com your custom events.

To send a custom event, first define it’s name and attributes, and then send it:

  • Swift
  • Objective C
let name = "event_name"

let eventDictionary = [
"attr1": "value1",
"attr2": "value2"
];

// Send event
UserSDK.default?.sendEvent(with: name, params: eventDictionary) { [weak self] (success, error) in
    if let error = error {
        //Error occured
    } else if success == false {
        //Something went wrong, the event wasn't sent correctly.
    } else {
        //The event has been sent correctly.
    }
}

SDK will automatically add your user identifier and date time informations to the event. In User.com web panel your event will appear as MyCustomEvent (based of class name)

Value types

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

  • String
  • Integer
  • Double
  • Boolean