Structures

The following structures are available globally.

Click Options

  • Configuration options for click event capture.

    When enabled, a $mp_click event is tracked for every tap on any element. Each event includes the touch coordinates, element identifier, class name, semantic role, and view hierarchy path. Accessibility labels are never captured: they are localized and can carry user data.

    Warning

    Experimental (beta). Autocapture may contain issues, and its API and the properties it captures may change in a future release before general availability. Pin your SDK version if you build reports on autocaptured events.
    See more

    Declaration

    Swift

    public struct ClickOptions

Rage Click Options

  • Configuration options for rage click detection.

    Rage clicks are detected when a user taps rapidly multiple times in the same area, indicating frustration with an unresponsive element.

    Warning

    Experimental (beta). Autocapture may contain issues, and its API and the properties it captures may change in a future release before general availability. Pin your SDK version if you build reports on autocaptured events.
    See more

    Declaration

    Swift

    public struct RageClickOptions

Dead Click Options

  • Configuration options for dead click detection.

    Dead clicks are detected when a user taps on an interactive element but no visible UI change occurs, indicating a broken or unresponsive element.

    Warning

    Experimental (beta). Autocapture may contain issues, and its API and the properties it captures may change in a future release before general availability. Pin your SDK version if you build reports on autocaptured events.
    See more

    Declaration

    Swift

    public struct DeadClickOptions

Autocapture Options

  • Configuration options for automatic event capture (clicks, rage clicks, dead clicks).

    Autocapture is disabled by default and must be explicitly enabled by providing AutocaptureOptions during SDK initialization.

    Example - Enable with defaults:

    let options = MixpanelOptions(
        token: "YOUR_TOKEN",
        autocaptureOptions: AutocaptureOptions()
    )
    

    Example - Custom configuration:

    let autocaptureOpts = AutocaptureOptions(
        clickOptions: ClickOptions(enabled: true),
        rageClickOptions: RageClickOptions(
            enabled: true,
            clickThreshold: 5,        // Require 5 clicks instead of 4
            timeWindowMs: 800         // Shorter time window
        ),
        deadClickOptions: DeadClickOptions(
            enabled: false            // Disable dead click detection
        )
    )
    
    let options = MixpanelOptions(
        token: "YOUR_TOKEN",
        autocaptureOptions: autocaptureOpts
    )
    

    Platform support: iOS only. Mac Catalyst builds accept these options so shared iOS sources keep compiling, but automatic capture never starts there.

    Warning

    Experimental (beta). Autocapture may contain issues, and its API and the properties it captures may change in a future release before general availability. Pin your SDK version if you build reports on autocaptured events.
    See more

    Declaration

    Swift

    public struct AutocaptureOptions
  • Represents a captured click event with element metadata.

    Contains all semantic information about the clicked element and its context. Create a ClickEvent and pass it to mixpanel.autocapture.trackClick(_:) to track click events with full element metadata. All stored properties are value types (CGFloat, String, Bool), so the event can safely cross threads — it is handed from the main thread, where it is extracted, to the queue that emits it.

    Warning

    Experimental (beta). Autocapture may contain issues, and its API and the properties it captures may change in a future release before general availability. Pin your SDK version if you build reports on autocaptured events.
    See more

    Declaration

    Swift

    public struct ClickEvent : Sendable

AnyCodable

  • Undocumented

    See more

    Declaration

    Swift

    public struct MixpanelFlagVariant : Decodable
  • Undocumented

    See more

    Declaration

    Swift

    public struct ProxyServerConfig
  • This holds all the data for each log message, since the formatting is up to each logging object. It is a simple bag of data

    See more

    Declaration

    Swift

    public struct MixpanelLogMessage
  • Configuration options for feature flags behavior.

    Use this to control how and when feature flags are loaded by the SDK.

    Example — Default behavior (prefetches flags during initialization):

    let options = MixpanelOptions(
        token: "YOUR_TOKEN",
        featureFlagOptions: FeatureFlagOptions(enabled: true)
    )
    

    Example — Deferred loading (for use with identify):

    let options = MixpanelOptions(
        token: "YOUR_TOKEN",
        featureFlagOptions: FeatureFlagOptions(enabled: true, prefetchFlags: false)
    )
    let mp = Mixpanel.initialize(options: options)
    // identify() triggers loadFlags() internally when the distinctId changes
    mp.identify(distinctId: "user123")
    

    If identify may be called with the same persisted distinctId (no change), call mp.flags.loadFlags() explicitly to ensure flags are fetched.

    See more

    Declaration

    Swift

    public struct FeatureFlagOptions
  • Undocumented

    See more

    Declaration

    Swift

    public struct ServerProxyResource