Skip to content

Instantly share code, notes, and snippets.

public class AnalyticsDownloadEventAggregator : ObservableAggregator<DownloadEventIndexable>
{
public AnalyticsDownloadEventAggregator(string name) : base(name)
{
}
protected override IEnumerable<DownloadEventIndexable> ResolveIndexables(AggregationPipelineArgs args)
{
if (args.Context.Contact == null)
{
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<group groupName="analytics.aggregation">
<pipelines>
<interactions>
<!-- Custom Download Aggregator -->
<processor type="YourNamespace.AnalyticsDownloadEventAggregator, YourAssemblyName">
<param desc="name">DownloadAggregationObservable</param>
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<contentSearch>
<configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
<indexes hint="list:AddIndex">
<index id="sitecore_analytics_index" type="Sitecore.ContentSearch.LuceneProvider.LuceneIndex, Sitecore.ContentSearch.LuceneProvider">
<locations hint="list:AddCrawler">
<!-- Custom Download Crawler -->
<crawler type="YourNamespace.AnalyticsDownloadCrawler, YourAssembly">
$categoryCountProps = @{
Parameters = @(
@{ Name = "categoryCount"; Title = "Number of categories"; Tab = "Categories" }
)
Title = "Categories"
Description = "Add the number of categories required"
OkButtonName = "Proceed"
CancelButtonName = "Abort"
Width = 600
Height = 400
$categoriesCount = [int]$categoryCount
$counter = 1
$pattern = ""
for($i = 0; $i -lt $categoriesCount; $i++){
$catName = "Category$i"
if($i -eq $categoriesCount - 1){
$categoryCountProps = @{
Parameters = @(
@{ Name = "categoryCount"; Title = "Number of categories"; Tab = "Categories" }
)
Title = "Categories"
Description = "Add the number of categories required"
OkButtonName = "Proceed"
CancelButtonName = "Abort"
Width = 600
Height = 400
Import-Function -Name CleanQueryPath
$paths = @("/sitecore/content/My Site/Site 1/home=en-GB")
foreach($path in $paths){
$results = @();
$splitter = $path -split "="
$editorials = Get-Item -Path master: -Query "$(CleanQueryPath -Path $splitter[0])//*[@@templateid='{5963CF27-6FC4-4C70-96E5-3BA55136E23C}' or @@templateid='{90F7233C-341D-4359-8CD6-D9ADF8A18BE4}']" -Language $splitter[1]
function CleanQueryPath {
param([Parameter(Mandatory=$true)] $Path)
$pathComponents = $Path.Split('/')
$cleansedPath = [System.Linq.Enumerable]::Select($pathComponents, [Func[string,string]]{
param($x)
if(($x -like "* *") -or ($x -like "*-*")) {
return "#$($x)#"
}
else {
@hishaamn
hishaamn / Tagger.cs
Created August 1, 2018 14:10
Tag content with proper profile card and key values
using System;
using System.Collections.Generic;
using System.Linq;
using Sitecore.Analytics.Data;
using Sitecore.Data.Items;
using Sitecore.Extension.Analytics.Entities;
using Sitecore.StringExtensions;
public class Tagger
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using Sitecore.Analytics.Data;
using Sitecore.Data.Items;
using Sitecore.Diagnostics;
using Sitecore.Extension.Analytics.Entities;
using Sitecore.SecurityModel;