Posts

Showing posts from 2021

Restrict Content publishing for user have read only access to content

Image
We have a multisite Sitecore instance, and we have created different roles for each site for content authoring, we have not used workflow.   The user from one site can view the read-only content from another site but is he able to edit only their site alone.   Recently one of the content author published the Sitecore/Content with P ublish subitems  selected this results in publishing all the content from another site as well which are not supposed to be published.   So we thought of restricting this behavior.   we have an option to restrict the user from publishing the content who does not have rights.    < setting   name = " Publishing.CheckSecurity "   value = " true "  />   unfortunately, the above option won’t work for us, as the above setting will still publish the content if the user has read access to the content. So, I have created a custom pipeline to hide the publish button from the ribbon for the user content that has read-only access.

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