Google collected sensitive personal data from 4.4 million iPhone users and used it to divide people into categories for advertisers, the UK High Court has heard.
The tech giant is facing a mass legal action over claims that it bypassed privacy settings on Apple iPhone handsets between August 2011 and February 2012.
The litigation is being brought by campaign group Google You Owe Us, led by former Which? director Richard Lloyd.
At the first hearing of the case in London today, lawyers for Mr Lloyd told the court information collected by Google included racial or ethnic origin, physical and mental heath, political affiliations or opinions, sexuality and sexual interests and social class.
They said information about an individual's financial situation, shopping habits and their geographical location were also obtained.
Hugh Tomlinson QC, representing Mr Lloyd, said information was then "aggregated" and users were put into groups such as "football lovers" or "current affairs enthusiasts".
These were then offered to subscribing advertisers to choose from when deciding who to direct their marketing to.
Mr Tomlinson said the data was gathered through "clandestine tracking and collation" of information relating to internet usage on iPhone users' Safari browser - known as the "Safari Workaround".
He told Mr Justice Warby the activity was exposed by a PhD researcher in 2012 and Google has already paid 39.5 million US dollars to settle claims in the USA.
Speaking ahead of the hearing, Mr Lloyd said: "I believe that what Google did was quite simply against the law.
"Their actions have affected millions in England and Wales and we'll be asking the judge to ensure they are held to account in our courts."
The campaign group hopes to win at least £1 billion in compensation for an estimated 4.4 million users of the device.
Google contends the type of "representative action" being brought against it by Mr Lloyd is unsuitable and should not go ahead.
Lawyers for the California-based company said there is no suggestion the Safari Workaround resulted in any information being disclosed to third parties.
They also said it is not possible to identify those who may have been affected and the claim has no prospect of success.
Anthony White QC, for Google, said the purpose of Mr Lloyd's claim was to "pursue a campaign for accountability and retribution" against the company, rather than seek compensation for affected individuals.
He said: "The court should not permit a single person to co-opt the data protection rights of millions of individuals for the purpose of advancing a personal 'campaign' agenda and should not allow them to place the onus on individuals who do not wish to be associated with that campaign to take positive steps to actively disassociate themselves from it."
The hearing is expected to last two days.