Sessions

Prev Next

Session parameters describe the current user session — for example, login state, A/B test bucket, or feature flags. The iOS SDK lets you attach an MISessionParameters object to any tracking event so the values are sent together with the event.

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


MISessionParameters

Property

Description

parameters

Dictionary of numbered session parameters (NSNumberNSString). The numbers must match the session parameters configured in your Mapp Intelligence account.


Example

Build an MISessionParameters with numbered keys and attach it to a page or action event.

let sessionParams = MISessionParameters(dictionary: [
    1: "loggedIn",
    2: "experiment-A"
])

let pageEvent = MIPageViewEvent(name: "Home")
pageEvent.sessionParameters = sessionParams

MappIntelligence.shared()?.trackPage(pageEvent)
MISessionParameters *sessionParams = [[MISessionParameters alloc] initWithDictionary:@{
    @1: @"loggedIn",
    @2: @"experiment-A"
}];

MIPageViewEvent *pageEvent = [[MIPageViewEvent alloc] initWithName:@"Home"];
pageEvent.sessionParameters = sessionParams;

[[MappIntelligence shared] trackPage:pageEvent];

Session lifecycle on iOS

The SDK manages the session lifecycle automatically:

  • A new session starts when the app is launched after being killed.

  • An existing session resumes when the user returns to the app within the inactivity window.

  • A session ends after about 30 minutes of inactivity (enforced server-side during post-processing).

You do not start or end sessions from app code. To force a clean session start during testing, use Reset the SDK Singleton.