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

Nov 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 amazon-adsystem.com in addition to amazon.com. 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

https://fbexternal-a.akamaihd.net/safe_image.php?d=AQBm7GKKCA3PNFB4
&w=110&h=80
&url=http%3A%2F%2Fecx.images-amazon.com%2Fimages%2FI%2F218yNY8bTiL._AC_SR200%2C144_.jpg
&rk=221790734642435
&fi=https%3A%2F%2Ffbcdn-creative-a.akamaihd.net
%2Fhads-ak-frc3%2Fs110x80%2F1354196_6010574131297_461792014_n.png

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.