Ammonia type smells invariably come from the products of combustion most notably *incomplete combustion* cause by various deficiencies eg: flame impingement, ghosting, flame lift-off, poor primary combustion air etc etc.
The onion type smell particularly is caused by the formation of aldehydes...