Configuring the MXO SDK for iOS

The Medallia Experience Orchestration SDK does not support partial, or piecemeal, configuration. You must provide all parameters, either all valid or invalid (empty string or nil). When configured with invalid parameters, the SDK is set in an unconfigured state.

Note: When in an unconfigured state, the SDK queues user data locally and uploads that data to the server once the SDK is configured with valid parameters. Disable this functionality if necessary, at any time. See more about opting out here.

The Medallia Experience Orchestration SDK for iOS supports User and Admin modes.

  • Admin mode — Admin mode provides you with an interface to add Activity Capture Points to Interactions and elements, Attribute Capture Points to elements, and preview your configuration before publishing it to your live environment.
  • User mode — The User mode build should be made available through the App Store, when you are satisfied that all insights are being tracked in Admin mode and internal QA requirements have been met.
Configure the SDK to activate your app to automatically recognize Interactions in your app, by executing the following steps:
Note: Depending on which SDK mode you want to configure your app with, execute step 2 or 3 accordingly.
  1. Import the Medallia Experience Orchestration SDK's module.
    1. Open your AppDelegate file.
      Tip: If you are integrating the SDK into a SwiftUI app, and your app does not have an AppDeledate class, we highly recommend creating an AppDelegate class for the proper initialization of the SDK. Please see step 4 below.
    2. Add the following line at the top of the file below your import statements:
      import MedalliaMXO
      @import MedalliaMXO;
  2. Set up the SDK in User mode for App Store builds.

    To start capturing, and receiving Optimizations with the Medallia Experience Orchestration SDK in User mode, you must first configure it with your Medallia Experience Orchestration parameters.

    For more information on finding these parameters, see here.

    With your parameters ready at hand, add the following lines to the top of the didFinishLaunchingWithOptions:

    MedalliaMXO.configuration = MXOConfiguration { builder in
    	builder.adminMode = false
    	builder.touchpoint = URL(string: "myAppsNameURI")
    	builder.host = URL(string: "eu2.thunderhead.com")
    	builder.siteKey = "ONE-XXXXXXXXXX-1022"
    }
    MedalliaMXO.configuration = [MXOConfiguration initWithBuilder:^(MXOConfigurationBuilder * _Nonnull builder) {
    	builder.adminMode = NO;
    	builder.touchpoint = [NSURL URLWithString:@"myAppsNameURI"];
    	builder.host = [NSURL URLWithString:@"eu2.thunderhead.com"];
    	builder.siteKey = @"ONE-XXXXXXXXXX-1022";
    }];
  3. Set up the SDK in Admin mode for internal distribution.

    We recommend adding the Admin mode function on your internal builds, behind a debug settings function or on a dedicated build pipeline, as described here.

    To use the framework in Admin mode, simply change the builder.adminMode to true, as follows:

    MedalliaMXO.configuration = MXOConfiguration { builder in
    	builder.adminMode = true
    	builder.touchpoint = URL(string: "myAppsNameURI")
    	builder.host = URL(string: "eu2.thunderhead.com")
    	builder.siteKey = "ONE-XXXXXXXXXX-1022"
    }
    MedalliaMXO.configuration = [MXOConfiguration  initWithBuilder:^(MXOConfigurationBuilder * _Nonnull builder) {
    	builder.adminMode = YES;
    	builder.touchpoint = [NSURL URLWithString:@"myAppsNameURI"];
    	builder.host = [NSURL URLWithString:@"eu2.thunderhead.com"];
    	builder.siteKey = @"ONE-XXXXXXXXXX-1022";
    }];
  4. Optional: Set up the SDK for a SwiftUI app.

    When configuring the SDK in SwiftUI, in order to capture all lifecycle events, it is a recommended best practice to initialize the SDK in the didFinishLaunchingWithOptions method of AppDelegate class. If the SwiftUI app doesn't have an AppDelegate class, use the following code to create one for your app and initialize the SDK:

    class AppDelegate: NSObject, UIApplicationDelegate {
        func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
    	MedalliaMXO.configuration = MXOConfiguration { builder in
    		builder.adminMode = true // or false
    		builder.touchpoint = URL(string: "myAppsNameURI")
    		builder.host = URL(string: "eu2.thunderhead.com")
    		builder.siteKey = "ONE-XXXXXXXXXX-1022"
    	}
    	return true
        }
    }

    Once the AppDelegate class is created and the SDK is initialized, now in the App Scene, use the UIApplicationDelegateAdaptor property wrapper to tell SwiftUI it should use the AppDelegate class for the application delegate.

    @main
    struct SwiftUIApp: App {
    	@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
    	var body: some Scene {
            	WindowGroup {
            		ContentView()
            	}
        	}
    }
  5. Optional: Reconfigure the SDK.

    The SDK can be reconfigured as many times as necessary.

    If you have configured the Medallia Experience Orchestration SDK with all valid or invalid parameters and need to update the configuration for some or all parameters, add the following code after the configuration block:

    let builder = MedalliaMXO.configuration?.builder() ?? MXOConfigurationBuilder()
    builder.siteKey = "newSiteKey"
    builder.host = URL(string: "newHost")
    MedalliaMXO.configuration = builder.build()
    MXOConfigurationBuilder *builder = MedalliaMXO.configuration.builder ? MedalliaMXO.configuration.builder : [MXOConfigurationBuilder new];
    builder.siteKey = @"newSiteKey";
    builder.host = [NSURL URLWithString:@"newHost"];
    MedalliaMXO.configuration = [builder build];
    Note: The SDK can be reconfigured partially or with all new parameters.

You have now configured the Medallia Experience Orchestration SDK for iOS.