iOS Standalone Ad

Learn how to create additional content monetization opportunities in your iOS app

Standalone Ads enables you to customize ad opportunities and augment the revenue potential of your app:

  • Create new high-profile ad opportunities of any dimensions
  • Display video and display ads
  • Enforce brand safety


Install the dependencies

Use the following steps to install the dependencies:

  1. In a text editor, open Podfile.

  2. Update Podfile with the following information.

    target‬‭ 'YOUR_APP_TARGET'‬‭ do‬
    ‭   pod‬‭ 'SpotImStandaloneAds'
       # add RxSwift when minimal iOS target is <13 
       # pod 'RxSwift'
    ## for RxSwift only
    # post_install do |installer|‬
    ‭#   installer.pods_project.targets.each do |target|‬
    ‭#     target.build_configurations.each do |config|‬
    # ‭      if‬‭ ==‬‭ 'RxSwift'‬
    ‭#         config.build_settings[‬‭'BUILD_LIBRARY_FOR_DISTRIBUTION'‬‭]‬‭ = 'YES'‬
    ‭#       end‬
    ‭#     end‬
    ‭#   end‬
    ‭# end‬
  3. Run pod install --repo-update in your project directory to install the pod.

  4. Run pod update SpotImStandaloneAds to update the SpotImStandaloneAds.

Update the Info.plist file

Add the keys listed below to the Info.plist file of your app.

GADApplicationIdentifierGoogle Mobile Ads app ID
SKAdNetworkIdentifierAd network identifier
NSUserTrackingUserDescriptionDescription displayed in the app tracking transparency prompt to the user

This custom message is shown to the user when requesting access to the IDFA.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">

    <!-- Google Mobile Ads Configuration -->

    <!-- App Tracking Transparency -->
    <string>This app will use your data to provide better ad experience.</string>

    <!-- SKAdNetwork Configuration -->

Implement EU User Consent

Implementing EU User Consent in your app demonstrates a commitment to user privacy and trust.

You can use either of the following approaches to implement user consent:

Manual Consent Form

This approach shows a user consent form, obtains user consent, and sets the GDPR settings in the SpotIM SDK based on the user's response.

  1. Show the user consent form.
  2. With the return consent form results, call the following methods.
    SpotImAds.setGdprConsentString(‬‭ ...)‬


This approach leverages a Consent Management Platform (CMP) SDK, which handles the user consent process. The GDPR applicability and consent information are stored in standard UserDefaults keys and can be retrieved to configure the SpotIM SDK.

When using a CMP SDK such as Google UMP, you can implement the following code.

let‬‭ isGdprRequired‬‭ = UserDefaults.standard.bool(forKey:‬‭ "IABTCF_gdprApplies"‬‭ )‬
‭SpotImAds.setGdprRequired(required: isGdprRequired)‬
if‬‭ isGdprRequired,
 let‬‭ consent‬‭ = UserDefaults.standard.string(forKey:‬‭ "IABTCF_TCString"‬‭ )‬‭ {‬
‭  SpotImAds.setGdprConsentString(consent:‬‭ consent)‬

Initialize the SDK

In the AppDelegate, initialize the SpotIM SDK.

‬import‬‭ SpotImStandaloneAds‬
class‬‭ AppDelegate:‬‭ UIResponder,‬‭ UIApplicationDelegate‬‭ {‬
‭    func‬‭ application(...)‬‭ -> Bool‬
‭        SpotImAds.initSDK(‬
‭            spotId:‬‭ ...,‬‭ // your spotim id‬
‭            storeURL:‬‭ ...‬‭ // your App Store url‬
‭        )‬
‭    return‬‭ true‬

Display an ad

Insert an ad slot to display an ad.

‬import‬‭ SpotImStandaloneAds‬
class‬‭ YourViewController:‬‭ UIViewController‬‭ {‬
‭    override‬‭ func‬‭ viewDidLoad()‬‭ {‬
‭        super‬‭.viewDidLoad()‬
        let‬‭ child‬‭ = SpotImAds.makePlacement(row:‬‭ 1‬‭ ,‬‭ column:‬‭ 1‬‭ )‬
‭        addChild(child)‬
‭        view.addSubview(child.view)‬
‭        child.view.translatesAutoresizingMaskIntoConstraints‬‭ = false‬
‭        /// <---- Add constraints‬
‭        /// NOTE: height constraint is managed by SDK‬‭ or by sizeDelegate‬
        child.didMove(toParent:‬‭ self)‬
        child.sizeDelegate‬‭ = self‬‭ /// Optional. Custom size handling
‭    }‬


When ads are preloaded, users are more likely to see already loaded or nearly ready ads when scrolling to the ad slot.

To preload ads, make the following call:

// Some Page (ViewController)
// ViewDidLoad

    row: row,
    column: column,
    analyticsInfo: .init( // optional Needed for improving Analytics
       url: "/home/articles",
       postId: "123"