Was considering spray foaming my attic. Either closed or open cell.... So... do I do the attic floor and not the roof rafters ? Just the roof rafters and gable ends? Or both ?

My ac air handler unit is in the attic. The foam company said I should do foam on the roof rafters. Said it would help the unit more and keep the home warm. Everything I read is floor! Anyone?

Google says attic floor!