Skip to content

Instantly share code, notes, and snippets.

@BillCacy
BillCacy / ProcessQueryStringCampaignEx.cs
Last active October 20, 2020 22:33
Override of Sitecore.Analytics.Pipelines.StartTracking.ProcessQueryStringCampaign to prevent campaign triggering when the end date has passed.
using System;
using Sitecore.Abstractions;
using Sitecore.Analytics.Pipelines.StartTracking;
using Sitecore.Data;
namespace YOURNAMESPACE.Analytics.Pipelines.StartTracking
{
public class ProcessQueryStringCampaignEx : ProcessQueryStringCampaign
{
public ProcessQueryStringCampaignEx() : base() { }
@BillCacy
BillCacy / ProcessQueryStringCampaign.xml
Created October 20, 2020 22:58
Patch file for overriding the Sitecore.Analytics.Pipelines.StartTracking.ProcessQueryStringCampaign
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
<sitecore role:require="Standalone or ContentDelivery or ContentManagement">
<pipelines>
<startTracking>
<!-- Patched to handle instances where campaign is expired but can still be triggered -->
<processor type="Sitecore.Analytics.Pipelines.StartTracking.ProcessQueryStringCampaign, Sitecore.Analytics">
<patch:attribute name="type">YOURNAMESPACE.Analytics.Pipelines.StartTracking.ProcessQueryStringCampaignEx, YOURNAMESPACE.Analytics</patch:attribute>
</processor>
</startTracking>
</pipelines>
@BillCacy
BillCacy / Replace-ReferencedRendering-Header.ps1
Created December 2, 2021 01:33
Sitecore Powershell Script to replace existing rendering with a new rendering
Set-Location master:
function Get-ItemBasedOnTemplate {
param(
[string]$TemplateId
)
$queue = New-Object System.Collections.Queue
$processedLookup = New-Object System.Collections.Generic.HashSet[string]
if(-not(Test-Path -Path "master:$($TemplateId)")) { return }