I would say the heater, just so if your CO2 system fails, your heater will still be in water, rather then CO2.
I have noticed people having their co2 directly into filter inlet hoseIt doesn't matter which one comes first. But you are right that both should go on the outflow part. Actually, only the CO2 needs to be on the outflow pipe because you don't want CO2 going into the filter and being beaten by the impeller because it will just form bubbles and block the filter. The heater doesn't do this so it can go either on the intake or the outflow your choice.