Target contact operations


Overview of target contact operations used in contact merges.

xConnect is able to merge multiple contacts into a single contact. The tracker can identify if two contacts are the same visitor and run the MergeContacts operation to merge their behavioral data under the single target contact.

Map of known and unknown contacts to merge using MergeInfo facet data.

xConnect can find and load the target contacts using the MergeInfo facet data. This facet contains the target contact identifier, but it requires additional requests to xConnect.

There are two operations for targeting contacts for merges.

The xConnect Client API includes the asynchronous operation GetTargetContactAsync and the synchronous operation GetTargetContact, which allows you to get the target contact even if the source contact ID is specified.


var expandOptions = new ContactExpandOptions(

var executionOptions = new ContactExecutionOptions(expandOptions);

var actualContact = await _client.GetTargetContactAsync(sourceContact.Id.Value, executionOptions);

The GetDeviceProfileAsync operation loads the device profile by the specified device profile reference. This operation has options to specify whether to load the last known contact together with the device.

The DeviceProfileExecutionOptions class includes the LoadTargetContact option, which specifies whether the device profile must load the last known contact by the assigned contact ID or the target contact instead.

var expandOptions = new DeviceProfileExpandOptions
   ContactExpandOptions = new ContactExpandOptions()
var executionOptions = new DeviceProfileExecutionOptions(expandOptions)
   LoadTargetContact = loadTargetContact

DeviceProfile savedDeviceProfile = await _client.GetDeviceProfileAsync(
   new DeviceProfileReference(deviceProfile.Id.Value), executionOptions);