Add interactions
Use the client.AddInteraction() extension method to add a new interaction to a new or existing contact. Interactions must have at least one event, which can be a core collection model event or a custom event. Interactions have the following mandatory properties that must be passed in as constructor parameters:
-
The contact that the interaction belongs to
-
The initiator of the interaction, such as the user or the brand
-
The user agent of the application or service that is creating the interaction - such as ‘Chrome’
-
The ID of the channel that resulted in the interaction, such as a YouTube ad or affiliate referral
New interactions are not available in the contact’s Interactions collection after the interaction has been submitted to xConnect. To see new interactions, you must request the contact again and use expand options to retrieve the contact’s interactions.
Add an interaction to a new contact
Add an interaction to a new contact
The following example demonstrates how to add a new interaction to a new contact. The interaction has a single PageViewEvent.
If xConnect fails to create a new contact, the operation to add a new interaction will also fail.
Add interaction to an existing contact
Add interaction to an existing contact
In the following example, the interaction is being added to an existing contact: