One of the most heated battles for control of the Web is happening through the tiny snippets of code companies like Facebook, Google and Twitter are pushing people to add to their sites. Add a simple “Like” or “Buzz” button, and you’ll get nifty new ways for your users to promote your content. Everybody wins, right?

Of course, these aren’t completely altruistic moves. With enough distribution, these HTML tags and lines of Javascript can help these companies understand how people move across the web and what matters to them beyond the borders of Facebook.com or Google.com.

Facebook made a very big move this month when it unveiled the Open Graph, an ambitious plan to map all people’s relationships to each other and to the objects they care about, like bands, movies, books and restaurants. It involves spreading new plugins and “Like” buttons across millions of sites and tagging huge swaths of the Web so Facebook can better analyze those pages.

The privacy implications are enormous. The more sites that install these gadgets and buttons, the more places Facebook will be able to know where you are. It’s only taken a week for 50,000 sites to add them.

The concept isn’t necessarily really new. Advertisers have been using cookies, which are unique identifiers assigned to visitors that can be tracked, for years to serve ads. Facebook’s much bigger rival Google probably has more data on individual Internet usage than any other Web company in the world through its patchwork of products from AdSense to DoubleClick to analytics to search.

But Facebook’s tracking is unique because much of what it collects is very clearly tied to specific individuals.

The key thing to remember is: Every time you land on a page with a social plugin or a “Like” button and you’re logged into Facebook, the company will have data that you’ve been there. That happens even if you haven’t clicked anything. Facebook’s upcoming social bar will also track your presence in a similar way.

Facebook stresses that it only cares about data that represents “high-quality” interactions such as “likes,” comments and shared content, not browsing histories.

“We don’t do anything with that data. It’s technically logged at a base server level, but we don’t keep it for very long,” said Ethan Beard, director of Facebook’s Developer Network. “What’s important is that we’re looking to help users share proactive actions.”

Beard couldn’t specify how long Facebook stores the data, which could raise issues if the company is subpoenaed by law enforcement officials and asked for browsing histories.

Google’s data tracking, while far more extensive than what Facebook can do now, is largely siloed within separate products. The company may have you logged into Gmail at a specific IP address while a page you’re visiting with Google Analytics or AdSense installed also picks up that same IP address.

But Google doesn’t cross-reference data from the two products, said spokesperson Brian Richardson, adding that AdSense doesn’t match its data against Gmail log-in data.

Facebook’s analytics are different because they’re about sharing and virality. They, by definition, have to track the identity of the user even though publishers don’t get to see exactly who shares their content.

Google has tried to balance the intrusiveness of its tracking with opt-outs and dashboards that show how a user is being targeted or what data the company has collected on them. (There’s a pretty comprehensive dashboard of what Google tracks on youhere and you can also opt-out of Google’s advertising cookies here.)

Facebook, of course, has its own set of extensive but often intimidating privacy controls for what you share through its network. But the best way to prevent the company from tracking what you do outside of Facebook.com is to log out.

At the end of the day, there is no way a consumer can definitively tell what data any of these Internet companies store on them. We put our trust and faith in Google and Facebook to be responsible stewards of our information.

The new mass of data Facebook will soon be collecting on us opens the door to all kinds of ad targeting possibilities. And the competitive threat that unleashes may pressure Google to move in the same direction.

Facebook is betting that the personalized and social experiences it will be able to provide across the web will be profoundly valuable. Just be prepared to be watched.