They don’t do much usually, and half of that length is the tail. Much like fish, activity level is important. My giant day gecko can be kept in 18x18x24 happily, but he doesn’t do much. My anole I keep in 12x12x18, but having once kept him in the gecko’s tank, I can tell you that that should be the minimum, not 10 gallons.
I keep my crested gecko in slightly smaller than the recommended size, but she is happy, laying eggs, and doesn’t do much anyway (laziest lizard ever).
The larger lizards generally just spend all day basking and can be taken out of the cage to roam around the house, so you can do smaller cages than you think.
That said, guidelines are generally correct but you should always shoot for larger, the lizard will thank you.