UACustomEvent

@interface UACustomEvent : UAEvent

A UACustomEvent captures information regarding a custom event for UAAnalytics.

  • 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 (readwrite, strong, nonatomic, 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 (readwrite, copy, nonatomic) 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 (readwrite, copy, nonatomic, 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 (readwrite, copy, nonatomic, 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 (readwrite, copy, nonatomic, nullable) NSString *transactionID;

    Swift

    var transactionID: String? { get set }
  • The event’s properties.

    Declaration

    Objective-C

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

    Swift

    var properties: [AnyHashable : Any] { get }
  • 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.

  • 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.

  • 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.

  • Sets the custom event’s interaction type and ID from a UAInboxMessage.

    Declaration

    Objective-C

    - (void)setInteractionFromMessage:(nonnull UAInboxMessage *)message;

    Swift

    func setInteractionFrom(_ message: UAInboxMessage)

    Parameters

    message

    The UAInboxMessage to set the custom event’s interaction type and ID from.

  • Sets a custom BOOL property.

    Declaration

    Objective-C

    - (void)setBoolProperty:(BOOL)value forKey:(nonnull NSString *)key;

    Swift

    func setBoolProperty(_ value: Bool, forKey key: String)

    Parameters

    value

    The property value.

    key

    The property key.

  • Sets a custom String property. The value’s length must not exceed 255 characters or it will invalidate the event.

    Declaration

    Objective-C

    - (void)setStringProperty:(nonnull NSString *)value
                       forKey:(nonnull NSString *)key;

    Swift

    func setStringProperty(_ value: String, forKey key: String)

    Parameters

    value

    The property value.

    key

    The property key.

  • Sets a custom Number property.

    Declaration

    Objective-C

    - (void)setNumberProperty:(nonnull NSNumber *)value
                       forKey:(nonnull NSString *)key;

    Swift

    func setNumberProperty(_ value: NSNumber, forKey key: String)

    Parameters

    value

    The property value.

    key

    The property key.

  • Adds the event to analytics.

    Declaration

    Objective-C

    - (void)track;

    Swift

    func track()
  • Sets a custom String array property. The array must not exceed 20 entries and each entry’s length must not exceed 255 characters or it will invalidate the event.

    Declaration

    Objective-C

    - (void)setStringArrayProperty:(nonnull NSArray<NSString *> *)value
                            forKey:(nonnull NSString *)key;

    Swift

    func setStringArrayProperty(_ value: [String], forKey key: String)

    Parameters

    value

    The property value.

    key

    The property key.