Cranberries have a lot of natural pectin, the ingredient that makes cooked fruit gel. To release that pectin, you need to cook the berries until they burst and can form a bond with the sugar. Boil the mixture until it is thickened and then-- and this is important-- don't refrigerate the mixture until it is cooled to room temperature.
Also, if you use a sugar substitute or try to use less sugar, the mixture will likely be thinner than you want.
For more tips and ideas, see our collection of Thanksgiving Cranberry Sauce Recipes.