Its not actually illegal to track IP, every website does so.
You should be glad it was just some IP grabber link. And be cautious of opening such links especially from strangers.
What I do is when I receive such links is, connect to VPN, change my MAC address and then open the link. I mean if you really have to and want to know whats inside.
Also remember, whenever you open a link of any sort, you are giving your consent to obtain your IP to that website. What the website does with that IP is upto them.