Here’s how Facebook ad tracking and targetting works
Facebook’s ad targetting collects data from what you input, what sites you visit while you are logged on to Facebook in the background of your device and what third-party companies can pull on you

By Michelle Castillo
Reports from The New York Times and The Observer surfaced over the weekend alleging that political data analytics firm Cambridge Analytica used psychological data obtained from a Facebook quiz to target ads on the platform for President Donald Trump during the 2016 election.
Ad targeting from Facebook is so eerily accurate, people have begun to believe that Facebook is somehow listening to them through their phone. But Facebook has said time and time again it does not use microphones on people’s phones to listen to conversations .
So what’s really going on?
Let’s look at this real scenario that happened to an editor at CNBC. He was looking at a furniture retailer’s website for bed frames on his iPad, and mentioned it out loud to his wife. His wife opened her computer and went to Facebook, where she saw an ad for that specific furniture retailer.
We talked to several sources who are familiar with Facebook’s advertising technology to see how this could have happened. Here are several possibilities.
1. The furniture retailer asked its ad be shown to a certain demographic, and she fit the bill.