How Does Facebook Know What's In My Amazon Shopping Cart?

November 27, 2013

Earlier today I was looking at buying a new keyboard and placed it into the shopping cart at Amazon, though I didn't pay for it yet as I might order something else.

Just now I was looking at Facebook, and noticed a "random" ad on the sidebar. Lo and behold the picture of the ad was the keyboard in my shopping cart! Say what????

It didn't stay there long enough to analyze it, but the chances of a green logitech keyboard appearing randomly out of all of the products at Amazon is basically zero.

Now I use the same email address for both Amazon and Facebook and I checked the cookies and found in addition to But the Facebook page appeared to only reference its own cookies.

Trying to analyze what Facebook is doing on its page is pretty tedious, everything comes from a CDN, and there are many encrypted or randomly named elements. I don't really know how this ad was generated but somehow it was able to obtain an image from an Amazon database or through some shared connection, likely through an iframe. Or maybe Amazon and Facebook have some kind of sharing agreement?

I refreshed the page and got the ad back. The image link is

This does nothing outside of the page of course. It looks like the Akamai image request then requests the image from Amazon, but how does it know what to ask for? I guess Amazon could be asked "Give me an image pertaining to some key we agreed to earlier."

This could be embarrassing if you ordered a gift for someone who then saw it on the screen. Or something embarrassing and then logged in at work. Possibilities are endless.

It's a little odd that something I am buying appeared in an ad but maybe the point is to remember to buy it.

Of course Facebook's CEO would love for all of our information be totally public so he could sell more ads much easier. So far there isn't any other choice to keeping in touch with friends, or I'd leave.

Guess I better buy the damn keyboard already.