It’s not unethical to keep track of a visitor’s IP address. There are several good reasons why it’s beneficial to keep track of visitors’ IP addresses (security, analytics, and so on). Apart from privacy laws in many European nations, there is nothing else.