Skip to main content

Sitecore Pipelines - TrafficTypes

This post documents Sitecore's TrafficTypes pipeline, and is part of a series providing information on all the pipelines and processors in involved in a Sitecore 8 request. It's not a line by line account, but all the key logic is described.

I'd like the post to develop over time, so if you find any inaccuracies, would like to contribute more information, or have useful links, then please leave a comment. Better still, contact me on Twitter.

All information has been written with reference to Sitecore 8 (rev 141212)

The TrafficTypes pipeline is quite simple. It's called from the SetTrafficType processor in the CreateVisit pipeline. The primary focus of each processor is to set the value of the args.TrafficType property.

Unlike several other pipelines of this type, the processors of TrafficTypes do not abort when the when the primary goal has been achieved. So it seems that args.TrafficType may be overwritten several times during the course of the pipeline. You should be mindful of this when adding your own additional processors.



Initialize

Namespace: Sitecore.Analytics.Pipelines.TrafficTypes
Assembly: Sitecore.Analytics
The Initialize processor sets a default state for the the args object. The value of args.TrafficType is set to the constant TrafficTypeValues.Direct. This ensures that if none of the other processors are able to set a value then the initial one will still be present.



ReferringSite

Namespace: Sitecore.Analytics.Pipelines.TrafficTypes
Assembly: Sitecore.Analytics
The ReferringSite processor is responsible for setting args.TrafficType depending on whether the request is a referral (i.e. the user clicked a hyperlink on another site). It has the following requirements:

  • args.Interaction.Referrer must not be null or empty.
  • Tracker.Dictionaries.ReferringSites must not be null.

If either of these criteria are not met, then the processor returns without performing any actions.

If args.Interaction.ReferringSite is the key of an item in the Tracker.Dictionaries.ReferringSites dictionary, then args.TrafficType is set to that dictionary items's TraffiicType property. Otherwise, args.TrafficType is set to the constant TrafficTypeValues.ReferredOther.



SearchKeywords

Namespace: Sitecore.Analytics.Pipelines.TrafficTypes
Assembly: Sitecore.Analytics
The SearchKeywords processor is responsible for setting args.TrafficType depending on whether the request originated from a search engine result. It simply checks the value of args.Interaction.Keywords. If that isn't null or empty, then args.TrafficType is set to the constant TrafficTypeValues.Organic.



OrganicBranded

Namespace: Sitecore.Analytics.Pipelines.TrafficTypes
Assembly: Sitecore.Analytics
The OrganicBranded processor is responsible for setting args.TrafficType depending on whether the the current interaction's keywords match any in a predetermined list. It initially checks the args.Interaction.Keywords property. If it's null or empty then the processor returns without performing any actions.

Next, the processor gets the object at the path "/sitecore/system/Settings/Analytics/Organic Branded Keywords" within the Tracker.DefinitionDatabase (it returns without doing anything if the item doesn't exist).

The value of the  item's "Keywords" field is read and converted in to an array of strings (delimited by a line break). If the array contains the value of args.Interaction.Keywords, then args.TrafficType is set to the constant TrafficTypeValues.OrganicBranded,


Comments