Not the mattress, not the sleep tracker’s fancy metrics, not even bedtime consistency, though all three helped a little. The single biggest factor for sleep quality in my own data was room temperature. Nights below 68°F consistently scored higher on deep sleep than nights above 72°F, by a wide enough margin that it wasn’t close.
I tested this deliberately for the last three weeks of the ninety days, alternating a fan on and off on otherwise identical nights. The fan nights won almost every time.
Before spending money on a new mattress or a sleep gadget, it might be worth just turning the thermostat down two degrees for a week and seeing what happens.