CustomEvent

@objc(UACustomEvent)
public class CustomEvent : NSObject

CustomEvent captures information regarding a custom event for Analytics.

  • The event type

    Declaration

    Swift

    public static let eventType: String
  • The max properties size in bytes.

    Declaration

    Swift

    @objc
    public static let maxPropertiesSize: Int
  • The event’s value. The value must be between -2^31 and 2^31 - 1 or it will invalidate the event.

    Declaration

    Swift

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

    Declaration

    Swift

    @objc
    public var eventName: String?
  • The event’s transaction ID. The ID’s length must not exceed 255 characters or it will invalidate the event.

    Declaration

    Swift

    @objc
    public var transactionID: String?
  • The event’s interaction type. The type’s length must not exceed 255 characters or it will invalidate the event.

    Declaration

    Swift

    @objc
    public var interactionType: String?
  • The event’s interaction ID. The ID’s length must not exceed 255 characters or it will invalidate the event.

    Declaration

    Swift

    @objc
    public var interactionID: String?
  • The event’s properties. Properties must be valid JSON.

    Declaration

    Swift

    @objc
    public var properties: [String : Any]
  • Constructor

    Declaration

    Swift

    @objc
    public convenience init(name: String, stringValue: String?)

    Parameters

    name

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

    stringValue

    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.

    Return Value

    A Custom event instance

  • Constructor.

    Declaration

    Swift

    public convenience init(name: String)

    Parameters

    name

    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.

    Declaration

    Swift

    @objc(eventWithName:)
    public class func event(name: String) -> CustomEvent

    Parameters

    name

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

    Return Value

    A Custom event instance

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

    Declaration

    Swift

    @objc(eventWithName:valueFromString:)
    public class func event(name: String, string: String?) -> CustomEvent

    Parameters

    name

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

    string

    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.

    Return Value

    A Custom event instance

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

    Declaration

    Swift

    @objc(eventWithName:value:)
    public class func event(name: String, value: NSNumber?) -> CustomEvent

    Parameters

    name

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

    value

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

    Return Value

    A Custom event instance

  • Adds the event to analytics.

    Declaration

    Swift

    @objc
    public func track()