Those sites can easily get your IP address, but there's really not all that much they can do with it. If you're experiencing those sort of ads, it's more likely that tracking cookies and/or spyware has been installed on your system. As always, you should ignore those popup ads and use reputable cleaning software. Running a full system scan would be a good idea.