Saturday, 5 September 2015

Sitecore Pipelines - ParseReferrer

This post documents Sitecore's ParseReferrer 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 pupose of the ParseReferrer pipeline is to extract useful information from the referring URL. It's called from the ParseReferrer processor in the CreateVisit pipeline and contains a single processor by default.



ParseGenericSearchEngine

Namespace: Sitecore.Analytics.Pipelines.ParseReferrer
Assembly: Sitecore.Analytics
The ParseGenericSearchEngine processor is responsible for recording the term that resulted in a search engine referring a visitor to your site. The Sitecore Configuration Factory preloads the processor class with the hostnames and querystring parameter names of known search engines. They are added to a private dictionary object.

The processor loops through each of the items in the dictionary, and for each iteration it checks that:

  • The key of the current dictionary item is contained within the value of args.UrlReferrer.DnsSafeHost,
  • args.UrlReferrer.Query is not null or empty.
  • The query string from args.UrlReferrer.Query  contains the parameter name associated with the current dictionary item.

If these criteria are met, then args.Interaction.Keywords  is set to the identified query string parameter value and aborts the pipeline. Otherwise, the method moves to the next iteration of the loop.



Additional Information

John West discusses the ParseReferrer pipeline in the following blog posts: