This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Sitecore.Tools.Extensions | |
{ | |
using System; | |
using System.Collections; | |
using Sitecore.Data.Items; | |
using Sitecore.Diagnostics; | |
using Sitecore.Jobs; | |
using Sitecore.Tasks; | |
public class DatabaseAgent : Tasks.DatabaseAgent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> | |
<sitecore> | |
<scheduling> | |
<!-- An agent that processes scheduled tasks embedded as items in the master database. --> | |
<agent type="Sitecore.Tools.Extensions.DatabaseAgent" method="Run" interval="00:10:00" name="Master_Database_Agent"> | |
<param desc="database">master</param> | |
<param desc="schedule root">/sitecore/system/tasks/schedules</param> | |
<LogActivity>true</LogActivity> | |
</agent> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private readonly ID clickPageEventCategoryItemId = new ID("Item ID of the Content Event Click"); | |
public void OnItemSaved(object sender, EventArgs args) | |
{ | |
var savedItem = Event.ExtractParameter(args, 0) as Item; | |
if (savedItem == null || savedItem.Database.Name.ToLower() != "master") | |
{ | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void CreateClickContentEvent(Guid itemId) | |
{ | |
if (Tracker.IsActive && Tracker.Current != null) | |
{ | |
Assert.IsNotNull(Tracker.Current, "Tracker.Current"); | |
if (Tracker.Current != null) | |
{ | |
Assert.IsNotNull(Tracker.Current.Session, "Tracker.Current.Session"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AnalyticsDownloadCrawler : AnalyticsObserverCrawler<DownloadEventIndexable> | |
{ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DownloadEventIndexable : AbstractIndexable | |
{ | |
public DownloadEventIndexable(PageEventData eventData, string url, Guid interactionId, Guid contactId) | |
{ | |
var str = interactionId + url + eventData.DataKey; | |
this.Id = (IndexableId<string>)str; | |
this.UniqueId = new IndexableUniqueId<Guid, string>(contactId, $"downloadEvent|{str}"); | |
this.DataSource = "sitecore_aggregation"; | |
this.AbsolutePath = string.Empty; | |
this.Culture = CultureInfo.GetCultureInfo(ContentSearchManager.SearchConfiguration.AnalyticsDefaultLanguage); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DownloadEventIndexableLoadFieldsPipelineArgs : IndexableLoadFieldsPipelineArgs | |
{ | |
public DownloadEventIndexableLoadFieldsPipelineArgs(PageEventData eventData, string url, Guid interactionId, Guid contactId) | |
{ | |
this.EventData = eventData; | |
this.Url = url; | |
this.InteractionId = interactionId; | |
this.ContactId = contactId; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DownloadEventIndexableLoadFieldsPipeline | |
{ | |
public static List<IIndexableDataField> Run(ICorePipeline pipeline, DownloadEventIndexableLoadFieldsPipelineArgs args, string pipelineName = "downloadeventindexable.loadfields") | |
{ | |
try | |
{ | |
pipeline.Run(pipelineName, args); | |
} | |
catch | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DownloadLoadFields : DownloadIndexableLoadFieldsProcessor | |
{ | |
protected override IEnumerable<IIndexableDataField> GetFields(DownloadEventIndexableLoadFieldsPipelineArgs args) | |
{ | |
Assert.ArgumentNotNull(args, nameof(args)); | |
PageEventData eventData = args.EventData; | |
Assert.IsNotNull(eventData, "eventData"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class DownloadIndexableLoadFieldsProcessor | |
{ | |
public virtual void Process(DownloadEventIndexableLoadFieldsPipelineArgs args) | |
{ | |
if (args == null) | |
throw new ArgumentNullException(nameof(args)); | |
args.Fields.AddRange(this.GetFields(args)); | |
} | |
protected abstract IEnumerable<IIndexableDataField> GetFields(DownloadEventIndexableLoadFieldsPipelineArgs args); |