Excluding identity transfer links

The SDK will append a tid URL query parameter to all links opened from a mobile app. To limit this behavior to a specific set of links, exclude the links to which the SDK should not append a tid, call the mxoIdentityTransferConfiguration Kotlin top-level property or MedalliaMXO.setIdentityTransferConfiguration Java method, as shown below:

import com.medallia.mxo.identitytransfer.MXOIdentityTransferUriMatcher
import com.medallia.mxo.identitytransfer.mxoIdentityTransferConfiguration
import com.medallia.mxo.mxoIdentityTransferConfiguration
import java.net.URI

// This example shows how to exclude identity transfer links. 
// Example with ExactMatch(URI)
mxoIdentityTransferConfiguration = mxoIdentityTransferConfiguration {
	excludeList = setOf(
   	MXOIdentityTransferUriMatcher.ExactMatch(URI("http://www.google.com")),
)}

// Example with RegexMatch()
mxoIdentityTransferConfiguration = mxoIdentityTransferConfiguration{
	excludeList = setOf(
    	MXOIdentityTransferUriMatcher.RegexMatch("https://(simple|en)\\.wikipedia\\.org".toRegex())
)}

// This example shows how to edit the identity transfer configuration.
mxoIdentityTransferConfiguration = mxoIdentityTransferConfiguration.copy {
	excludeList = setOf(
		MXOIdentityTransferUriMatcher.ExactMatch(URI("http://www.newLink.com")),
        )
}
mxoIdentityTransferConfiguration = mxoIdentityTransferConfiguration.copy {
	excludeList = excludeList.orEmpty().plus(
		MXOIdentityTransferUriMatcher.ExactMatch(URI("http://www.newLink.com")),
	)
}
import com.medallia.mxo.MedalliaMXO;
import com.medallia.mxo.identitytransfer.MXOIdentityTransferConfiguration;
import com.medallia.mxo.identitytransfer.MXOIdentityTransferUriMatcher;
import java.net.URI;
import java.util.HashSet;
import java.util.Set;
import kotlin.text.Regex;

// This example shows how to exclude identity transfer links.
// Example with ExactMatch(URI)
Set<MXOIdentityTransferUriMatcher> exactMatchExcludeList = new HashSet<>();
        try {
		exactMatchExcludeList.add(new MXOIdentityTransferUriMatcher.ExactMatch(URI.create("http://www.google.com")));
        } catch (Exception e) {
            	e.printStackTrace();
        }
        MXOIdentityTransferConfiguration currentConfiguration = MedalliaMXO.getIdentityTransferConfiguration();
        MXOIdentityTransferConfiguration.Builder builder = currentConfiguration != null ? currentConfiguration.builder() : new MXOIdentityTransferConfiguration.Builder();
        MXOIdentityTransferConfiguration updatedConfiguration = builder
                .excludeList(exactMatchExcludeList)
                .build();
        MedalliaMXO.setIdentityTransferConfiguration(updatedConfiguration);

// Example with RegexMatch()
Set<MXOIdentityTransferUriMatcher> regexMatchExcludeList = new HashSet<>();
try {
	final Regex wikipediaSubDomains = new Regex("https://(simple|en)\\.wikipedia\\.org");
	regexMatchExcludeList.add(new MXOIdentityTransferUriMatcher.RegexMatch(wikipediaSubDomains));
	} catch (Exception e) {
            	e.printStackTrace();
        }
        currentConfiguration = MedalliaMXO.getIdentityTransferConfiguration();
        builder = currentConfiguration != null ? currentConfiguration.builder() : new MXOIdentityTransferConfiguration.Builder();
        updatedConfiguration = builder.excludeList(regexMatchExcludeList).build();
        MedalliaMXO.setIdentityTransferConfiguration(updatedConfiguration);


// Adding a new link to the list.
currentConfiguration = MedalliaMXO.getIdentityTransferConfiguration();
builder = currentConfiguration != null ? currentConfiguration.builder() : new MXOIdentityTransferConfiguration.Builder();
final Set<MXOIdentityTransferUriMatcher> currentExcludes = currentConfiguration != null ? new HashSet<>(currentConfiguration.getExcludeList()) : null;
final Set<MXOIdentityTransferUriMatcher> excludeList = currentExcludes != null ? currentExcludes : Set.of();
        excludeList.add(
                new MXOIdentityTransferUriMatcher.ExactMatch(
                        URI.create("http://newlink.com")
                ));
updatedConfiguration = builder
	.excludeList(excludeList)
	.build();
MedalliaMXO.setIdentityTransferConfiguration(updatedConfiguration);

If a link is excluded, a tid URL query parameter will be appended to all other links but the excluded link, but is superseded by any included identity transfer links.

Note: Setting the excluded links list to an empty list or null clears the existing list.