Refactored: How Sitecore assigns the channel to interaction
Some background – What are Channels in Sitecore?
According to Sitecore documentation, Channels are the paths that contacts use to interact with your brand through campaigns and face-to-face interactions.
There are various ways that contacts can interaction with your brand (website) through:
- An app on a mobile phone
- By clicking on an advertisement on a social network to visit your website
- To visit a physical store to purchase an item
With the Sitecore Experience Platform, you can track the interactions the contacts has with your website through different campaigns you created in Sitecore.
Channels can also be used to create personalization rules that implement conditional renderings of components based on a contact’s channel.
There are two basic types of channels provided by Sitecore:
- Online Channels – like PPC advertisements, a branded mobile application, social media references, and organic searches
- Offline channels – like trade shows, direct marketing through the mail, meetings with customers, and conversations with customer service agents over the phone
By comparing channel traffic, goal conversion, and visitor engagement values across channels, you can examine how contacts interact with your website.
In this article we will talk about Online Channels provided by Sitecore and how they are resolved by different pipelines during request processing.
Sitecore comes with a number of pre-defined Online channel groups and channels. And you can also create your own channel groups and channels if needed.
How Sitecore resolves the Channel?
Sitecore uses different pipelines for collection Analytics data and in one those pipelines the channel is resolved and assigned to the current interaction for the contact.
- The initializeTracker pipeline has a processor for creating the visit instance initialized with different data to be stored in xDB.
- The Sitecore.Analytics.Pipelines.InitializeTracker.CreateVisit processor is responsible for initializing the interaction and in the process the CreateVisit pipeline is executed.
- The CreateVisit pipeline from Sitecore.Analytics.Tracking.config. This pipeline has different processors and one of them is the Sitecore.Analytics.OmniChannel.Pipelines.CreateVisit.SetChannel.
- The Sitecore.Analytics.OmniChannel.Pipelines.CreateVisit.SetChannel processor calls the DetermineInteractionChannel pipeline.
- The DeterminInteractionChannel has the following three processors:
- Sitecore.Analytics.OmniChannel.Pipelines.DetermineInteractionChannel.DefaultChannel – This processor is the very first and is responsible for setting the Default Channel, which is the Direct channel, to the interaction.
- Sitecore.Analytics.OmniChannel.Pipelines.DetermineInteractionChannel.SearchKeywords – This processor is responsible for setting the Organic non-branded search channel to the interaction. This processor checks if the interaction object has a keywords property set or not. If the keywords property is set then the channel id is set for the Organic non-branded search channel.
- Sitecore.Analytics.OmniChannel.Pipelines.DetermineInteractionChannel.OrganicBranded – This processor checks if the incoming search keyword has been configured in Sitecore (/sitecore/system/Settings/Analytics/Organic Branded Keywords) to make that search organic. If the keyword is found in the configuration, then the channel ID is set for the Organic branded search channel.
You might have a question that how the search keywords are processed and how Sitecore identifies that the user is coming from the search engine?
I also had same question and to get the answer, I started digging more inside the Sitecore code and pipelines.
There I found the answer. There is a pipeline called parseReferrer which has a processor Sitecore.Analytics.Pipelines.ParseReferrer.ParseGenericSearchEngine, which is responsible for identifying the incoming request and observe the referrer of the request. This processor takes the engines as input parameters as shown in the below image.
As you see in the above image, based on the provided hostname and parametername, the processor resolves the keywords and assign those values in the Keywords property of the interaction object. So, if we have any custom search engine and want to let Sitecore know that, we can create a patch configuration file to add that custom search engine through this processor.
Hope my findings will provide good insights about how Sitecore resolves channel and assign it to the interaction of the contact.