We perform a systematic analysis of generic string flux compactifications,making use of Exceptional Generalized Geometry (EGG) as an organizingprinciple. In particular, we establish the precise map between fluxes, gaugingsof maximal 4d supergravity and EGG, identifying the complete set of gaugingsthat admit an uplift to 10d heterotic or type IIB supegravity backgrounds. Ourresults reveal a rich structure, involving new deformations of 10d supergravitybackgrounds, such as the RR counterparts of the $\beta$-deformation. These newdeformations are expected to provide the natural extension of the$\beta$-deformation to full-fledged F-theory backgrounds. Our analysis alsoprovides some clues on the 10d origin of some of the particularly lessunderstood gaugings of 4d supergravity. Finally, we derive the explicitexpression for the effective superpotential in arbitrary N = 1 heterotic ortype IIB orientifold compactifications, for all the allowed fluxes.