# Custom Events
Send any event that matters to your product - a button tap, a feature being used, a form submitted. You define the name and the attributes.
UserSDK.default?.sendEvent(with: "subscription_started", params: [
"plan": "pro",
"billing_cycle": "annual",
"price": 99.99
]) { success, error in
if let error {
// handle error
}
}
The params dictionary is optional. If you don't need attributes, pass an empty dictionary:
UserSDK.default?.sendEvent(with: "onboarding_completed", params: [:])
The completion handler is also optional - omit it if you don't need to react to the result:
UserSDK.default?.sendEvent(with: "settings_opened", params: [:])
# Supported attribute types
| Type | Example |
|---|---|
String | "pro" |
Int | 3 |
Double | 49.99 |
Bool | true |
| ISO 8601 date string | "2024-09-28T12:51:33.137Z" |