The Department of Health has come under fire for including code on NHS Choices that allows Facebook and Google to track visits and conditions searched for without first informing the user.

Tom Watson, the Labour MP West Bromwich East, has written to health secretary Andrew Lansley asking him to take steps to remove the tracking code from the NHS Choices website.

“I write to you to express my concern that the NHS is allowing Google, Facebook, and others to track your http://www.nhs.uk/ browsing habits, regardless of the fact that people use the page to seek medical advice.”

Watson urges the minister to take action and imagine how embarrassed he would be, if as a user of NHS Choices, he searched on an embarrassing condition like genital warts, and the data was made available to third parties.

Watson cites a post on the According to the Wilted Buttercup blog that claims there are four organisations – including WebTrendslive, Google Analytics and Facebook – that can track user habits on the site through code included on the conditions search section.

"There are the four third party companies that make requests every time a “conditions page” on NHS Choices is viewed by a user," says the blog.

The member for West Bromwich East concludes: “I understand the demands to offer government service online but this should not be achieved at the price of privacy.

"I urge you to take steps to ensure that third party websites should not have access to such information. This could be simply achieved by ensuring all third party interaction is run on an opt-in system, rather than the current opt-out model.”

A DH spokesman said: "Facebook capturing data from sites like NHS Choices is a result of Facebook’s own system.

"When users sign up to Facebook they agree Facebook can gather information on their web use. NHS Choices privacy policy, which is on the homepage of the site, makes this clear.

"We advise that people log out of Facebook properly, not just close the window, to ensure no inadvertent data transfer."