I bet it could probably be done by doing statistical analysis or some AI technique to analyze one's browsing data, and maybe combining it with other information about you that they get from other sources (purchase history, social media participation, etc...).
The problem for them is that even if it works this adds extra processing time, effort, and development time.. which can add up when aggregated over the many millions/billions of users they have.