Posts

Showing posts from March, 2021

Sitecore Live Profile access programmatically

 To access on going contact triggered Profile without waiting till session end. public class ProfileScoreAndPointsList     {         public ID ProfileID { get ; set ; }         public string ProfileKeyName { get ; set ; }         public double ProfileKeyScore { get ; set ; }     }   public Dictionary<ID, List<ProfileScoreAndPointsList>> GetTrackerInteractionProfiles()         {             Dictionary<ID, List<ProfileScoreAndPointsList>> allcategoryProfiles = new Dictionary<ID, List<ProfileScoreAndPointsList>>();             if (Tracker.Current?.Interaction != null )             {                 VisitData visitdata = Tracker.Current.Interaction.ToVisitData();                 Dictionary< string , ProfileData> data = visitdata.Profiles;                 if (data.Any())                 {                     foreach (KeyValuePair< string , ProfileData> profileCollections in data)                     {                         List&

Sitecore Live Goals access programmatically

 To access on going contact triggered goals without waiting till session end. protected List<ProfileScoreAndPointsList> GetCurrentTrackerTriggeredGoals(IInteractionData interaction)         {             List<ProfileScoreAndPointsList> profileScoreLists = new List<ProfileScoreAndPointsList>();             if (interaction != null )             {                 IEnumerable<PageEventData> events = interaction.Pages.SelectMany<Page, PageEventData>((p, v) => p.PageEvents).Select(d => d);                 profileScoreLists = events.Where(p => p.IsGoal).GroupBy(l => l.PageEventDefinitionId)                  .Select(goal => new ProfileScoreAndPointsList                  {                      ProfileID = ID.Parse(goal.Select(x => x.PageEventDefinitionId).FirstOrDefault()),                      ProfileKeyName = goal.Select(x => x.Name).FirstOrDefault(),                      ProfileKeyScore = goal.Sum(c => c.Value)                  }).ToL

Sitecore Live Tracking and component personalization with Goals and Profiles but without out Session end and out of the box Rules

We have requirement to load component with different content based on user behavior, At first we thought of using out of box sitecore component personalization rule, but we see there a problem with this approach Problem: Content author has to create different personalized datasource content for each and every scenario we have multiple category and sub categories this will end up creating a lot of personalization content Solution: Try to programmatically get the live and past Goals and profiles triggered by the contact  Based on these these dynamically suggest the content to component instead of rule. Do not wait to get the goals and profile till session end Combine the score/points of each category's with individual sub category scores Once the scores of the subcategory obtained then  rank the score of each subcategory and display content belong to that sub category in the dedicated Category Slide Create content for category and sub category item but not like creating multiple data