Configuring CapacitorJS SDK

The Medallia Experience Orchestration CapacitorJS SDK performs merge updates when provided with JavaScript Configuration Objects with undefined configuration properties. However, if an undefined or null Configuration is provided, then the MXO configuration is cleared. 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. For more information, see setOptOutConfiguration.

The Medallia Experience Orchestration CapacitorJS SDK supports User and Admin modes.

  • Admin mode — Admin mode provides you with an interface that lets you add Interaction Points, Activity Capture Points, and Attribute Capture Points to native UI elements within the app. However, hybrid apps do not support this feature because hybrid solutions typically use non-native UI elements. Only Preview mode is supported to view your unpublished (In the Works) configuration before publishing it to your live environment.

  • User mode — The User mode build should be made available through the App or Play Store, when you are satisfied that all insights are being tracked in Admin mode and internal QA requirements have been met.

Configure the CapacitorJS SDK to send Interactions in your app, by executing the following steps:
Note: Depending on which CapacitorJS SDK mode you want to configure your app with, execute step 1 or 2 accordingly.
  1. Set up the SDK in User mode for App and Play Store builds.

    To start capturing, and receiving Optimizations with the Medallia Experience Orchestration Capacitor SDK in User mode, you must first configure it with your Medallia Experience Orchestration API parameters. You can find your Medallia Experience Orchestration API parameters on the API Credentials page.

    For more information on finding these parameters, see Integrating MXO with your mobile app.

    With your parameters ready at hand, add the following lines at the start of your app's lifecycle.

    import MedalliaMXO from '@medallia/mxo-capacitor-js-sdk';
    
    const configuration = {
    	mode : 0,
    	host : "https://na5.thunderhead.com",
          	siteKey : "ONE-XXXXXXXXXX-1022",
          	touchpoint : "capacitor://touchpoint"
    }
        
    MedalliaMXO.setConfiguration(configuration)
    	.then((mxoResult) => {
    		if (mxoResult.value) {
                		console.error(mxoResult.value)
              	} else {
    			console.log("Configured MXO")
              	}
    	})
    	.catch((e) => {
    		console.error(e)
    	})
    
    import MedalliaMXO, {MXOResult, MXOError, MXOConfiguration} from '@medallia/mxo-capacitor-js-sdk';
    
    try {
    	const configuration : MXOConfiguration = {
            	mode : 0, 
    		host : "https://na5.thunderhead.com", 
            	siteKey : "ONE-XXXXXXXXXX-1022", 
            	touchpoint : "capacitor://touchpoint"
    	}
          	const result = await MedalliaMXO.setConfiguration(configuration)
          	if (result.value) {
            	const mxoError : MXOError = result.value
            	console.error(mxoError)
          	} else {
            	console.log("Configured MXO")
          	}
    } catch (e) {
    	console.error(e)
    }
    
  2. 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 Admin mode.

    To use the framework in Admin mode, simply change the mode to 1, as follows:

    import MedalliaMXO from '@medallia/mxo-capacitor-js-sdk';
    
    const configuration = {
    	mode : 1,
    	host : "https://na5.thunderhead.com",
          	siteKey : "ONE-XXXXXXXXXX-1022",
          	touchpoint : "capacitor://touchpoint"
    }
        
    MedalliaMXO.setConfiguration(configuration)
    	.then((mxoResult) => {
    		if (mxoResult.value) {
                		console.error(mxoResult.value)
              	} else {
    			console.log("Configured MXO")
              	}
    	})
    	.catch((e) => {
    		console.error(e)
    	})
    import MedalliaMXO, {MXOResult, MXOError, MXOConfiguration} from '@medallia/mxo-capacitor-js-sdk';
    
    try {
    	const configuration : MXOConfiguration = {
            	mode : 1, 
    		host : "https://na5.thunderhead.com", 
            	siteKey : "ONE-XXXXXXXXXX-1022", 
            	touchpoint : "capacitor://touchpoint"
    	}
          	const result = await MedalliaMXO.setConfiguration(configuration)
          	if (result.value) {
            	const mxoError: MXOError = result.value
            	console.error(mxoError)
          	} else {
            	console.log("Configured MXO")
          	}
    } catch (e) {
    	console.error(e)
    }
    

You have now configured the Medallia Experience Orchestration CapacitorJS SDK for your app.