Web is filled up with the recent decision by Facebook to track user browsing history like adage.com andNYTimes.

How can a web application use browsing history which is local to that browser? Is it even possible to get browsing history from modern browsers like FF and Chrome?

Historically, interest-based targeting on the social network hinged on users' own declarations of their likes and interests in their profiles, as well as Facebook pages they had "liked," according to Brian Boland, Facebook's VP-ads product marketing.

Now, Facebook is using the passive data -- where users go on their PCs and phones -- to make its own ads smarter. Advertisers who want to reach Facebook users who are interested in camping, for example, will be able to reach that audience with greater accuracy. "There's just a more robust set of information that informs that you're interested in camping," Mr. Boland said.


2 Answers 2


Many sites have social buttons. These images are hosted on the social networks servers. When these images are loaded in the browser, the browser will add the referer header. This allow the owners of the social network to know what sites you have visited.

I believe this explains how facebook is able to track your browsing history.

A web-browser plugin called AdBlock is capable of blocking these social buttons. Here is an explaination of the Social Buttons from their website:

From: https://adblockplus.org/en/tutorials#disablesocial

How to disable social media buttons

Almost every website today contains buttons of social media platforms, such as Facebook, Twitter, Google + and others. Even if you never click these buttons, your browsing data is still being transferred to these platforms in order to create a profile based on your browsing habits.

If you want to browse the web without being observed by the social media websites, Adblock Plus offers an easy solution to remove these buttons.

Ordinary tracking scripts from advertisements network does more or less the same - but can also be blocked with web-browser extensions.

  • Oh! I know of referral HTTP header, and moreover I don't think they meant 'liked' pages because Facebook have been using this quite early. Commented Jun 13, 2014 at 7:35
  • BTW As a web site owner you can do something about this
    – user13695
    Commented Jun 13, 2014 at 7:36
  • @Vineet This is not about liked pages. Just the button being displayed in the browser is enough.
    – user13695
    Commented Jun 13, 2014 at 7:37
  • @Jan what I did was craft custom share URLs for each share site and used my own icons. Looks nicer and you get the same function except for you lose some social sharing, but you could easily write a script to send you the stats of who clicks each link. Commented Jun 13, 2014 at 18:06
  • Adding tony tweet: you could also wrap the url yourself or use a link shortening service. I think twitters is open source Commented Jun 13, 2014 at 18:21

Facebook has the advantage that many webmasters embedded their "like" buttons into their websites. Whenever a user visists a website with a "like" button, Facebook can register this (Google does the same thing with AdSense advertising, by the way).

However, there are also other methods to find out which website a user visited recently which do not require any cooperation from these websites.

One method which was quite frequently used was abusing the fact that web browsers mark links the user visited recently in a different color than new ones. Javascript can be used to detect the color of a link. So by putting links to lots of well-known websites into the HTML code and then using Javascript to check the colors of these links, you can find which websites were visited by the user. This even works when the links aren't actually visible to the user. However, most browsers have taken measures to protect the user from this.

Another method is to attempt to load parts of the websites you want to check (like small design images) using Javascript and measure the time it takes. When the user visited the website recently, this will take much shorter, because the browser will load it from cache.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .