SAN FRANCISCO — CONSUMER trust is a vital currency for every big Internet company, which helps to explain why the giants of Silicon Valley have gone to great lengths in recent months to show how hard they are fighting back against government surveillance. Companies have released transparency reports, many for the first time, enumerating how many times law enforcement agencies demand user data; their executives have issued blistering statements; and several firms, including Facebook and Google, have filed lawsuits in a bid to reveal more about secret government orders.

All the while, though, a central contradiction has become ever harder to conceal. The Internet industry, having nudged consumers to share heaps of information about themselves, has built a trove of personal data for government agencies to mine — erecting, perhaps unintentionally, what Alessandro Acquisti, a Carnegie Mellon University behavioral economist, calls “the de facto infrastructure of surveillance.”

Nearly five months after Edward J. Snowden, the former National Security Agency contractor, went public with classified documents detailing the agency’s widespread spying, the Internet industry has only sharpened its efforts to track users online, which it considers essential to profitability. Behaviorally targeted advertising is the principal revenue source for a host of online companies.

Earlier this month Google announced plans to feature users’ names, photos and posts to promote products in Web ads. Facebook recently expanded its search offerings and made it harder to hide from strangers trying to find you. Meanwhile, digital advertising networks are developing sophisticated new ways to track consumers on cellphones, gleaning intimate insights into who you are and what you like. And Twitter, which recently announced plans for a public offering, has partnered with a company that tracks whether ads on Twitter can influence what you buy offline.