Opting a user out or into tracking

The following methods allow you to opt a user out of various levels of tracking, such as Interaction, keychain TID storage, and/or city/country tracking, and also opt them back in based on your app's privacy configuration.

The Medallia Experience Orchestration SDK for iOS supports the following opt out tracking levels:

  • CITY_COUNTRY_DETECTION — city and country information is populated in the Device Data Adapter based on the device connecting to MXO. Medallia Experience Orchestration resolves the device IP based on the connection made and maps this to the user's IP location. When opted out of city/country detection. this information will not be visible in the MXO Device Data Adapter.

  • INTERACTION_TRACKING — properly configured in MXO Interaction Points automatically send Interaction requests:

    • when the app is opened for the first time as a result of the app being installed or reinstalled

    • when a View Controller appears on screen

    • when a link is opened from the app

    When opted out of Interaction tracking, the above requests will not be sent to MXO.

  • KEYCHAIN_TID_STORAGE — when an app is configured in User or Preview mode, the TID gets automatically generated by MXO and assigned to each customer who visits a mobile Touchpoint. The returned TID gets stored in the Keychain for each Site Key and Touchpount configuration. When opted out of Keychain TID storage, the TID will not be stored in the Keychain.

By default, all optInOptions are set to opt-in.

Note: For instructions on how to completely remove a user's data from Medallia Experience Orchestration, see our api documentation.
Important: When opted out, tracking will stop and locally queued data will be removed. Setting the optOutConfiguration to nil will reset it, and opt back into all tracking options.

Opting a user out or into all tracking options

To opt out a user from all tracking when the user does not give permission to be tracked in the client app, call the opt out method as shown below:

// Opt a user out of all tracking options.
MedalliaMXO.optOutConfiguration = MXOOptOutConfiguration { builder in
	builder.optOut = true
}

// Opt a user back into all tracking options.
let builder = MedalliaMXO.optOutConfiguration?.builder() ?? MXOOptOutConfigurationBuilder()
builder.optOut = false
builder.optInOptions = [.cityCountryDetection, .keychainTidStorage, .interactionTracking]
MedalliaMXO.optOutConfiguration = builder.build()
// Opt a user out of all tracking options.
MedalliaMXO.optOutConfiguration = [MXOOptOutConfiguration initWithBuilder:^(MXOOptOutConfigurationBuilder * _Nonnull builder) {
	builder.optOut = YES;
}];

// Opt a user back into all tracking options.
MXOOptOutConfigurationBuilder *builder = MedalliaMXO.optOutConfiguration.builder ? MedalliaMXO.optOutConfiguration.builder : [MXOOptOutConfigurationBuilder new];
builder.optOut = NO;
builder.optInOptions = (CityCountryDetection | KeychainTidStorage | InteractionTracking);
MedalliaMXO.optOutConfiguration = [builder build];
Important: When the optout flag is set to true, all optInOptions are ignored. No tracking of any kind will occur in this case.

Opting a user into a specific tracking

To opt in a user into a specific tracking, use any combination of optInOptions from the below examples:

// Opt a user into interaction and keychain TID storage tracking.
MedalliaMXO.optOutConfiguration = MXOOptOutConfiguration { builder in
	builder.optOut = false
	builder.optInOptions = [.interactionTracking, .keychainTidStorage]
}

// Update an optout configuration to opt a user into city/country tracking only.
let builder = MedalliaMXO.optOutConfiguration?.builder() ?? MXOOptOutConfigurationBuilder()
builder.optOut = false
builder.optInOptions = .cityCountryDetection
MedalliaMXO.optOutConfiguration = builder.build()
// Opt a user into interaction and keychain TID storage tracking.
MedalliaMXO.optOutConfiguration = [MXOOptOutConfiguration initWithBuilder:^(MXOOptOutConfigurationBuilder * _Nonnull builder) {
	builder.optOut = NO;
        builder.optInOptions = (InteractionTracking | KeychainTidStorage);
}];

// Update an optout configuration to opt a user into city/country tracking only.
MXOOptOutConfigurationBuilder *builder = MedalliaMXO.optOutConfiguration.builder ? MedalliaMXO.optOutConfiguration.builder : [MXOOptOutConfigurationBuilder new];
builder.optOut = NO;
builder.optInOptions = CityCountryDetection;
MedalliaMXO.optOutConfiguration = [builder build];