Including identity transfer links
The SDK will append a tid
URL query parameter to all links opened from a mobile app. To limit this behavior and only append a tid
to a specific set of links, include the links to which the SDK should append a tid
, call the method identityTransferConfiguration
and passing your links as shown below:
// This example shows how to include identity transfer links.
var includeList = [MXOIdentityTransferUriMatcher]()
// Example with MXOIdentityTransferUriMatcher(withUrl:)
if let google = URL(string: "www.google.com"), let includeGoogle = try? MXOIdentityTransferUriMatcher(withUrl: google) {
includeList.append(includeGoogle)
}
// Example with MXOIdentityTransferUriMatcher(withRegex:)
if let wiki = try? NSRegularExpression(pattern: ".*\\.wikipedia\\.com"), let includeWiki = try? MXOIdentityTransferUriMatcher(withRegex: wiki) {
includeList.append(includeWiki)
}
MedalliaMXO.identityTransferConfiguration = MXOIdentityTransferConfiguration { builder in
builder.includeList = includeList
}
// This example shows how to edit the identity transfer configuration.
if let newlink = URL(string: "www.newlink.com"), let includeNewlink = try? MXOIdentityTransferUriMatcher(withUrl: newlink) {
let builder = MedalliaMXO.identityTransferConfiguration?.builder() ?? MXOIdentityTransferConfigurationBuilder()
var includeList = builder.includeList ?? [MXOIdentityTransferUriMatcher]()
includeList.append(includeNewlink)
builder.includeList = includeList
MedalliaMXO.identityTransferConfiguration = builder.build()
}
// This example shows how to include identity transfer links.
NSError *error;
NSMutableArray<MXOIdentityTransferUriMatcher *> *includeList = [@[] mutableCopy];
// Example with MXOIdentityTransferUriMatcher(withUrl:)
MXOIdentityTransferUriMatcher *google = [MXOIdentityTransferUriMatcher initWithUrl:[NSURL URLWithString:@"www.google.com"] error:&error];
[includeList addObject:google];
// Example with MXOIdentityTransferUriMatcher(withRegex:)
MXOIdentityTransferUriMatcher *wiki = [MXOIdentityTransferUriMatcher initWithRegex:[NSRegularExpression regularExpressionWithPattern:@".*\\.wikipedia\\.com" options:0 error:nil] error:&error];
[includeList addObject:wiki];
MedalliaMXO.identityTransferConfiguration = [MXOIdentityTransferConfiguration initWithBuilder:^(MXOIdentityTransferConfigurationBuilder * _Nonnull builder) {
builder.includeList = [includeList copy];
}];
// This example shows how to edit the identity transfer configuration.
NSError *error;
NSURL *newlink = [NSURL URLWithString:@"www.newlink.com"];
MXOIdentityTransferUriMatcher *includeNewlink = [MXOIdentityTransferUriMatcher initWithUrl:newlink error:&error];
MXOIdentityTransferConfigurationBuilder *builder = MedalliaMXO.identityTransferConfiguration.builder ? MedalliaMXO.identityTransferConfiguration.builder : [MXOIdentityTransferConfigurationBuilder new];
NSMutableArray<MXOIdentityTransferUriMatcher *> *includeList = builder.includeList ? [builder.includeList mutableCopy] : [@[] mutableCopy];
[includeList addObject:includeNewlink];
builder.includeList = [includeList mutableCopy];
MedalliaMXO.identityTransferConfiguration = [builder build];
When a link is included, a tid
URL query parameter will be appended to the included link only, superseding any excluded identity transfer links.