Opting a user out or into tracking
The following methods allow you to opt a user out of various levels of tracking, such as all, and/or city/country tracking, and also opt them back in based on your app's privacy configuration.
The Medallia Experience Orchestration SDK for Android only supports one opt out tracking level at the moment:
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.
By default, optInOptions
are set to opt-in.
Opting a user out or into all tracking
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:
import com.medallia.mxo.mxoConfigureOptOut
import com.medallia.mxo.mxoOptOutConfiguration
import com.medallia.mxo.optout.MXOOptInOptions
import com.medallia.mxo.optout.MXOOptOutConfiguration.Companion.copy
import java.util.EnumSet
// Opt a user out of all tracking.
mxoConfigureOptOut {
optOut = true
}
// Opt a user back into all tracking.
mxoOptOutConfiguration = mxoOptOutConfiguration.copy {
optOut = false
optInOptions = EnumSet.allOf(MXOOptInOptions::class.java)
}
import com.medallia.mxo.MedalliaMXO;
import com.medallia.mxo.optout.MXOOptOutConfiguration;
import com.medallia.mxo.MedalliaMXO;
import com.medallia.mxo.optout.MXOOptInOptions;
import com.medallia.mxo.optout.MXOOptOutConfiguration;
import java.util.EnumSet;
// Opt a user out of all tracking.
MXOOptOutConfiguration newMxoOptOutConfiguration = new MXOOptOutConfiguration.Builder()
.optOut(true)
.build();
MedalliaMXO.setOptOutConfiguration(newMxoOptOutConfiguration);
// Opt a user back into all tracking.
final MXOOptOutConfiguration currentMxoOptOutConfiguration = MedalliaMXO.getOptOutConfiguration();
final MXOOptOutConfiguration.Builder builder = currentMxoOptOutConfiguration != null ? currentMxoOptOutConfiguration.builder() : new MXOOptOutConfiguration.Builder();
newMxoOptOutConfiguration = builder
.optOut(false)
.optInOptions(EnumSet.allOf(MXOOptInOptions.class))
.build();
MedalliaMXO.setOptOutConfiguration(newMxoOptOutConfiguration);
optInOptions
are ignored.Opting a user into a specific tracking
This example shows how to opt a user into city/country level tracking only.
import com.medallia.mxo.mxoConfigureOptOut
import com.medallia.mxo.optout.MXOOptInOptions
import java.util.EnumSet
mxoConfigureOptOut {
optOut = false
optInOptions = EnumSet.of(MXOOptInOptions.CITY_COUNTRY_DETECTION)
}
import com.medallia.mxo.MedalliaMXO;
import com.medallia.mxo.MedalliaMXO;
import com.medallia.mxo.optout.MXOOptOutConfiguration;
import com.medallia.mxo.optout.MXOOptInOptions;
import java.util.EnumSet;
// Opt a user into city/country tracking.
final MXOOptOutConfiguration optOutConfiguration = new MXOOptOutConfiguration.Builder()
.optOut(false)
.optInOptions(EnumSet.of(MXOOptInOptions.CITY_COUNTRY_DETECTION))
.build();
MedalliaMXO.setOptOutConfiguration(optOutConfiguration);