I think it could be useful to collect this data, both for administrative and research purposes.
I’m unsure, currently, exactly what data should be collected by the censuses (that would be proposed and discussed here). The data that is collected, should be collected anonymously. Furthermore, participation should be entirely voluntary.
You specify that they “don’t need to know”. I was specifically proposing a hypothetical where they only had some level of desire for the data and not a need.