They generally don't track IP address (or track it along with other elements, never alone, as it's pretty trivial to change and often is shared by multiple users - especially in case of mobile data providers).
What is usually tracked is cookies or super cookies, if you're on browser; essentially the first time you visit a site a unique ID is generated and passed to your browser, and every time you visit that site (first party), or another site that embeds parts of the original site (third party, think of all those "Share on FB" buttons you see scattered all over the internet) the original unique ID is sent back by your browser.
This behavior is needed, for instance, for authentication (when you login you're assigned a similar ID that is passed back by the browser with every next request, without requiring you to retype your credentials over and over) but unfortunately it works quite well for tracking you around too. You can mitigate the problem a bit by configuring the browser to forget all these identifiers any time it's closed, but even there, the moment you log back in to a service that tracks you they'll reassociate you to the ID you purged.