Facebook is facing EU curbs on how it exploits vast amounts of its users' most
personal information to create bespoke advertising.

The European Commission is planning to stop the way the website "eavesdrops" on its users to gather information about their political opinions, sexuality, religious beliefs – and even their whereabouts.

Using sophisticated software, the firm harvests information from people's activities on the social networking site – whatever their individual privacy settings – and make it available to advertisers.

However, following concerns over the privacy implications of the practice, a new EC Directive, to be introduced in January, will ban such targeted advertising unless users specifically allow it.

Even though most of the information it harvests is stored on computers in the USA, if Facebook fails to comply with the new legislation it could face legal action or a massive fine.

The move threatens to damage Facebook's plans to float on the Wall Street stock exchange next year, by undermining the way it makes money.

Viviane Reding, the vice president of European Commission, said the Directive would amend current European data protection laws in the light of technological advances and ensure consistency in how offending firms are dealt with across the EU.

"I call on service providers – especially social media sites – to be more transparent about how they operate. Users must know what data is collected and further processed (and) for what purposes.

"Consumers in Europe should see their data strongly protected, regardless of the EU country they live in and regardless of the country in which companies which process their personal data are established."

The move comes as a Sunday Telegraph investigation highlights the extent to which Facebook can help companies to focus adverts according to the profiles of users.

The information analysed and stored by the company is not limited to users' personal details, and "likes" and "dislikes" that they input on their "walls".

The firm also gathers details about their friends, family and educational background and detects subtle changes to their lifestyle, enabling it, for example, to target a bride-to-be with advertising for wedding photographers.

Other commercially valuable information, such as what music people are listening to via the site, is also available to advertisers.

Everything people share with their friends on Facebook is being tracked by the firm, retained, and can be used for commercial purposes.

It can even harvest information by performing keyword searches on behalf of advertisers. In this way, it can find out, for instance, details about people's political beliefs or their sexual preferences.

Facebook stores messages and "chats" sent via the site and keeps them on its database even after they are deleted by those involved in the private online conversations.

The company says it does not use this informatin for advertising.

The sheer volume of personal data accumulated by the company was hinted at earlier this year when a 24-year-old Austrian student, Max Schrems, asked it what information it held on him.

The request led to the site sending him a CD containing 1,222 pages of data. He complained to data watchdogs because the disclosures were incomplete and made clear the social networking site retained further information about him which it had not handed over.

Next week, the EU's data protection working party, which includes the UK Information Commissioner, will meet to discuss the "state of play" regarding Facebook.

They will discuss an audit of the company's working practices being conducted by the data protection watchdog in Ireland, where Facebook has its international headquarters.

The working group has warned internet firms over the use of behavioural advertising techniques which enable them "to track individuals ... to serve tailored advertising."

A report from the group says in most cases, "individuals are simply unaware that this is happening" and adds that the authors were "deeply concerned about the privacy and data protection implications of this increasingly widespread practice."

All Facebook's 800 million users, whether they realise it or not, agree to let the company use of their personal information.

When signing up, they approve a 4,000 word contract, which licenses Facebook to use their data as it sees fit. This contract can be viewed by clicking on a link in the small print at the foot of each page on the site.

Unlike other traditional media outlets, including newspapers, the website makes no distinction between information obtained for commercial purposes and details gathered in the course of its other activities, as people share content and talk online with their friends.

In the past, Facebook was largely funded through a banner advertising contract with Microsoft. But the gradual increase in advertising on the site, which started in 2009, is intended to make Facebook self-sufficient and ready for a stock market flotation.

In Britain, the gradual introduction of more targeted advertising has earned it £25 million in the last two years but this figure is expected to increase dramatically as it prepares to float its shares on Wall Street.

A spokesman for the UK Information Commissioner said: "Facebook should ensure that any data it collects should be used in the manner that its users expect.

"If personal data is being passed on to a third party or used for targeted advertising then this should be made clear to the user when they sign up to the site and reinforced when users are invited to use an application."

Facebook last night said advertisers only saw "anonymous and aggregate information" to allow them to target their campaigns and that this meant they were not able to target named individual users.

So while advertisers cannot say they want their adverts to go to specific individuals, they can spell out a very detailed description of the sort of person they want to reach – such as age, location, family background – which means the campaigns will only target a limited group of people.

They said that people's political views could only be passed on to advertisers if the user filled out a specific section on their profiles.

Advertising was also "age-gated", it said, so companies wanting to advertise alcohol would not be shown to people under the age of 18 in the UK.

A spokesman for the company said: "We understand that people share a lot of information on Facebook and we take this very seriously.

"We believe ads that are relevant, social and personalised based on your real interests are better.

"We can show relevant ads in a way that respects individual privacy because our system only provides advertisers with anonymous and aggregate information for the purpose of targeting ads.

"We do not share people's names with an advertiser without a person's explicit consent and we never sell personal information to third parties.

"There is no connection between the privacy settings people choose and our advertising. Whether you use your privacy settings to keep your profile very private, or very public, everyone sees the same amount of advertising down the right hand side of the page.

"Adverts are personalised to the individual user. We do not track peoples' behaviour to serve advertising."