MedalliaDigital

@objcMembers
public class MedalliaDigital : NSObject

MedalliaDigital is the main component for the Medallia sdk. It includes the complete set of tools required in order to work with Medallia sdk. Calling sdkInit() method is mandatory before accessing any other method in this API.

Public

  • This method initializes the SDK and by doing so authenticates the app, and retrieves configuration elements from Medallia Digital. This method is mandatory in order to start Medallia SDK All the following vars are mandatory for init to run.

    Declaration

    Swift

    public static func sdkInit(token: String, success: @escaping () -> Void, failure: @escaping (_ error: MDExternalError) -> Void)

    Parameters

    token

    Medallia Digital developer token (can be found in the account section of your Medallia Digital dashboard). Note that this key is assigned per application.

    success

    Success Closure

    failure

    Failure Closure

  • The SDK enables the app to set custom parameters of several types. Define specific parameter to add to the submitted feedback and targeting. * If the name specified already exists, it will be overridden. The SDK supports the following types: String, Integer(or int), Long(or long), Double(or double), Float(or float), Boolean(or bool) In case the value is not one of these primitive types, custom parameter won’t be saved. value can’t be null.

    Declaration

    Swift

    public static func setCustomParameter(name: String, value: Any)

    Parameters

    name

    custom parameter name

  • The SDK enables the app to set custom parameters of several types. Define multiple parameters to add to the submitted feedback and targeting. * If the name specified already exists, it will be overridden.

    For more information, go to : setCustomParameter()

    Declaration

    Swift

    public static func setCustomParameters(_ parameters: [String : Any])

    Parameters

    parameters

    map of ‘name’(of type String) and ‘value’(of a primitive type).

  • Displaying a form on demand, usually a “Feedback” button in app menu. The SDK must be initialized for form to be displayed. The ‘ShowForm’ API can be called in parallel with the init API.

    Declaration

    Swift

    public static func showForm(_ formId: String, success: @escaping () -> Void, failure: @escaping (_ error: MDExternalError) -> Void)

    Parameters

    formId

    form id to determine which form should be shown.

    success

    Success Closure

    failure

    Failure Closure

  • Enables the app to launch forms directly from push notifications. Using this API, forms are properly opened once the pushed notification is selected.

    Declaration

    Swift

    public static func handleNotification(_ formId: String, success: @escaping () -> Void, failure: @escaping (_ error: MDExternalError) -> Void)

    Parameters

    formId

    form id to determine which form should be shown.

    success

    Success Closure

    failure

    Failure Closure

  • Setting a delegate in order to receive form displayed information. This API method allows listening to form related events, e.g. form was submitted.

    Declaration

    Swift

    public static func setFormDelegate(_ formDelegate: MDFormDelegate?)

    Parameters

    formDelegate

    MDFormDelegate

  • Setting a delegate in order to receive intercept information (Alert or Banner displayed asking the user whether he/she wants to open form/app rating/ any other engagement type object)

    Declaration

    Swift

    public static func setInterceptDelegate(_ interceptDelegate: MDInterceptDelegate?)

    Parameters

    interceptDelegate

    MDInterceptDelegate

  • Setting a delegate in order to receive feedback payload. This API method allows listening to in-form feedback content submitted by user.

    Declaration

    Swift

    public static func setFeedbackDelegate(_ feedbackDelegate: MDFeedbackDelegate?)

    Parameters

    feedbackDelegate

    MDFeedbackDelegate

  • Setting a delegate in order to receive custom intercept payload. This API method allows listening to custom intercept triggering.

    Declaration

    Swift

    public static func setCustomInterceptDelegate(_ customInterceptDelegate: MDCustomInterceptDelegate)

    Parameters

    customInterceptDelegate

    MDCustomInterceptDelegate

  • Permits app developers to suppress/disable feedback intercepts (and their respective targeting) from being prompted to the user, usually called in critical flows. This method is always bundled together with disableIntercept() as one method disables the intercept and the other re-enables it.

    • This API will not effect showForm API functionality. Customers may consider using this functionality during critical flows such as payment, live support chats, phone calls etc. Intercept is enabled by default. When called, these operations store the values in the application memory i.e. the setting remains available as long as the application is alive. Important note - this API will not affect the showForm functionality

    Declaration

    Swift

    public static func enableIntercept()
  • Permits app developers to suppress/disable feedback intercepts (and their respective targeting) from being prompted to the user, usually called in critical flows. This method is always bundled together with enableIntercept() as one method disables the intercept and the other re-enables it.

    • This API will not effect showForm API functionality. For resuming intercept functionality, go to enableIntercept() Upon every new sdkInit(token: String, success: @escaping () -> Void, failure: @escaping (_ error: MDExternalError) -> Void), the intercept mechanism will be enabled(ergo - enabled by default).

    Declaration

    Swift

    public static func disableIntercept()
  • Set log level (of type MDLogLevel) to be printed in the console The logs that will be printed will be determined by the provided log level Logs will be printed from this log level and above Default log level in the SDK is .off

    Note: if you choose log level = .off, there will be no logs at all It is highly recommended to get log level .off when App is in production/Appstore

    Declaration

    Swift

    public static func setLogLevel(_ logLevel: MDLogLevel)

    Parameters

    logLevel

    log level to determine which logs will be printed to the console

  • Stop SDK API will stop the SDK functionality. In case the API is been called with #clearData parameter true, personalized SDK data will be cleared.

    Declaration

    Swift

    public static func stopSDK(clearData: Bool = false)

    Parameters

    clearData

    clear data determines if the personalized data should be cleared in addition to stopping the SDK

  • Revert Stop SDK API will revive the SDK functionality (if it is stopped). In the next session the SDK functionality will start working as expected.

    Declaration

    Swift

    public static func revertStopSDK()
  • Set the SDK Frameowrk origin of the app

    Declaration

    Swift

    public static func setSdkFramework(_ mdSdkFrameworkType: MDSDKFrameworkType)

    Parameters

    mdSdkFrameworkType

    MDSdkFrameworkType (Native, React Native or Cordova)

  • Set the SDK Locale

    Declaration

    Swift

    public static func updateCustomLocale(_ locale: String?, success: @escaping (_ message: String?) -> Void, failure: @escaping (_ error: MDExternalError) -> Void)

    Parameters

    locale

    String?, nil to unset locale

  • Custom Intercept Trigger

    Declaration

    Swift

    public static func customInterceptTrigger(engagementId: String, actionType: MDInterceptActionType, failure: @escaping (_ error: MDExternalError) -> Void)

    Parameters

    engagementId

    String

    actionType

    MDInterceptActionType

    failure

    Failure Closure

  • Set Appearance Mode

    Declaration

    Swift

    public static func setCustomAppearance(_ appearanceMode: MDAppearanceMode)

    Parameters

    appearanceMode

    MDAppearanceMode (light or dark mode)

  • Set Debug Form

    Declaration

    Swift

    public static func setDebugForm(_ debug: Bool)

    Parameters

    debug

    Bool true to debug

  • Close Engagement

    Declaration

    Swift

    public static func closeEngagement(success: @escaping () -> Void, failure: @escaping (_ error: MDExternalError) -> Void)

    Parameters

    success

    suceess block

    failure

    failure block

  • Set User ID

    Declaration

    Swift

    public static func setUserId(_ userId: String?)

    Parameters

    userId

    String