Events

Prev Next

Use event tracking to record user actions on a page, such as button taps, swipes, or other interactions that are not screen views. Each action is tied to the current page name and can carry custom event parameters.

Before you start, complete the Quickstart so the SDK is initialized.


Method

Method

Description

trackAction(_ event: MIActionEvent)

Records a user action with optional event, session, user, e-commerce, or campaign parameters.


Build an action event

Use MIActionEvent with a name. Attach MIEventParameters for action-level data. You can additionally attach any of these optional parameter objects:

MIEventParameters

Property

Description

parameters

Dictionary of numbered event parameters (NSNumberNSString).


Examples

Simple action

The simplest form — pass an action name. Useful for quick instrumentation when you don't yet need custom parameters.

let actionEvent = MIActionEvent(name: "AddToCart")
MappIntelligence.shared()?.trackAction(actionEvent)
MIActionEvent *actionEvent = [[MIActionEvent alloc] initWithName:@"AddToCart"];
[[MappIntelligence shared] trackAction:actionEvent];

Action with custom parameters

Attach MIEventParameters with numbered keys to record additional context for the action.

let actionEvent = MIActionEvent(name: "AddToCart")
actionEvent.eventParameters = MIEventParameters(dictionary: [
    1: "size-42",
    2: "color-black"
])
MappIntelligence.shared()?.trackAction(actionEvent)
MIActionEvent *actionEvent = [[MIActionEvent alloc] initWithName:@"AddToCart"];
actionEvent.eventParameters = [[MIEventParameters alloc] initWithDictionary:@{
    @1: @"size-42",
    @2: @"color-black"
}];
[[MappIntelligence shared] trackAction:actionEvent];

Event parameter numbers must match the custom event parameters configured in your Mapp Intelligence account.