In this paper we produce several new invariants for CR and contact manifolds by looking at the noncommutative residue traces of various geometric projections. In the CR setting these operators arise from the Kohn-Rossi complex and include the Szeg\"o projections on forms. In the contact setting they stem from the generalized Szeg\"o projections at arbitrary integer levels of Epstein-Melrose and from the contact complex of Rumin. In particular, we recover and extend recent results of Hirachi and Boutet de Monvel and answer a question of Fefferman.