Campaign tracking attributes a tracking request to a marketing campaign — for example, an ad, a newsletter, or a deep link that brought the user into your app. The iOS SDK lets you attach campaign data either directly via MICampaignParameters on a page or action event, or by passing a campaign URL to trackUrl(_:withMediaCode:).
For deep‑link‑driven campaigns (Universal Links, custom URL schemes), see Campaign Tracking via Deep Links.
MICampaignParameters
Property | Description |
|---|---|
| Identifier of the campaign (matches the campaign tracking value in your account). |
|
|
| Custom media code; defaults to |
| If |
| Dictionary of numbered custom campaign parameters. |
Method (URL based)
Method | Description |
|---|---|
| Parses campaign parameters from a URL and tracks them. If |
Examples
Attach a campaign to a page event
let campaign = MICampaignParameters(with: "spring-sale-2026")
campaign.mediaCode = "wt_mc"
campaign.oncePerSession = true
let pageEvent = MIPageViewEvent(name: "Landing")
pageEvent.campaignParameters = campaign
MappIntelligence.shared()?.trackPage(pageEvent)MICampaignParameters *campaign = [[MICampaignParameters alloc] initWith:@"spring-sale-2026"];
campaign.mediaCode = @"wt_mc";
campaign.oncePerSession = YES;
MIPageViewEvent *pageEvent = [[MIPageViewEvent alloc] initWithName:@"Landing"];
pageEvent.campaignParameters = campaign;
[[MappIntelligence shared] trackPage:pageEvent];Track a campaign URL on app launch
If the user opened the app via a Universal Link or custom URL scheme that contains campaign parameters, forward the URL to the SDK:
func application(
_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void
) -> Bool {
if userActivity.activityType == NSUserActivityTypeBrowsingWeb {
MappIntelligence.shared()?.trackUrl(userActivity.webpageURL, withMediaCode: nil)
}
return true
}- (BOOL)application:(UIApplication *)application
continueUserActivity:(NSUserActivity *)userActivity
restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> *))restorationHandler {
if ([userActivity.activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) {
[[MappIntelligence shared] trackUrl:userActivity.webpageURL withMediaCode:nil];
}
return YES;
}Related: Campaign Tracking via Deep Links, Pages, Object Oriented Tracking.