UACustomEvent

Objective-C

@interface UACustomEvent : UAEvent

Swift

class UACustomEvent : UAEvent

A UACustomEvent captures information regarding a custom event for UAAnalytics.

Custom Event Properties

  • The event’s value. The value must be between -2^31 and 2^31 - 1 or it will invalidate the event.

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) NSDecimalNumber *eventValue;

    Swift

    var eventValue: NSDecimalNumber? { get set }
  • The event’s name. The name’s length must not exceed 255 characters or it will invalidate the event.

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *_Nonnull eventName;

    Swift

    var eventName: String { get set }
  • The event’s interaction ID. The ID’s length must not exceed 255 characters or it will invalidate the event.

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) NSString *interactionID;

    Swift

    var interactionID: String? { get set }
  • The event’s interaction type. The type’s length must not exceed 255 characters or it will invalidate the event.

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) NSString *interactionType;

    Swift

    var interactionType: String? { get set }
  • The event’s transaction ID. The ID’s length must not exceed 255 characters or it will invalidate the event.

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) NSString *transactionID;

    Swift

    var transactionID: String? { get set }
  • The event’s properties. Properties must be valid JSON:

    • All objects are NSString, NSNumber, NSArray, NSDictionary, or NSNull
    • All dictionary keys are NSStrings
    • NSNumbers are not NaN or infinity

    Declaration

    Objective-C

    @property (nonatomic, copy) NSDictionary *_Nonnull properties;

    Swift

    var properties: [AnyHashable : Any] { get set }
  • The event’s JSON payload.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSDictionary *_Nonnull payload;

    Swift

    var payload: [AnyHashable : Any] { get }

Custom Event Factories

  • Factory method for creating a custom event.

    Declaration

    Objective-C

    + (nonnull instancetype)eventWithName:(nonnull NSString *)eventName;

    Swift

    convenience init(name eventName: String)

    Parameters

    eventName

    The name of the event. The event’s name must not exceed 255 characters or it will invalidate the event. @returns A Custom event instance

  • Factory method for creating a custom event with a value from a string.

    Declaration

    Objective-C

    + (nonnull instancetype)eventWithName:(nonnull NSString *)eventName
                          valueFromString:(nullable NSString *)eventValue;

    Swift

    convenience init(name eventName: String, valueFrom eventValue: String?)

    Parameters

    eventName

    The name of the event. The event’s name must not exceed 255 characters or it will invalidate the event.

    eventValue

    The value of the event as a string. The value must be a valid number between -2^31 and 2^31 - 1 or it will invalidate the event. @returns A Custom event instance

  • Factory method for creating a custom event with a value.

    Declaration

    Objective-C

    + (nonnull instancetype)eventWithName:(nonnull NSString *)eventName
                                    value:(nullable NSNumber *)eventValue;

    Swift

    convenience init(name eventName: String, value eventValue: NSNumber?)

    Parameters

    eventName

    The name of the event. The event’s name must not exceed 255 characters or it will invalidate the event.

    eventValue

    The value of the event. The value must be between -2^31 and 2^31 - 1 or it will invalidate the event. @returns A Custom event instance

Custom Event Management

  • Adds the event to analytics.

    Declaration

    Objective-C

    - (void)track;

    Swift

    func track()