Pages

Prev Next

Page tracking records screen views in your iOS app. The SDK offers three entry points so you can pick the level of detail that fits your use case.

Methods

Method

Use for

trackPage(with: String)

Quick page tracking by page name only — no extra parameters.

trackPage(_ event: MIPageViewEvent)

Object‑oriented tracking with attached page, session, user, e‑commerce, or campaign parameters.

trackPage(with: UIViewController, pageViewEvent: MIPageViewEvent?)

Track a page from inside a view controller. The SDK reads the page name from the controller's class name when the event is omitted.

Build a page event

Use MIPageViewEvent to assemble a page request. Attach MIPageParameters for page‑level data and any of the optional parameter objects (session, user, e‑commerce, campaign).

MIPageParameters

Property

Description

internalSearch

Internal search term entered on the page.

details

Dictionary of numbered page parameters (NSNumberNSString).

groups

Dictionary of numbered page categories (groups).

Examples

Track a page by name

MappIntelligence.shared()?.trackPage(with: "Home")
[[MappIntelligence shared] trackPageWith:@"Home"];

Track a page with detailed parameters

override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)

    let pageEvent = MIPageViewEvent(name: "Product Detail")
    pageEvent.pageParameters = MIPageParameters(dictionary: [
        1: "category-shoes",
        2: "running"
    ])
    pageEvent.sessionParameters = MISessionParameters(dictionary: [
        1: "loggedIn"
    ])

    MappIntelligence.shared()?.trackPage(pageEvent)
}
- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];

    MIPageViewEvent *pageEvent = [[MIPageViewEvent alloc] initWithName:@"Product Detail"];
    pageEvent.pageParameters = [[MIPageParameters alloc] initWithDictionary:@{
        @1: @"category-shoes",
        @2: @"running"
    }];
    pageEvent.sessionParameters = [[MISessionParameters alloc] initWithDictionary:@{
        @1: @"loggedIn"
    }];

    [[MappIntelligence shared] trackPage:pageEvent];
}

Track a page from a view controller

override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)
    MappIntelligence.shared()?.trackPage(with: self, pageViewEvent: nil)
}
- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [[MappIntelligence shared] trackPageWithViewController:self pageViewEvent:nil];
}

For SwiftUI views, trigger page tracking from .onAppear using trackPage(with:) or trackPage(_:).

Related: Object Oriented Tracking, Events, Sessions.