Sitecore Experience Platform

Register interactions using the interaction registry

Abstract

Use the interaction registry to track offline interactions in xDB

An interaction is the exchange of communication and commitment between a contact and an organization that takes place through one or more channels. The interaction registry is a service that enables you to register or create an interaction that you have tracked in Sitecore or in a non-Sitecore environment in the Experience Database (xDB).

The interaction record is a data structure that includes all the details of an interaction that you want to register in the xDB. It contains information such as the date and time of the interaction, as well as its language, channel, and venue. You can submit these interaction records to the interaction registry. You can also track interactions from an external website. These are registered as an interaction recording in the xDB.

When you submit an interaction to the interaction registry, a session is created and the interaction is replayed against the Sitecore tracker. This ensures that the xDB consistently captures campaigns and events triggered across interactions.

The interaction registry also ensures that the interaction is scheduled for aggregation after it has been saved to the xDB.

Note

By default, the interaction registry is only available in the content delivery web role as it is dependent on tracking functionality. To use the interaction registry on a dedicated content management server you need to enable or disable additional configuration files.

You can create an interaction recording with a single touchpoint. A touchpoint refers to the venue or channel of an interaction. You can register interactions with multiple touchpoints.

To register an interaction using the interaction registry:

  1. Create an interaction recording containing at least one touchpoint. You must register the interaction using the InteractionRecord class, which is available in the Sitecore.Analytics.Tracking.External namespace.

    In the code, use the following sample:

    public InteractionRecord Build( )
    {
          Guid homeItemId = Sitecore.ItemIDs.ContentRoot.ToGuid();
          DateTime homeAccessed = new DateTime(2014, 7, 6, 13, 12, 57, DateTimeKind.Utc);
          TimeSpan homeDuration = TimeSpan.FromSeconds(37);
          TouchPointRecord home = new TouchPointRecord(tpHomeItemId, tpHomeAccessed, tpHomeDuration);
          home.Campaigns.Add(CampaignIds["Paid Campaign"]);
          Guid channelId = MyCampaigns.MyCampaignId;
          InteractionRecord interaction = new InteractionRecord("The Sales App", channelId, null);
          interaction.TouchPoints.Add(home);
          return interaction;
    }
    
  2. Submit the interaction to the xDB.

    In the code, use the following sample:

    public Register( )
    {
        InteractionRecord interaction = this.Build();
        InteractionRegistryBase registry =
            ((InteractionRegistryBase) Factory.CreateObject("interactionRegistry", true));
        registry.Register("web", interaction);
    }