The legality of IP tracking varies by region. In the EU, for example, the General Data Protection Regulation (GDPR) requires explicit consent from users before collecting personal data, which includes IP addresses. It's crucial to understand and comply with the data protection laws applicable in your target audience's location.