Posts

Adding usernames and urls to the Sitecore default Log files

When troubleshooting issues, the log files become one of our best allies, however, sometimes the information we get is not enough to clearly pinpoint the issue. Therefore, adding some additional information to the errors can be beneficial. In this post, I will show how you can create a custom LogFileAppender to use instead of the default one used with an OOTB Sitecore 9.1 installation.

First, let's check how the default LogFileAppender is configured in a Sitecore 9.1 instance. If we check the Sitecore.config we'll see something like this: 

<appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender, Sitecore.Logging"> <file value="$(dataFolder)/logs/log.{date}.{time}.txt" /> <appendToFile value="true" /> <rollingStyle value="Size" /> <maxSizeRollBackups value="-1" /> <maximumFileSize value="10MB" /> <…

Sitecore - Custom 500 error page

There's a ton of posts out there showing how to implement a custom 500 error page in Sitecore. However, I am going to propose a new method to accomplish the same, with the possibility to have a content managed error page and a static error page (this method works for multisite implementations).

The scenario is the following, if there's a 500 error we want to display a content managed error page, and if that content managed error page is erroring out as well, we want to display a static error page. Let's see how we can accomplish this.
1. On your web.config add the following: 
<system.web> <customErrors mode="RemoteOnly" redirectMode="ResponseRewrite"> <error statusCode="500" redirect="error.aspx" /> </customErrors> </system.web>
With this, we are basically saying that we do not want a redirection, but instead, the page that is erroring out will have the content of our custom error.as…

Sitecore - "Multiple controls with the same ID were found" Issue Fixed

Image
This is a short post about an issue I encountered recently. I went to the Experience Editor to build out a new page with some components we had already built, but when I added a rendering that had some placeholders in it, I wasn't able to add any modules. I dug into the issue a bit deeper and found out that when trying to see the details of the placeholder setting I was getting the following error:


This is a weird one because by default Sitecore wouldn't allow you to add a duplicated rendering to a placeholder setting, you would get an error like this:


To my surprise, I found that the placeholder setting in mention had a duplicated rendering: 

The issue must have arisen as the result of a merge conflict, but removing the duplicate fixed the issue. 


Happy troubleshooting!

Sitecore - Track user events in a delimited time frame

Almost always we need to track what users have been doing on our site, but what if we need to know if a user has performed a specific action within a certain time period? Recently I was asked to write code that reacts to some form events, e.g. upon submission some forms needed to be hidden and an alert needed to be shown if the submission happened within x days. One of the possible solutions we thought of was to use Sitecore Goals. Once a user submitted a form we registered a goal, on the next page load we checked if the goal was triggered (within a certain time frame) and we hid the form if needed.

The following code will allow you to register goals for the current logged in user:

public void TriggerGoal(ID goalId, string additionalData) { Assert.IsNotNull(Tracker.Current, "Tracker.Current"); Assert.IsNotNull(Tracker.Current.Session, "Tracker.Current.Session"); Assert.IsNotNull(goalId, "goalId"); using (XConnect…

Sitecore Symposium 2019 takeaways

Sitecore Symposium is the event of the year in the Sitecore world. This was my first year attending and it was also my first time as a speaker at this magnificent event! My presentation took place in one of the breakout rooms at the Swan Hotel and the whole experience was amazing. As a speaker, you are not able to enjoy all the sessions and fun stuff going around Symposium, because you have to practice! There’s a room for speakers only where you can practice in an almost real stage. I spent a few hours in this room practicing my presentation with my partner in crime Deepthi Katta until we felt we were ready! Speaking at Symposium was an amazing experience and attending the event is definitely something that I recommend to everyone that is part of this Sitecore world, from marketers, to clients, to developers, etc. But let’s get to the important stuff, this year’s theme was “Human connections in a digital world” and my main takeaways are around these 3 key areas: Sitecore 9.3, Sitecor…

Netflix Next With Sitecore Cortex - Recap

Image
It was such an amazing experience being on stage at Sitecore Symposium this year! The conference lineup was amazing and this post is especially for those who were not able to attend my session. Deepthi Katta and I built a movie recommendations engine using Sitecore Cortex that used the users' interactions (by using Sitecore Goals) to recommend similar movies to users, but our goal was not just to showcase that. The main purpose of the session was to make everyone aware that everything is possible with Sitecore. Enough words, the code used can be found here: Github and the slides can be found here: PDF Slides



Netflix Next With Sitecore Cortex - Symposium 2019

Image
This year Deepthi Katta and I will be talking at Sitecore Symposium. Join us on November 6th, at 1:30 pm.


Netflix has become a part of daily routine in most of our lives. But have you ever seen Netflix with your Sitecore lens on? Can we do something as cool, or even better than a Netflix experience and predict what a user would want to watch next? Does the app actually make an effort to know me, understand me, and then project my potential favorite titles? The answer is no longer a surprise; it is a very loud and clear YES! With a pluggable architecture of Sitecore Cortex, the possibilities are endless. In this session, we will show you how you can achieve an awesome personalized experience, which we believe represents the next level of Netflix using Sitecore Cortex. Get your popcorn ready, and count us in on your next movie watch!
See you in Orlando!!