Skip to main content

Sitecore Pipelines - CreateVisit

This post documents Sitecore's CreateVisit 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 CreateVisit pipeline is initiated from the CreateVisit processor of the IntializeTracker pipeline. In general, it's responsible for intitiating any tracking related activity that occurs in response to an HTTP request.



XForwardedFor

Namespace: Sitecore.Analytics.Pipelines.CreateVisits
Assembly: Sitecore.Analytics
The XFowardedFor processor is responsible for determining the origin IP address of the current request. It has the following requirements:

  • The Analytics.ForwardedRequestHttpHeader configuration setting must be set.
  • The HTTP request header corresponding with Analytics.ForwardedRequestHttpHeader must be present.

If either of these requirements are not met, the processor ends without performing any actions.

The processor checks to see if the selected HTTP header ends with a valid IP address. If it does, then the args.Interaction.Ip property is set to that IP address. If it's not a valid IP address, then the issue is logged and processor ends.



UpdateGeoIpData

Namespace: Sitecore.Analytics.Pipelines.CreateVisits
Assembly: Sitecore.Analytics
The UpdateGeoIpData processor simply calls the UpdateGeoIpData() method on the Interaction associated with the pipeline's args object. 



ParseReferrer

Namespace: Sitecore.Analytics.Pipelines.CreateVisits
Assembly: Sitecore.Analytics
The ParseReferrer processor is concerned with preparing the required information to run the ParseReferrer pipeline. It begins by attempting to access the args.Request.UrlReferrer object. If it's unsuccessful then the current interaction's Keywords, ReferringSite and Referrer properties are all set to an empty string, and the processor ends.

If the UrlReferrer object was successfully obtained, the following properties are set:

  • args.Interaction.ReferringSite = request.UrlReferrer.Host
  • args.Interaction.Referrer = request.UrlReferrer,ToString()
The ParseReferrer pipeline is run, passing in the current Interaction and UrlReferrer as arguments. ForwardedRequestHttpHeader. After the pipeline has completed, if args,Interaction is null then it is set to an empty string.



SetTrafficType

Namespace: Sitecore.Analytics.Pipelines.CreateVisits
Assembly: Sitecore.Analytics
The SetTrafficType processor simply runs the trafficTypes pipeline, with the aim of setting the TrafficType property of the current Interaction. The Interaction object is passed to the arguments of the pipeline.



SetChannel

Namespace: Sitecore.Analytics.OmniChannel.Pipelines.CreateVisit.SetChannel
Assembly: Sitecore.Analytics.OmniChannel
The purpose of the SetChannel processor is to set the ChannelId property of the current Interaction. It does this by running the DetermineInteractionChannel pipeline, passing in the Interaction object.




Comments