I occassionally post links to my favorite products on Amazon and other websites. Occassionally, I'll include an affiliate code that allows me to earn money if one of my readers makes a purchase. It's just a small way for me to offset the cost of hosting my blog.
The specifics of how a given website tracks your on-site behavior and purchases varies depending on the website, but you should know that I never see any of that. Your personal information remains in the hands of whichever retailers you choose to share it with.
You can read more about Amazon Associates, my favorite affiliate program, on the Amazon Associates website.