Skip to content

Instantly share code, notes, and snippets.

public static class TrackingProcessor
{
public static void ProcessProfiles(CurrentInteraction interaction, TrackingField field)
{
Assert.ArgumentNotNull(interaction, "interaction");
Assert.ArgumentNotNull(field, "field");
foreach (var profile1 in field.Profiles)
{
if (profile1.Name.Equals("Your Profile Name Here"))
{
continue;
}
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<processItem>
<processor type="Your Namespace with Class,Your Assembly Name"
patch:instead="processor[@type='Sitecore.Analytics.Pipelines.ProcessItem.ProcessProfiles, Sitecore.Analytics']"/>
</processItem>
</pipelines>
</sitecore>
</configuration>
@hishaamn
hishaamn / ContactPatternHelper.cs
Created August 12, 2017 17:29
Helper to Boost User Pattern
public static void BoostUserPattern(Session userSession, string patternName)
{
var patternCards =
Context.Database.GetItem("Path or Id of required Profile pattern card container").Children;
var patternCard = patternName.ToLower().Equals("register")
? patternCards.FirstOrDefault(w => w.Name.ToLower().Equals("register"))
: patternCards.FirstOrDefault(w => w.Name.ToLower().Equals("unknown"));
if (patternCard == null)
public class ContentFlowKey : DictionaryKey
{
/// <summary>
/// Gets or sets the timestamp.
/// </summary>
public DateTime Timestamp { get; set; }
/// <summary>
/// Gets or sets the contact id.
/// </summary>
using Sitecore.Analytics.Aggregation.Data.Model;
/// <summary>
/// The content flow value.
/// </summary>
public class ContentFlowValue : DictionaryValue
{
/// <summary>
/// Gets or sets the count.
/// </summary>
using Sitecore.Analytics.Aggregation.Data.Model;
/// <summary>
/// The content view.
/// </summary>
public class ContentFlow : Fact<ContentFlowKey, ContentFlowValue>
{
/// <summary>
/// Initializes a new instance of the <see cref="ContentFlow"/> class.
/// </summary>
public class ContentFlowAggregationProcessor : AggregationProcessor
{
protected override void OnProcess(AggregationPipelineArgs args)
{
Assert.ArgumentNotNull(args, "args");
VisitData visit = args.Context.Visit;
if (visit.Pages == null || visit.Pages.Count <= 0)
{
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<group groupName="analytics.aggregation">
<pipelines>
<interactions>
<processor type="YourNamespaceWithClassname, YourAssemblyName" />
</interactions>
</pipelines>
</group>
@hishaamn
hishaamn / CustomCrawler.cs
Created November 23, 2017 12:36
Custom Sitecore Index Crawler
public class CustomCrawler : SitecoreItemCrawler
{
protected override bool IsExcludedFromIndex(SitecoreIndexableItem indexable, bool checkLocation = false)
{
IDocumentBuilderOptions documentOptions = this.DocumentOptions;
Assert.IsNotNull(documentOptions, "DocumentOptions");
Item item = indexable.Item;
Assert.ArgumentNotNull(item, "item");
if (item == null)