SDK - Native

Quick Start

Prerequisite: Complete the SDK Installation first. Minimum iOS deployment target: 14. Minimum SDK version required: 1.2.1.

Native Campaigns lets you display a scrollable list of campaigns directly in your app's UI. The SDK provides a default layout — you just drop it in and call load().


1. Set the Ad Unit ID

After configure, set the ad unit ID for native campaigns:

Get your Ad unit ID from the Developer Portalarrow-up-right.

2. Add the View to Your Screen

MCNativeAdView is a plain UIView — add it anywhere you can add a subview.

Wrap MCNativeAdView with UIViewRepresentable:

Then use it in your view:

That's it. The SDK handles everything:

  • Fetches campaigns from the API

  • Shows a loading skeleton while fetching

  • Displays campaigns in a horizontal scrollable list

  • Tracks impressions automatically

  • Opens the campaign detail page on click


3. (Optional) Open Campaign Details In-App

By default, tapping a campaign opens the detail page in Safari. To keep users inside your app using an in-app WebView:

When openInApp is true, the SDK presents an MCWebViewController from the nearest UIViewController in the responder chain. You can also set a title for the in-app WebView:

Tip: For tighter control over which view controller is used to present the WebView, set adView.presentingController = self on your containing UIViewController.

4. What Happens Behind the Scenes

When you call adView.load(), the SDK:

  1. Shows a pulsing skeleton placeholder that matches the layout direction

  2. Calls the API to fetch campaigns

  3. Replaces the skeleton with the campaign list

  4. Fires impression pixels automatically when each campaign becomes visible

  5. Opens the campaign detail page (in Safari or an in-app WebView) when the user taps a campaign

No manual tracking or click handling is needed.


Next Steps

Last updated