There was a purpose behind seeking such information, the government said, adding that its aim was not to record anyone’s personal details