Some toilet sprays can be classed as deodorizers (or air sanitizers in the US?), while others call themselves air fresheners. So it may depend on which brand you are using, but generally the deodorizer spray is working a little harder than the air freshener.
Odor control products can work through a number of different methods:
- Chemical transformation. Typically oxidization. This is why bleach is a good product for eliminating smell.
- Adsorption or Absorption. Trapping airborne smelly molecules is a great way to keep them from your nostrils. Activated charcoal in-soles for your shoes are a great example of this. Zeolites are also used. An air purifier would be what you'd need to use in a bathroom to eliminate smells using this method. Absorption into other media can then also be used in conjunction with other methods (chemical)
- Sanitizer or "biocide" agents. These kill odor-causing bacteria, fungi and other microorganisms. The main culprit for 'toilet smell' comes from the results of bacterial activity in your gut. Whilst they do reduce the quantity of airborne bacteria, they require a constant applcation, and so can't be classed as an antiseptic.
- Masking. This what air fresheners do. Add a stronger, nicer smelling fragrance. Humans only have a few million olfactory receptors. If you keep them busy with volatile pleasant fragrances, malodorous molecules can't get a look in.
- Sealing. Painting over or applying a sealant to a urine-soaked concrete floor or smoke-laden timber panel is often the only way to mask some smells.
Most air spray deodorizers (sanitizers) use a combination of the above methods. They almost all use some form of masking (except those that claim to be fragrance-free), as well as acting as a biocide and in some cases promoting chemical transformation as well.
There are growing concerns about the safety of using air sprays.
And just as a wonderful aside; one of the main causes of toilet odor is a molecule called skatole (3-methylindole), which also happens to be used in perfumery and also as a flavoring in ice cream!